One gateway for production AI traffic

Use one Base URL to reach Chinese AI models.

ChinaAPI gives your app a single OpenAI-compatible endpoint for DeepSeek, Qwen, GLM, Kimi, Doubao, image, video, embedding, and rerank models. Keep your SDKs, replace the endpoint, and manage usage from one dashboard.

Connection

https://api.chinaapi.ai
1 API key
OpenAI compatible
40+ providers
Tip Set your SDK base URL to https://api.chinaapi.ai/v1 and use your ChinaAPI token as the bearer key.

Authentication

All API requests use bearer token authentication. Create a token in the dashboard, then send it in the Authorization header.

HTTP headers
Authorization: Bearer $CHINAAPI_KEY
Content-Type: application/json

Supported protocols

Choose the request format your application already uses. One ChinaAPI key and Base URL work across all three protocol families.

OpenAI

/v1/chat/completions

Use with OpenAI SDKs, Cherry Studio, Cline, Open WebUI, and most tool clients.

Gemini

/v1beta/models/{model}:generateContent

Use Gemini-compatible clients when your application depends on Gemini request structure.

Claude

/v1/messages

Route Claude Messages API payloads while keeping the same gateway key and quota controls.

Supported model providers

ChinaAPI unifies the Chinese model providers already published in the catalog. Availability, aliases, and pricing are shown in the dashboard for your account.

DeepSeek Qwen GLM Kimi Doubao MiniMax

Supported model types

Start with the model type, then select an available model alias from the dashboard. Each type has its own request shape and billing dimensions.

LLM

Reasoning and chat

Text generation, tool calling, structured output, and optional reasoning controls.

Image

Image generation

Prompt-to-image requests with model-specific size and quality options.

Video

Video generation

Asynchronous generation with duration, resolution, and model-specific quality settings.

Audio

ASR and TTS

Upload audio for transcription or generate speech from text.

Embedding

Search and retrieval

Create vectors for retrieval and rerank candidate documents.

LLM integration

Most OpenAI clients work after changing baseURL. Use the model name published in your ChinaAPI dashboard.

Key parameters: model and messages are required. Use temperature, top_p, max_tokens, and stream for generation behavior. reasoning_effort can be low, medium, high, or a model-specific value when the selected reasoning model supports it.

curl
curl https://api.chinaapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      { "role": "user", "content": "Hello" }
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
Node.js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.CHINAAPI_KEY,
  baseURL: "https://api.chinaapi.ai/v1",
});

const result = await client.chat.completions.create({
  model: "deepseek-chat",
  messages: [{ role: "user", content: "Hello" }],
});

Coding agent integration

Coding agents reach the gateway over the protocol they already speak: /v1/messages for Claude-style agents, /v1/responses for Codex, and /v1/chat/completions for everything else. Point the tool at ChinaAPI and its requests keep the same key, quota, logs, and billing as your own API traffic.

Base URL shape Claude Code appends /v1/messages to whatever you give it, so it takes the bare host https://api.chinaapi.ai. Every other tool on this page expects the /v1 suffix spelled out. A doubled or missing /v1 is the most common cause of 404s here.

Hermes Agent

POST /v1/chat/completions

Point the model block of ~/.hermes/config.yaml at the gateway, or run hermes model and pick Custom endpoint interactively. base_url carries the /v1 suffix; Hermes appends /chat/completions itself.

yaml · ~/.hermes/config.yaml
model:
  default: kimi-k2.7-code
  provider: custom
  base_url: https://api.chinaapi.ai/v1
  api_key: <your ChinaAPI key>

Claude Code

POST /v1/messages

Export the three environment variables and start claude as usual. The ANTHROPIC_DEFAULT_*_MODEL variables map Claude Code's internal model tiers onto ChinaAPI models, which is what lets you run Chinese models inside an unmodified Claude Code.

shell · Claude Code
export ANTHROPIC_BASE_URL=https://api.chinaapi.ai
export ANTHROPIC_AUTH_TOKEN=$CHINAAPI_KEY
export ANTHROPIC_DEFAULT_OPUS_MODEL=kimi-k3
export ANTHROPIC_DEFAULT_SONNET_MODEL=kimi-k2.7-code
export ANTHROPIC_DEFAULT_HAIKU_MODEL=glm-5-turbo

claude

Codex

POST /v1/responses

Codex talks the Responses protocol, so wire_api must be responses; leaving it on the chat wire format breaks tool calls. Put your key in the environment variable named by env_key.

toml · ~/.codex/config.toml
model = "deepseek-v4-flash"
model_provider = "chinaapi"

[model_providers.chinaapi]
name = "ChinaAPI"
base_url = "https://api.chinaapi.ai/v1"
wire_api = "responses"
env_key = "CHINAAPI_KEY"

Cline, Roo Code, Kilo Code

POST /v1/chat/completions

All three use the same OpenAI Compatible provider form, field for field. Enter the model ID exactly as it appears in Console → Models; these tools do not fetch a model list for custom providers.

Settings → API Provider → OpenAI Compatible
Base URL   https://api.chinaapi.ai/v1
API Key    <your ChinaAPI key>
Model ID   glm-5.2

Cursor

POST /v1/chat/completions

Override the base URL under Settings → Models → OpenAI API Key. Add the ChinaAPI model name with Add model first, then leave only ChinaAPI models enabled, because Cursor otherwise sends its built-in model names to your override URL.

Settings → Models → Override Base URL
Base URL   https://api.chinaapi.ai/v1
API Key    <your ChinaAPI key>
Model      deepseek-v4-pro

