Skip to content

API Reference

OpenAI-compatible API for multiple backends (DeepSeek, Moonshot, Zhipu, MiniMax, Qwen / Bailian, Baidu ERNIE, Volcengine, Tencent Hunyuan, Baichuan, StepFun, and others you enable).


Base URL

https://cnaitoken.store/v1

Authentication

Include your API key in the request header:

Authorization: Bearer sk-your-api-key

Get your API key from cnaitoken.store → Tokens.


Endpoints

List Models

GET /v1/models

Returns the model IDs exposed for your API key (reflects one-api channel and mapping configuration).

Example:

curl https://cnaitoken.store/v1/models \
  -H "Authorization: Bearer sk-your-api-key"

Chat Completions

POST /v1/chat/completions

Create a chat completion.

Request Body:

Parameter Type Required Description
model string Yes Model ID as returned by GET /v1/models (e.g. deepseek-chat, qwen-plus, glm-4-plus, Volcengine ep-…, etc.)
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:

{
  "role": "system" | "user" | "assistant",
  "content": "Your message text"
}

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/panel/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 based on each model’s multiplier in the dashboard. Recharge at cnaitoken.store/panel/topup.

The table below shows example rates for DeepSeek only; other backends bill according to their configured multipliers.

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.