Blue Whale APIBlue Whale API

Quick Start

From sign-up to your first API call in about 5 minutes

From sign-up to your first API call result, the whole flow takes about 5 minutes.

1. Get an API Key

  1. Sign up and log in to the console
  2. Open the "Tokens" page and create a new API key (in the form sk-xxxxxx)
  3. Store it safely — the key is shown in full only once, at creation time

2. Text Models: A Chat Completion

Base URL: Domestic https://yunjizi.cn; Overseas https://api.yunjizi.cn. Choose per the gateway you integrate with; BASE_URL in the examples below is the corresponding domain.

BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seed-2-1-pro-260915",
    "messages": [{"role": "user", "content": "Introduce the blue whale in one sentence"}],
    "max_tokens": 512
  }'

choices[0].message.content holds the model output. All text models are reasoning models, so keep max_tokens at 512 or above — a lower value may return only the reasoning trace with no answer. See the Text Model API.

3. Image Models: An Image Generation

curl "$BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "A blue whale leaping out of the ocean, photorealistic",
    "size": "2048x2048"
  }'

data[0].url in the response is the generated image URL. See the Image Model API.

4. Video Models: Submit a Generation Task

curl "$BASE_URL/v1/video/generations" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "prompt": "A blue whale leaping out of the ocean, slow motion, cinematic look",
    "seconds": "5",
    "metadata": {
      "resolution": "720p",
      "ratio": "16:9",
      "generate_audio": true
    }
  }'

The id (same as task_id) in the response is the unique identifier of this task:

{
  "id": "task_9f3a2b7c",
  "task_id": "task_9f3a2b7c",
  "object": "video",
  "status": "queued"
}

5. Poll the Task Status

Video generation is asynchronous. We recommend polling every 5–10 seconds:

curl "$BASE_URL/v1/video/generations/task_9f3a2b7c" \
  -H "Authorization: Bearer sk-YOUR-KEY"

When data.status becomes SUCCESS, generation is complete. See Query a Task.

6. Download the Video

curl "$BASE_URL/v1/videos/task_9f3a2b7c/content" \
  -o result.mp4

Next Steps