OpenClaw

POST /v1/messages

Declare ChinaAPI as a provider with "api": "anthropic-messages" and list the models you want selectable in the session picker.

json · ~/.openclaw/openclaw.json
{
  "models": {
    "providers": {
      "chinaapi": {
        "baseUrl": "https://api.chinaapi.ai",
        "apiKey": "<your ChinaAPI key>",
        "api": "anthropic-messages",
        "models": ["kimi-k3", "glm-5.2"]
      }
    }
  }
}

Aider

POST /v1/chat/completions

Aider routes by model prefix, so keep the openai/ prefix on the model name even though the model itself is a Chinese one.

shell · Aider
export OPENAI_API_BASE=https://api.chinaapi.ai/v1
export OPENAI_API_KEY=$CHINAAPI_KEY

aider --model openai/deepseek-v4-pro

Choosing models: the model names above are working examples, not a fixed list. Open Console → Models for the aliases enabled on your account. For agent work, prefer a coding-tuned model on the tier the agent uses most and a cheap fast model on its lightweight tier — Claude Code, for instance, sends background summarisation to its Haiku tier, so mapping that tier to a small model saves the most quota.

Image, audio, video, and retrieval integration

These capabilities use the same Base URL and bearer key as chat, but each one has its own endpoint and payload. The model IDs below are working examples; check Console → Models for the latest model catalog before shipping.

Image generation

POST /v1/images/generations

Send a JSON prompt. Read the generated asset from data[0].url, or from data[0].b64_json when the selected model returns base64.

Key parameters: prompt and model are required. Use size for resolution, n for image count, and response_format for url or b64_json. quality and style are model-specific; common values include standard, hd, or auto.

curl · image
curl https://api.chinaapi.ai/v1/images/generations \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-4-5-251128",
    "prompt": "A cinematic skyline at blue hour",
    "size": "1024x1024",
    "response_format": "url",
    "n": 1
  }'

Gemini image generation

POST /v1/chat/completions

Gemini image models use the OpenAI Chat Completions request shape. Read the generated Markdown image from choices[0].message.content; the image payload is a data:image/... URL.

Key parameters: send the signed-in catalog model ID in model and the image prompt in messages. Do not send this model to /v1/images/generations.

curl · Gemini image chat
curl https://api.chinaapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<GEMINI_IMAGE_MODEL>",
    "messages": [
      {
        "role": "user",
        "content": "Generate a cinematic skyline at blue hour"
      }
    ],
    "stream": false
  }'

Speech to text

POST /v1/audio/transcriptions

Upload audio as multipart form data; do not set the Content-Type header manually. The recognized text is returned in the text field.

Key parameters: send model and file as multipart fields. Use response_format as json, text, or verbose_json when supported by the selected model.

curl · transcription
curl https://api.chinaapi.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -F "model=qwen3-asr-flash" \
  -F "file=@speech.wav" \
  -F "response_format=json"

Text to speech

POST /v1/audio/speech

The response body is binary audio, so write it to a file. alloy selects the model's default voice; a model may also publish provider-specific voice IDs.

Key parameters: use input, model, and voice. Select an output with response_format such as mp3 or wav; speed and instructions are available when the selected model supports them.

curl · speech
curl https://api.chinaapi.ai/v1/audio/speech \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mimo-v2.5-tts",
    "input": "Hello from ChinaAPI.",
    "voice": "alloy",
    "response_format": "mp3"
  }' \
  --output speech.mp3

Video generation

POST /v1/video/generations

Video generation is asynchronous. Submit once, save the returned task_id, then poll GET /v1/video/generations/{task_id} until the task succeeds or fails. Creating a task can consume quota.

Key parameters: prompt and model start the task. Use duration, width, height, fps, and n where supported. Resolution is the common clarity control. Put provider-specific controls such as quality, quality_level, negative_prompt, or camera settings in metadata only when they are listed for that model.

curl · video
curl https://api.chinaapi.ai/v1/video/generations \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse-1.1-t2v",
    "prompt": "A paper boat crossing a moonlit lake",
    "duration": 5,
    "width": 1280,
    "height": 720
  }'

curl https://api.chinaapi.ai/v1/video/generations/$TASK_ID \
  -H "Authorization: Bearer $CHINAAPI_KEY"

Embeddings

POST /v1/embeddings

Send one string or an array of strings. The vectors are returned in data[].embedding in the same order as the inputs.

Key parameters: input accepts one string or a batch. Use dimensions and encoding_format only when supported by the selected embedding model.

curl · embeddings
curl https://api.chinaapi.ai/v1/embeddings \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-v4",
    "input": ["ChinaAPI connects Chinese AI models."]
  }'

Rerank

POST /v1/rerank

Rank candidate documents against a query. Read the ordered matches and relevance scores from results.

Key parameters: send a query and documents; use top_n to limit the returned ranked candidates.

curl · rerank
curl https://api.chinaapi.ai/v1/rerank \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gte-rerank-v2",
    "query": "How do I call Chinese AI models?",
    "documents": [
      "Use one ChinaAPI Base URL and API key.",
      "Install a local database."
    ],
    "top_n": 2
  }'

Operate from the dashboard

ChinaAPI is not only a forwarding endpoint. It includes keys, users, groups, channel health, logs, quota, and billing controls for real production traffic.

Keys

Scoped API tokens

Create and rotate tokens, assign groups, and keep user traffic isolated.

Routing

Provider fallback

Configure multiple upstream channels so one model alias can survive provider failures.

Logs

Usage and cost

Track request status, token usage, quota consumption, and error details in one place.