YITOKEN API Docs
Unified AI gateway · Fully compatible with the OpenAI API spec — existing code only needs a new base_url.
Quick start
1
Sign up and get an API key
Sign in at
yitoken.com.cn → Console → API Keys → Create, then copy the key, which looks like
sk-xxxxxx.
2
Point base_url at YITOKEN
Every endpoint path is the same as OpenAI's; only the domain changes.
3
Make your first call
The example below generates an image.
curl
curl https://yitoken.com.cn/v1/images/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model":"seedream-5.0-lite","prompt":"a red bicycle","n":1}'
Python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://yitoken.com.cn/v1",
)
resp = client.images.generate(
model="seedream-5.0-lite",
prompt="a red bicycle leaning on a brick wall",
n=1,
)
print(resp.data[0].url)
Node.js
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-your-api-key',
baseURL: 'https://yitoken.com.cn/v1',
});
const r = await client.images.generate({
model: 'seedream-5.0-lite',
prompt: 'a red bicycle',
});
console.log(r.data[0].url);
Models & pricing
YITOKEN offers ByteDance's Seedance video generation models, the Seedream and noimg image generation models, and the GPT-6.1 Sol text model. The Models & pricing page has the full model list and live prices. Prices are in Chinese yuan (CNY).
Image generation · per request
| Model | Price (quota units) | ≈ CNY per image |
seedream-5.0-lite | 0.45 | ¥0.45 |
seedream-5.0-pro | 0.9 | ¥0.90 |
Video generation · per token
| Model | Multiplier | ≈ CNY per 1M tokens |
doubao-seedance-2.0 | 36.225 | ¥72.5 |
doubao-seedance-2.0-480p-1080p | 23 | ¥46.0 |
doubao-seedance-2.0-480p-720p | 23 | ¥46.0 |
doubao-seedance-2.0-720p-1080p | 23 | ¥46.0 |
doubao-seedance-2.0-fast | 27.75 | ¥55.5 |
doubao-seedance-2.0-fast-480p-1080p | 18.5 | ¥37.0 |
doubao-seedance-2.0-fast-480p-720p | 18.5 | ¥37.0 |
doubao-seedance-2.0-fast-720p-1080p | 18.5 | ¥37.0 |
doubao-seedance-2.0-mini | 17.25 | ¥34.5 |
doubao-seedance-2.0-mini-480p-1080p | 11.5 | ¥23.0 |
doubao-seedance-2.0-mini-480p-720p | 11.5 | ¥23.0 |
doubao-seedance-2.0-mini-720p-1080p | 11.5 | ¥23.0 |
seedance-2.0 | 25.5 | ¥51.0 |
seedance-2.0-fast | 18.5 | ¥37.0 |
seedance-2.0-mini | 11.5 | ¥23.0 |
seedance-2.5 | 35 | ¥70.0 |
Video is billed by the number of tokens in the generated content, which depends on duration, resolution and frame rate.
A 5-second 480p video is about 50,000 tokens; a 15-second 720p video is about 300,000 tokens.
Text · per token
| Model | Group | Input | Output | Cache read | Cache write |
gpt-6.1-sol | GPT Codex | ¥0.55 | ¥2.75 | ¥0.0275 | ¥0.6875 |
Prices are per 1M tokens for contexts up to 272K; above 272K, every price doubles.
Billing
Quota units
Your account balance is measured in quota: 500,000 quota = 1 unit.
When you top up, ¥1 = 1 unit.
Two billing methods
| Method | Applies to | Calculation |
| Per request | Image generation | A fixed amount per call, regardless of prompt length |
| Per token | Video generation | quota = tokens × model multiplier |
Pre-charge and settlement
Video is an async task. When it starts, an amount based on the upper limit is pre-charged; when it finishes, it's settled against the actual usage reported upstream: if actual usage is below the pre-charge, the difference is refunded; if above, the difference is charged.
Failed tasks are refunded in full. If your balance can't cover the pre-charge, the task can't start — this is the most common cause of failure.
API
| Path | Purpose |
POST /v1/images/generations | Image generation |
POST /v1/video/generations | Submit a video generation task; returns a task_id |
GET /v1/video/generations/{task_id} | Get the status of a video task |
POST /v1/chat/completions | Text chat (GPT-6.1 Sol) |
POST /v1/responses | Responses API, used by clients such as Codex CLI |
GET /v1/models | List available models |
GET /v1/dashboard/billing/usage | Query usage |
Text model example
curl https://yitoken.com.cn/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Hello"}]}'
For clients that use the Responses API, such as Codex CLI, just set base_url to https://yitoken.com.cn/v1.
Full video generation flow
# 1. Submit the task
curl https://yitoken.com.cn/v1/video/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model":"seedance-2.0-mini","prompt":"a paper boat on a stream","metadata":{"resolution":"480p"}}'
# → {"task_id":"task_xxx","status":"queued"}
# 2. Poll the status (about 1–3 minutes)
curl https://yitoken.com.cn/v1/video/generations/task_xxx \
-H "Authorization: Bearer sk-your-api-key"
Common errors
| Response | Meaning | What to do |
401 Invalid token | The API key is invalid or has been deleted | Check Authorization: Bearer sk-... and make sure the sk- prefix is included |
model_not_found | The model name is wrong, or the model isn't available to your group | Call /v1/models to confirm the available model names |
insufficient_quota | Insufficient balance, or not enough to cover a video task's pre-charge | Top up and try again |
403 | The API key is disabled or has exceeded its limits | Check the key's status and credit limit in the console |
Top up
Console → Wallet → Top up. Pay by scanning with Alipay or WeChat Pay; credit arrives instantly.