contree-client¶
Python, JavaScript, and Go clients for the Contree API, generated from one OpenAPI specification at build time. Same wire protocol, same models, same core concepts — pick the language, the concepts transfer directly. The Tutorial walks through the whole API across languages, side by side.
Sync and async Python clients.
JavaScript and TypeScript with fetch.
Typed Go clients with net/http.
Python — sync and async flavours over pluggable transport adapters (stdlib http.client, urllib3, requests, httpx, aiohttp); the whole API surface lives on the
ContreeSyncClient/ContreeAsyncClientbase classes, so code written against them works with any backend.JavaScript — pure ESM with TypeScript declarations over the platform
fetch(Node ≥ 18.17 and browsers); camelCase methods, wire-spelled fields.Go — a typed
net/httpclient with generated models and operations, pull-based event followers, and lazy pagers.
Install¶
pip install contree-client # stdlib http.client backend only
pip install contree-client[urllib3] # + urllib3
pip install contree-client[requests] # + requests
pip install contree-client[httpx] # + httpx (sync and async)
pip install contree-client[aiohttp] # + aiohttp (async)
npm install contree-client # JavaScript/TypeScript (fetch, ESM)
go get github.com/nebius/contree-client/go/v1
Quick start¶
from contree_client.sync import ContreeClient # first installed backend
with ContreeClient.from_profile() as client: # or ContreeClient("IAM_TOKEN", project=...)
response = client.spawn_instance("uname -a", "tag:ubuntu:latest", shell=True)
for event in client.iter_operation_events(response.uuid, follow=True):
print(event.type, event.data)
from contree_client.asyncio import ContreeAsyncClient # first installed backend
async with ContreeAsyncClient.from_profile() as client: # or ContreeAsyncClient("IAM_TOKEN", project=...)
response = await client.spawn_instance("uname -a", "tag:ubuntu:latest", shell=True)
async for event in client.iter_operation_events(response.uuid, follow=True):
print(event.type, event.data)
import { ContreeClient } from "contree-client";
const client = await ContreeClient.fromProfile(); // or new ContreeClient("IAM_TOKEN", { project })
const response = await client.spawnInstance("uname -a", "tag:ubuntu:latest", {
shell: true,
});
for await (const event of client.iterOperationEvents(response.uuid, {
follow: true,
})) {
console.log(event.type, event.data);
}
await client.close();
package main
import (
"context"
"fmt"
"log"
"os"
contree "github.com/nebius/contree-client/go/v1"
)
func main() {
ctx := context.Background()
client, err := contree.NewClient(
os.Getenv("CONTREE_TOKEN"),
contree.WithProject(os.Getenv("CONTREE_PROJECT")),
)
if err != nil {
log.Fatalf("create client: %v", err)
}
response, err := client.SpawnInstance(
ctx,
"uname -a",
"tag:ubuntu:latest",
contree.SpawnInstanceOptions{Shell: true},
)
if err != nil {
log.Fatalf("spawn uname command: %v", err)
}
operationID, ok := response.UUID.Value()
if !ok || operationID == "" {
log.Fatal("spawn response has no operation ID")
}
for event, err := range client.FollowOperationEvents(ctx, operationID, nil) {
if err != nil {
log.Fatalf("read operation %s events: %v", operationID, err)
}
fmt.Println(event.Type, event.Data)
}
}
Documentation¶
Python client
JavaScript client
Go client
License¶
All clients are distributed under the Apache License, Version 2.0.
Copyright Nebius B.V. 2026 (see the “LICENSE” file in the repository).