[SDKs]

SDKs

Topo works with the OpenAI SDKs you already use. The Topo SDKs for Python and TypeScript add typed topo fields, receipts, wallets and agents.

Install

pip install topolabs

Configure

Both SDKs read TOPO_API_KEY from the environment. Set TOPO_BASE_URL only if you route through a private gateway.

.env
bash
TOPO_API_KEY="tp_live_8f3a…c21e"TOPO_BASE_URL="https://api.topolabs.ai/v1"  # optional

First request

from topolabs import Topo topo = Topo()  # reads TOPO_API_KEY response = topo.chat.completions.create(    model="claude-sonnet-5.5",    messages=[{"role": "user", "content": "Explain zk proofs in 3 lines"}],    pay_with="usdt",) print(response.choices[0].message.content)print(response.topo.receipt.amount)  # 0.0041

Keep the OpenAI SDK

Prefer the OpenAI client? Change the base URL. Topo fields arrive on the raw response, and you can send them with extra_body in Python or as extra fields in TypeScript.

response = client.chat.completions.create(    model="claude-sonnet-5.5",    messages=[{"role": "user", "content": "Explain zk proofs in 3 lines"}],    extra_body={"pay_with": "topo", "topo": {"verification": "strict"}},)

Versions

PackageLanguageLatestRuns on
topolabsPython1.8.0Python 3.9+
@topolabs/sdkTypeScript1.8.0Node 18+, Bun, Deno and edge runtimes
topoCLI0.9.4macOS and Linux