API Documentation
TokenChuhai provides an OpenAI-compatible API for DeepSeek models. Drop-in replacement — just change base_url.
Quick Start
- 1Get your API key — enter your email, copy the key
- 2Set
base_urltohttps://tokenchuhai.chat/api/v1 - 3Use the OpenAI SDK or any HTTP client — it just works
Code Examples
Chat Completionpython
from openai import OpenAI
client = OpenAI(
api_key="tch_YOUR_API_KEY",
base_url="https://tokenchuhai.chat/api/v1"
)
response = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[
{"role": "user", "content": "Explain quantum computing"}
]
)
print(response.choices[0].message.content)cURLbash
curl https://tokenchuhai.chat/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer tch_YOUR_API_KEY" \
-d '{
"model": "deepseek-v4-pro",
"messages": [{"role": "user", "content": "Hello!"}]
}'Node.jsjavascript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'tch_YOUR_API_KEY',
baseURL: 'https://tokenchuhai.chat/api/v1',
});
const response = await client.chat.completions.create({
model: 'deepseek-v4-flash',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0].message.content);API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/chat/completions | Chat completions (OpenAI compatible) |
| GET | /api/v1/models | List available models and pricing |
Models & Pricing
Pay-as-you-go. No subscriptions. Per 1 million tokens.
| Model | Input | Output | Context | Best For |
|---|---|---|---|---|
| deepseek-v4-pro | $0.50 | $2.00 | 128K | Best for coding, reasoning, general purpose |
| deepseek-v4-flash | $0.15 | $0.60 | 128K | Fast responses, simple tasks, high throughput |
Compare: GPT-4o is $2.50/$10.00 per 1M tokens. DeepSeek V4 Pro delivers same quality at 80% less.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer tch_YOUR_API_KEYKeys start with tch_. Get yours on the homepage.
SDK Compatibility
Any OpenAI-compatible SDK works. Just change the base URL:
OpenAI Python
OpenAI Node.js
LangChain
LlamaIndex
Vercel AI SDK
OpenAI Java
OpenAI Go
Semantic Kernel
Error Codes
| Code | Message | Fix |
|---|---|---|
| 401 | Invalid API key | Check your key is correct and active |
| 429 | Token quota exceeded | Top up in Dashboard → Top Up |
| 400 | Invalid request / unknown model | Check model name. Visit /api/v1/models for options |
Ready to try?
Get Free Test Tokens