API docs
The API follows OpenAI's paths and response style. Base URL: https://your-domain/v1. Calls are charged in US dollars to your account balance — the same balance as the studio.
Authentication
Create a key on the API keys page (it looks like sk-jg-…) and send it with every request:
Authorization: Bearer sk-jg-xxxxxxxxxxxxxxxxList models
GET/v1/models
curl https://your-domain/v1/models \
-H "Authorization: Bearer $API_KEY"Video generation
Video is asynchronous: the request returns a task right away. Poll it until the status is completed, then fetch the video.
POST/v1/videos
curl https://your-domain/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "Slow push-in on a girl turning to smile in a wheat field, backlit at sunset",
"seconds": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}'GET/v1/videos/{id}
status is one of queued, in_progress, completed or failed. Completed tasks include video_url; failed ones include error.message and the cost is refunded. Poll every 3–5 seconds.
curl https://your-domain/v1/videos/$TASK_ID \
-H "Authorization: Bearer $API_KEY"GET /v1/videos/{id}/content returns 409 until the video is ready.
Image generation
The image endpoint is synchronous: the response arrives with the finished images.
POST/v1/images/generations
curl https://your-domain/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"prompt": "Minimal product shot of a frosted glass perfume bottle on white, soft side light",
"aspect_ratio": "1:1",
"n": 1
}'Reference media
Some models take reference images, videos and audio together. Pass them as images, videos and audios, and mention them in the prompt as @image1, @video1, @audio1 — numbered from 1 per type, in the order of each array. We translate the tags for each provider.
curl https://your-domain/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "@image1 walks into the room from @video1, matching its camera move, with @audio1 as the background music",
"seconds": 5,
"aspect_ratio": "16:9",
"first_frame": "https://example.com/start.png",
"images": [
"https://example.com/character.png"
],
"videos": [
"https://example.com/camera-move.mp4"
],
"audios": [
"https://example.com/music.mp3"
],
"generate_audio": true
}'Limits and support are on each model page (e.g. up to 9 images, 3 videos and 3 audio clips). Too many references returns too_many_images / too_many_videos / too_many_audios; a field the model doesn't support returns feature_not_supported.
Request body
Video and image endpoints share one request body. Each model's allowed values are on its model page.
| Field | Type | Description |
|---|---|---|
| model | string | Required. Model ID. |
| prompt | string | Required. 1–8000 characters. |
| seconds | number | Video length in seconds, within the model's range. |
| resolution | string | Resolution, e.g. 720p. |
| aspect_ratio | string | Aspect ratio, e.g. 16:9. |
| n | integer | Number of images, up to the model's limit. |
| images | string[] | Reference image URLs (http/https), up to the model's limit. |
| videos | string[] | Reference video URLs (http/https), up to the model's limit. |
| audios | string[] | Reference audio URLs (http/https), up to the model's limit. |
| first_frame | string | Image URL the video starts on, if the model supports it. |
| last_frame | string | Image URL the video ends on, if the model supports it. Use with first_frame. |
| generate_audio | boolean | Generate sound with the video, if the model supports it. |
| seed | integer | Integer seed. The same seed and settings give similar results. |
| extra | object | Optional model-specific options. |
Optional fields you leave out use the model's defaults.
Billing and errors
- Billing is in US dollars. Responses carry
cost_usd, the price of the run as a decimal string (e.g."0.5000"; up to 4 decimals for sub-cent prices). - The model's price is held from your balance when you submit and refunded automatically if generation fails. Every movement is listed under Billing.
401missing or invalid key ·402insufficient_balance: not enough balance — top up to continue ·400an option the model doesn't support ·404unknown model or task.- API errors look like
{"error": {"message": "…", "type": "…", "code": "…"}}. Switch oncode; showmessageto people. - Messages are localized: send
X-Locale(en, zh-CN, zh-TW, ja, ko) or rely onAccept-Language.
HTTP/1.1 402 Payment Required
{
"error": {
"message": "Insufficient balance: $0.50 needed, $0.10 available",
"type": "insufficient_quota",
"code": "insufficient_balance"
}
}