API Reference
OpenAI-compatible API for Chinese AI models.
Base URL
Authentication
Include your API key in the request header:
Get your API key from cnaitoken.store → Tokens.
Endpoints
List Models
GET /v1/models
Returns available models.
Example:
Chat Completions
POST /v1/chat/completions
Create a chat completion.
Request Body:
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID: deepseek-chat or deepseek-reasoner |
| messages | array | Yes | Array of message objects |
| stream | boolean | No | Set to true for streaming (default: false) |
| max_tokens | integer | No | Max tokens to generate (default: model max) |
| temperature | number | No | 0–2, sampling randomness |
| top_p | number | No | Nucleus sampling |
Message Object:
Example Request:
{
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is 2+2?"}
],
"max_tokens": 256
}
Example Response:
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "2 + 2 equals 4."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 8,
"total_tokens": 28
}
}
Streaming
Set stream: true for streaming responses. The response will be Server-Sent Events (SSE).
Error Responses
| Status | Description |
|---|---|
| 401 | Invalid or missing API key |
| 402 | Insufficient quota (recharge at cnaitoken.store/topup) |
| 429 | Rate limit exceeded |
| 500 | Server error |
Error format:
{
"error": {
"message": "Error description",
"type": "invalid_request_error",
"code": "insufficient_quota"
}
}
Pricing
Credits are deducted per token. Recharge at cnaitoken.store/topup.
| Model | Input | Output |
|---|---|---|
| deepseek-chat | ~$1.68/M tokens | ~$2.52/M tokens |
| deepseek-reasoner | ~$1.68/M tokens | ~$2.52/M tokens |
Prices may vary. Check your dashboard for current balance.