Developer center

Change one base_url.
Drop 30% in cost.

TokensChain is fully OpenAI-SDK compatible. Get multi-cloud routing, semantic caching and compliance moderation without rewriting code.

Quickstart

Integrate in 3 steps

  1. 1
    Sign up
    After KYC you automatically receive 1M free tokens.
  2. 2
    Get your API key
    Create one in the console under "API keys" and store it safely.
  3. 3
    Call the API
    Point base_url to https://api.tokenschain.io/v1 and you're live.
  • Python / Node.js / Go / Java SDKs
  • Streaming (SSE) and function calling
  • Enterprise invoicing & tax support
  • Deep China compliance with data sovereignty
python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokenschain.io/v1",
    api_key="sk-...",
)

resp = client.chat.completions.create(
    model="qwen3-max",
    messages=[{"role": "user", "content": "Analyze this earnings report..."}],
)
print(resp.choices[0].message.content)

Core endpoints

OpenAI compatible — no business-code changes.

Full API reference
MethodPathDescription
POST/v1/chat/completionsChat completions with stream / tools / vision
POST/v1/completionsText completions (legacy models)
POST/v1/embeddingsEmbeddings: BGE / M3E / OpenAI models
POST/v1/rerankReranking to improve RAG recall
POST/v1/images/generationsText-to-image: Flux / SD3 / Tongyi Wanxiang
POST/v1/audio/transcriptionsSpeech-to-text (Whisper / Paraformer)
GET/v1/modelsList available models and pricing
Streaming
SSE streaming with first-token latency < 300ms.
Function calling
Native OpenAI function calling and JSON Schema constraints.
Content moderation
Bidirectional moderation aligned with China's GenAI service regulations.

SDKs & tools

Officially maintained, open-source.

All SDKs
Python SDK
pip install tokenschain
v1.2.0
Node.js SDK
npm i @tokenschain/sdk
v1.1.5
Go SDK
go get tokenschain-go
v0.9.3
Java SDK
Maven Central
v0.8.0
All systems operational
Last 90 days: 99.97% uptime
Status page

Start building your AI app →