# 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](tutorial.md) walks through the whole API across languages, side by side. ::::{grid} 1 1 3 3 :gutter: 2 :::{grid-item-card} Python Tutorial :link: tutorial.html?tab=sync :link-alt: Python Tutorial Sync and async Python clients. ::: :::{grid-item-card} JavaScript Tutorial :link: tutorial.html?tab=js :link-alt: JavaScript Tutorial JavaScript and TypeScript with fetch. ::: :::{grid-item-card} Go Tutorial :link: tutorial.html?tab=go :link-alt: Go Tutorial Typed Go clients with net/http. ::: :::: - **Python** — sync and async flavours over pluggable [transport adapters](python/adapters.md) (stdlib http.client, urllib3, requests, httpx, aiohttp); the whole API surface lives on the `ContreeSyncClient` / `ContreeAsyncClient` base 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/http` client with generated models and operations, pull-based event followers, and lazy pagers. ## Install ```shell 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 ::::{tab-set} :::{tab-item} Python · sync :sync: sync ```python 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) ``` ::: :::{tab-item} Python · async :sync: async ```python 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) ``` ::: :::{tab-item} JavaScript :sync: js ```js 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(); ``` ::: :::{tab-item} Go :sync: go ```go 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 ```{toctree} :maxdepth: 1 tutorial parity ``` ```{toctree} :caption: Python client :maxdepth: 2 python/adapters python/api python/testing ``` ```{toctree} :caption: JavaScript client :maxdepth: 2 js/api js/reference js/testing ``` ```{toctree} :caption: Go client :maxdepth: 2 go/api go/reference go/testing ``` ## License All clients are distributed under the Apache License, Version 2.0. Copyright Nebius B.V. 2026 (see the "LICENSE" file in the repository).