Token Hub is OpenAI-compatible. Change your base URL and key — your existing code works.
Endpoint: POST /v1/chat/completions
Identical to OpenAI's Chat Completions API. Supports streaming via SSE.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID (e.g. deepseek-ai/DeepSeek-V3) |
| messages | array | Yes | Conversation messages with role and content |
| temperature | float | No | Sampling temperature (0-2, default 1) |
| max_tokens | int | No | Max tokens to generate |
| stream | boolean | No | Set to true for streaming response |
| top_p | float | No | Nucleus sampling parameter |
Endpoint: GET /v1/models
| Model ID | Context | Input / 1M | Output / 1M |
|---|---|---|---|
| deepseek-ai/DeepSeek-V3 | 64K | $1.40 | $2.80 |
| deepseek-ai/DeepSeek-R1 | 64K | $0.70 | $2.80 |
| Qwen/Qwen2.5-7B-Instruct | 32K | $0.35 | $0.35 |
| Qwen/Qwen2.5-72B-Instruct | 32K | $0.90 | $0.90 |
| Qwen/Qwen2.5-14B-Instruct | 32K | $0.50 | $0.50 |
| THUDM/GLM-4-9B-0414 | 32K | $0.40 | $0.40 |
| deepseek-ai/DeepSeek-V3.2 | 64K | $1.40 | $2.80 |
| Status | Meaning |
|---|---|
| 401 | Invalid or missing API key |
| 429 | Quota exceeded — top up your balance |
| 502 | Upstream connection error |