API Documentation
Unified access to DeepSeek, Qwen and other Chinese AI models via standard OpenAI / Anthropic protocols. No overseas accounts required.
🚀 Quick Start
Base URL:
Auth:
Get a Key: Create one in the dashboard
https://chinaiapi.comAuth:
Authorization: Bearer <your-api-key>Get a Key: Create one in the dashboard
Simplest Call
curl https://chinaiapi.com/v1/chat/completions \\
-H "Authorization: Bearer sk-your-key" \\
-H "Content-Type: application/json" \\
-d '{
"model": "deepseek-v4-pro",
"messages": [{"role": "user", "content": "Hello"}]
}'
📡 Endpoints
POST
/v1/chat/completions
OpenAI-compatible chat completions. Works with all models.
curl https://chinaiapi.com/v1/chat/completions \\
-H "Authorization: Bearer sk-your-key" \\
-H "Content-Type: application/json" \\
-d '{
"model": "qwen3.7-plus",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"}
],
"temperature": 0.7,
"max_tokens": 2048
}'
POST
/v1/messages
Anthropic / Claude-format messages. Use with Claude Code, Cursor, etc.
curl https://chinaiapi.com/v1/messages \\
-H "x-api-key: sk-your-key" \\
-H "anthropic-version: 2023-06-01" \\
-H "Content-Type: application/json" \\
-d '{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Write a bubble sort in Python"}]
}'
Note: The Claude endpoint uses
x-api-key header (not Authorization).
POST
/v1/responses
OpenAI Responses API. Use with OpenAI Codex CLI.
curl https://chinaiapi.com/v1/responses \\
-H "Authorization: Bearer sk-your-key" \\
-H "Content-Type: application/json" \\
-d '{
"model": "deepseek-chat",
"input": "Write a fibonacci function",
"instructions": "Use Python"
}'
GET
/v1/models
List all available models for your account.
curl https://chinaiapi.com/v1/models \\
-H "Authorization: Bearer sk-your-key"
🧠 Models
DeepSeek
| Model Name | Protocols | Use Case |
|---|---|---|
deepseek-v4-pro |
ChatClaudeCodex | Strongest reasoning · Coding · Complex tasks |
deepseek-v4-flash |
ChatClaudeCodex | Fast responses · Daily chat · Lightweight tasks |
👉 Aliases: deepseek-chat deepseek-reasoner deepseek-v3 deepseek-r1 deepseek-coder all route to deepseek-v4-pro
|
||
Qwen (Tongyi Qianwen)
| Model Name | Protocols | Use Case |
|---|---|---|
qwen3.7-max | Chat | Best reasoning · Complex tasks |
qwen3.7-plus | Chat | Strong reasoning · Daily use |
qwen3.6-plus | Chat | Great value · Daily conversation |
qwen3.6-flash | Chat | Fast responses · Lightweight tasks |
qwen3.5-plus | Chat | Balanced performance |
qwen-max | Chat | Legacy · Compatibility |
qwen-plus | Chat | Legacy · Compatibility |
qwen-turbo | Chat | Legacy · Compatibility |
Full model list: Call /v1/models to see all models. Qwen series includes 100+ variants — vision (VL), speech (ASR/TTS), translation, image generation and more.
Claude Code (Anthropic Protocol)
| Model Name | Backend | Notes |
|---|---|---|
claude-sonnet-4 | DeepSeek V4 Pro | Recommended for Claude Code |
claude-3.5-sonnet | DeepSeek V4 Pro | Backward compatibility |
claude-3-haiku | V4 Flash | Fast responses |
⚙️ Client Setup
Channel / Model Configuration
Add or configure a model provider in the admin dashboard:
1. Go to Dashboard → Channels → Add Channel
2. Select the provider type (OpenAI, Ali, Anthropic, etc.)
3. Fill in the upstream API key and base URL
4. Models field: list model names separated by commas
e.g. deepseek-v4-pro,deepseek-v4-flash
5. Group field: choose which user groups can access
e.g. default,vip,svip
6. Save — the system auto-generates routing entries
Optional: Model Mapping (client name → upstream name)
{"deepseek-chat": "deepseek-v4-pro", "claude-sonnet-4": "deepseek-v4-pro"}
Tip: Pricing is configured under Settings → Model Pricing. Group ratios are under Settings → Group Ratio.
Claude Code
# 1. Configuration
# Option A: Environment variables (quick)
export ANTHROPIC_BASE_URL=https://chinaiapi.com
export ANTHROPIC_API_KEY=sk-your-key
# Option B: Config file (~/.claude/config.json)
# { "provider": "anthropic", "baseUrl": "https://chinaiapi.com" }
# 2. Run
claude -p "Write a Python fibonacci function"
# For longer sessions:
# claude
OpenAI Codex CLI
🚀 一键配置,30 秒上手。
macOS / Linux
# 1. 登录后台拿到 API Key → https://chinaiapi.com/dashboard
# 2. 一行搞定(回车后粘贴你的 Key)
curl -s https://chinaiapi.com/scripts/setup-codex.sh | bash -s sk-your-key
# 3. 以后直接运行
chinai-codex
Windows
# 1. 安装 Codex
npm install -g @openai/codex@0.136.0
# 2. 运行
$env:OPENAI_API_KEY="sk-your-key"
$env:OPENAI_BASE_URL="https://chinaiapi.com/v1"
codex
💡 小贴士
• API Key 在哪? 登录 dashboard → Tokens → 创建新 Token。
• 默认模型
• 手动配置:
• API Key 在哪? 登录 dashboard → Tokens → 创建新 Token。
• 默认模型
deepseek-v4-flash(快速便宜),如需更强推理改用 deepseek-v4-pro。• 手动配置:
~/.codex/config.toml 写入 openai_base_url = "https://chinaiapi.com/v1"
from openai import OpenAI
client = OpenAI(
base_url="https://chinaiapi.com/v1",
api_key="sk-your-key"
)
response = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
OpenAI SDK (Node.js)
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://chinaiapi.com/v1',
apiKey: 'sk-your-key'
});
const response = await client.chat.completions.create({
model: 'qwen3.7-plus',
messages: [{ role: 'user', content: 'Hello' }]
});
console.log(response.choices[0].message.content);
cURL
curl https://chinaiapi.com/v1/chat/completions \\
-H "Authorization: Bearer sk-your-key" \\
-H "Content-Type: application/json" \\
-d '{"model": "deepseek-v4-pro", "messages": [{"role": "user", "content": "Hello"}]}'