YITOKEN YITOKENAPI Docs

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

ModelPrice (quota units)≈ CNY per image
seedream-5.0-lite0.45¥0.45
seedream-5.0-pro0.9¥0.90

Video generation · per token

ModelMultiplier≈ CNY per 1M tokens
doubao-seedance-2.036.225¥72.5
doubao-seedance-2.0-480p-1080p23¥46.0
doubao-seedance-2.0-480p-720p23¥46.0
doubao-seedance-2.0-720p-1080p23¥46.0
doubao-seedance-2.0-fast27.75¥55.5
doubao-seedance-2.0-fast-480p-1080p18.5¥37.0
doubao-seedance-2.0-fast-480p-720p18.5¥37.0
doubao-seedance-2.0-fast-720p-1080p18.5¥37.0
doubao-seedance-2.0-mini17.25¥34.5
doubao-seedance-2.0-mini-480p-1080p11.5¥23.0
doubao-seedance-2.0-mini-480p-720p11.5¥23.0
doubao-seedance-2.0-mini-720p-1080p11.5¥23.0
seedance-2.025.5¥51.0
seedance-2.0-fast18.5¥37.0
seedance-2.0-mini11.5¥23.0
seedance-2.535¥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

ModelGroupInputOutputCache readCache write
gpt-6.1-solGPT 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

MethodApplies toCalculation
Per requestImage generationA fixed amount per call, regardless of prompt length
Per tokenVideo generationquota = 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

PathPurpose
POST /v1/images/generationsImage generation
POST /v1/video/generationsSubmit a video generation task; returns a task_id
GET /v1/video/generations/{task_id}Get the status of a video task
POST /v1/chat/completionsText chat (GPT-6.1 Sol)
POST /v1/responsesResponses API, used by clients such as Codex CLI
GET /v1/modelsList available models
GET /v1/dashboard/billing/usageQuery 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

ResponseMeaningWhat to do
401 Invalid tokenThe API key is invalid or has been deletedCheck Authorization: Bearer sk-... and make sure the sk- prefix is included
model_not_foundThe model name is wrong, or the model isn't available to your groupCall /v1/models to confirm the available model names
insufficient_quotaInsufficient balance, or not enough to cover a video task's pre-chargeTop up and try again
403The API key is disabled or has exceeded its limitsCheck 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.