SDKs & Libraries
Build faster with official and community SDKs for Go, Python, JavaScript, Swift, and Kotlin. Type-safe clients with auto token refresh and streaming support.
SDKs & Client Libraries
Build faster with official and community SDKs. Full type safety, automatic token refresh, retry logic, and streaming support across all major languages.
Official SDKs
Production-ready, maintained by the OrbVPN engineering team. Each SDK supports REST, gRPC, and WebSocket protocols with a unified client interface.
Go SDK
Official Go client. Idiomatic Go with context support, connection pooling, and gRPC streaming. go get github.com/orbvpn/sdk-go
Python SDK
Official Python client. Async/await support, type hints, and Pydantic models. pip install orbvpn
JavaScript / TypeScript SDK
Official JS/TS client. Full type definitions, tree-shakeable, and works in Node.js, Deno, and Bun. npm install @orbvpn/sdk
Swift SDK
Official Swift client for iOS and macOS. Swift concurrency, Combine support, and SPM distribution.
Kotlin SDK
Official Kotlin client for Android and JVM. Coroutines, Flow support, and Maven Central distribution.
SDK Features
Every official SDK ships with the same core capabilities out of the box.
Automatic Token Refresh
JWT access tokens are refreshed transparently before expiry. No manual token management required -- the SDK handles the full lifecycle including retry on 401 responses.
Retry with Exponential Backoff
Transient failures (network errors, 429, 503) are retried automatically with jittered exponential backoff. Configurable max retries and base delay.
Full Type Safety
Every request and response is fully typed. Go structs, Python Pydantic models, TypeScript interfaces, Swift Codable, and Kotlin data classes.
Streaming Support
First-class support for gRPC streaming RPCs and WebSocket connections. Server-stream, client-stream, and bidirectional patterns are all supported.
Installation
Go
go get github.com/orbvpn/sdk-go@latestPython
pip install orbvpnJavaScript / TypeScript
npm install @orbvpn/sdk
# or
yarn add @orbvpn/sdk
# or
pnpm add @orbvpn/sdkSwift
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/orbvpn/sdk-swift.git", from: "1.0.0")
]Kotlin
Add to your build.gradle.kts:
dependencies {
implementation("com.orbvpn:sdk-kotlin:1.0.0")
}Quick Start
Install the SDK
Pick your language and install via the package manager shown above.
Initialize the Client
Create a client instance with your credentials. The SDK handles authentication and token management automatically.
Make API Calls
Use the typed methods to interact with OrbNET, OrbMesh, and OrbGuard APIs.
Handle Real-Time Events
Subscribe to WebSocket channels or gRPC streams for live updates.
Code Examples
Go
package main
import (
"context"
"fmt"
"log"
orbvpn "github.com/orbvpn/sdk-go"
)
func main() {
// Initialize client with automatic token management
client, err := orbvpn.NewClient(
orbvpn.WithCredentials("user@example.com", "your_password"),
orbvpn.WithBaseURL("https://api.orbai.world"),
orbvpn.WithRetry(3, 500), // 3 retries, 500ms base delay
)
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Get current user profile
user, err := client.Users.Me(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Logged in as: %s\n", user.Email)
// List available VPN servers
servers, err := client.Servers.List(ctx, &orbvpn.ServerListParams{
Country: "US",
Limit: 10,
})
if err != nil {
log.Fatal(err)
}
for _, s := range servers.Data {
fmt.Printf("Server: %s (%s) - Load: %d%%\n", s.Name, s.City, s.Load)
}
// Stream real-time metrics via gRPC
stream, err := client.GRPC.OrbMesh.StreamMetrics(ctx, &orbvpn.MetricsRequest{
NodeID: "node_abc123",
Interval: 5, // seconds
})
if err != nil {
log.Fatal(err)
}
for {
metrics, err := stream.Recv()
if err != nil {
break
}
fmt.Printf("CPU: %.1f%% | Memory: %.1f%% | Connections: %d\n",
metrics.CpuUsage, metrics.MemoryUsage, metrics.ActiveConnections)
}
}Python
import asyncio
from orbvpn import OrbVPNClient, ServerListParams
async def main():
# Initialize client with automatic token management
client = OrbVPNClient(
email="user@example.com",
password="your_password",
base_url="https://api.orbai.world",
max_retries=3,
)
async with client:
# Get current user profile
user = await client.users.me()
print(f"Logged in as: {user.email}")
# List available VPN servers
servers = await client.servers.list(
ServerListParams(country="US", limit=10)
)
for server in servers.data:
print(f"Server: {server.name} ({server.city}) - Load: {server.load}%")
# Check a threat indicator via OrbGuard
result = await client.orbguard.intelligence.check(
indicator="suspicious-domain.com",
indicator_type="domain",
)
print(f"Threat score: {result.score}/100")
print(f"Categories: {', '.join(result.categories)}")
# Subscribe to real-time notifications
async for event in client.ws.notifications.subscribe():
print(f"[{event.type}] {event.message}")
asyncio.run(main())JavaScript / TypeScript
import { OrbVPNClient } from '@orbvpn/sdk';
const client = new OrbVPNClient({
email: 'user@example.com',
password: 'your_password',
baseURL: 'https://api.orbai.world',
maxRetries: 3,
});
async function main() {
// Get current user profile
const user = await client.users.me();
console.log(`Logged in as: ${user.email}`);
// List available VPN servers
const servers = await client.servers.list({
country: 'US',
limit: 10,
});
for (const server of servers.data) {
console.log(`Server: ${server.name} (${server.city}) - Load: ${server.load}%`);
}
// Check a threat indicator via OrbGuard
const threat = await client.orbguard.intelligence.check({
indicator: 'suspicious-domain.com',
indicatorType: 'domain',
});
console.log(`Threat score: ${threat.score}/100`);
// Subscribe to real-time notifications via WebSocket
const ws = client.ws.notifications.subscribe();
ws.on('notification', (event) => {
console.log(`[${event.type}] ${event.message}`);
});
ws.on('device_status', (event) => {
console.log(`Device ${event.deviceId}: ${event.status}`);
});
}
main().catch(console.error);TypeScript IntelliSense
The JavaScript/TypeScript SDK ships with full type definitions. Every method, parameter, and response is typed so you get autocomplete and compile-time error checking in VS Code, WebStorm, and other editors.
Configuration Options
All SDKs accept the same core configuration options:
| Option | Type | Default | Description |
|---|---|---|---|
baseURL | string | https://api.orbai.world | OrbNET REST API base URL |
grpcAddress | string | api.orbai.world:50051 | gRPC server address |
guardURL | string | https://guard.orbai.world | OrbGuard REST API base URL |
maxRetries | int | 3 | Maximum retry attempts for transient failures |
retryBaseDelay | duration | 500ms | Base delay between retries (jittered exponential) |
timeout | duration | 30s | Default request timeout |
tokenRefreshBuffer | duration | 5m | Refresh access token this long before expiry |
userAgent | string | orbvpn-sdk/{lang}/{version} | Custom User-Agent string |
Authentication Methods
The SDKs support all OrbVPN authentication methods:
Email & Password
Standard credential-based authentication with automatic JWT token management and refresh.
API Key
Service-to-service authentication using API keys. Best for OrbGuard integrations and server-side scripts.
OAuth 2.0
Third-party authentication flows via Google, Apple, and GitHub. SDKs handle the full OAuth redirect flow.
mTLS Certificates
Mutual TLS for OrbMesh node authentication. Provide client certificate and key paths to the SDK.
Community SDKs
These community-maintained SDKs are not officially supported but may be useful for additional languages and frameworks.
| Language | Package | Maintainer | Status |
|---|---|---|---|
| Rust | orbvpn-rs | @community | Beta |
| Ruby | orbvpn-ruby | @community | Alpha |
| C# / .NET | OrbVPN.SDK | @community | Beta |
| PHP | orbvpn/sdk-php | @community | Alpha |
| Dart / Flutter | orbvpn_sdk | @community | Beta |
Community SDK Disclaimer
Community SDKs are maintained by third-party developers and are not covered by OrbVPN support. Use them at your own discretion and always verify they are up-to-date with the latest API changes.
SDK Versioning & Compatibility
All official SDKs follow Semantic Versioning. Major versions correspond to API versions:
| SDK Version | API Version | Status |
|---|---|---|
v1.x | API v1 | Current -- Stable |
v0.x | API v1 (beta) | Deprecated |
Breaking Changes
Breaking changes are only introduced in major SDK releases. Minor and patch releases are always backward-compatible. Subscribe to the OrbVPN changelog for update notifications.
Start Building with the SDK
Choose your language, install the SDK, and ship your integration in minutes. Full REST, gRPC, and WebSocket support with automatic token management.