
DEVELOPERS / API
API reference
Fully OpenAI-compatible — existing apps migrate without code changes.
BASE URL
https://api.tokenschain.io/v1
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat completions with SSE streaming. |
| POST | /v1/completions | Text completions (legacy-model compatible). |
| POST | /v1/embeddings | Text embeddings — supports bge, m3e and other open models. |
| GET | /v1/models | List available models and context lengths. |
| POST | /v1/rerank | Passage reranking, typically used in RAG pipelines. |
| GET | /v1/usage | Inspect account usage and quota. |
Sample request
curl https://api.tokenschain.io/v1/chat/completions \
-H "Authorization: Bearer $TOKENSCHAIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v3",
"stream": true,
"messages": [
{"role": "user", "content": "Introduce TokensChain in one sentence."}
]
}'Authentication
Every request must include Authorization: Bearer YOUR_API_KEY. Manage and rotate keys from the console under "API Keys".
Error codes
- 401 — Authentication failed — invalid or expired API key
- 429 — Rate limit hit — retry later or upgrade your plan
- 500 — Server error — automatic fail-over to a backup cluster