LightYear
/Docs
DocsAPI ReferenceOfficial API SDKs and Client Libraries

Official API SDKs and Client Libraries

Use official LightYear SDKs for Python, Node.js, Go, and PHP to interact with the API.

beginner
6 min read
LightYear Docs Team
Updated April 24, 2026
sdkapipythonnodejsgophp

LightYear provides official SDK libraries for popular programming languages, making it easier to integrate cloud management into your applications.

Python SDK

Installation

>_BASH
$pip install lightyear-python

Basic Usage

PYTHON
import lightyear

client = lightyear.Client(api_key="YOUR_API_KEY")

# List servers
servers = client.servers.list()
for server in servers:
    print(f"{server.label}: {server.main_ip} ({server.status})")

# Create a server
new_server = client.servers.create(
    region="sgp-01",
    plan="vc2-2c-4gb",
    os_id=1743,
    label="python-server-01",
    ssh_key_ids=["key_abc123"]
)
print(f"Created: {new_server.id}")

# Delete a server
client.servers.delete(server_id="srv_abc123")

Node.js SDK

Installation

>_BASH
$npm install @lightyear/sdk

Basic Usage

JS
import { LightYearClient } from '@lightyear/sdk';

const client = new LightYearClient({ apiKey: process.env.LIGHTYEAR_API_KEY });

// List servers
const { servers } = await client.servers.list();
console.log(servers.map(s => s.label));

// Create a server
const { server } = await client.servers.create({
  region: 'sgp-01',
  plan: 'vc2-2c-4gb',
  osId: 1743,
  label: 'node-server-01',
  sshKeyIds: ['key_abc123'],
});
console.log(`Created: ${server.id} at ${server.mainIp}`);

Go SDK

Installation

>_BASH
$go get github.com/lightyear/lightyear-go

Basic Usage

GO
package main

import (
    "context"
    "fmt"
    "github.com/lightyear/lightyear-go"
)

func main() {
    client := lightyear.NewClient("YOUR_API_KEY")
    ctx := context.Background()

    servers, _, err := client.Server.List(ctx, nil)
    if err != nil {
        panic(err)
    }

    for _, s := range servers {
        fmt.Printf("%s: %s (%s)\n", s.Label, s.MainIP, s.Status)
    }
}

PHP SDK

Installation

>_BASH
$composer require lightyear/lightyear-php

Basic Usage

PHP
<?php
require 'vendor/autoload.php';

use LightYear\Client;

$client = new Client('YOUR_API_KEY');

$servers = $client->servers()->list();
foreach ($servers as $server) {
    echo "{$server->label}: {$server->mainIp}\n";
}

[!NOTE] All SDKs are open source and available on GitHub. Contributions and bug reports are welcome.

Was this article helpful?

Your cookie choices for this website

This site uses cookies and related technologies, as described in our privacy policy, for purposes that may include site operation, analytics, and enhanced user experience. You may choose to consent to our use of these technologies, or manage your own preferences. Cookie policy