← Back to Admin Dashboard

Seedance 2.0 Relay API Documentation

Seedance 2.0 中转站为 B 端客户提供与火山引擎 Seedance 2.0 官方 API 完全兼容的代理接口。
您只需将 Base URL 和 API Key 替换为中转站分配的地址和 Relay Key,其余请求格式完全一致。

Core Value:凭证隔离 · 权限管控 · 配额管理 · 调用审计 · 零代码迁移
Base URL:https://your-host/relay/v3
Authentication:Authorization: Bearer rk-xxxxxxxx(中转站管理员分配)

Compatibility

中转站 API 与火山引擎 Seedance 2.0 官方 API 完全兼容。您现有的代码只需修改两处:

// Before (direct Volcengine)
baseURL: "https://ark.cn-beijing.volces.com/api/v3"
Authorization: Bearer <Volcengine API Key>

// After (via Relay)
baseURL: "https://your-host/relay/v3"
Authorization: Bearer rk-xxxxxxxx

Quick Start

3 步快速接入:

1
Get Relay Key
从管理员获取 rk-xxx
2
Create Task
POST 创建视频任务
3
Poll Result
GET 轮询任务状态

Minimal Example (cURL)

# Step 1: Create video generation task
curl -X POST https://your-host/relay/v3/contents/generations/tasks \
  -H "Authorization: Bearer rk-your-relay-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [{"type": "text", "text": "A cat yawning on a balcony in warm sunlight"}],
    "duration": 5,
    "resolution": "720p",
    "ratio": "16:9"
  }'

# Response: {"id": "cgt-xxxxxxxxxxxx-xxxxx"}

# Step 2: Poll task status (repeat until status is terminal)
curl https://your-host/relay/v3/contents/generations/tasks/cgt-xxxxxxxxxxxx-xxxxx \
  -H "Authorization: Bearer rk-your-relay-key"

# Response when done: {"status": "succeeded", "content": {"video_url": "https://..."}, ...}

Authentication

所有请求必须在 HTTP Header 中携带 Relay Key:

HeaderRequiredDescription
AuthorizationRequiredBearer rk-xxxxxxxx — 管理员分配的 Relay Key
Content-TypeRequiredapplication/json
X-Idempotency-KeyOptionalIdempotency key for create task. Same key returns cached result.
Security:Relay Key 等同于 API 密钥,请妥善保管。不要在客户端代码、URL 参数或公开仓库中暴露。如果泄漏,请联系管理员轮转 Key。

Process Flow

Video Generation Flow

1
Auth
Verify relay_key
2
Validate
Check model, quota
3
Proxy
Forward to Volcengine
4
Log
Record invocation
5
Response
Return result

Asset + Video Generation Flow

1
Create Group
Asset group
2
Upload Asset
Image/Video
3
Get Asset
Wait for active
4
Create Task
Use asset://id
5
Poll Result
Get video URL

Error Codes

All responses follow a unified format:

{
  "success": false,
  "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "Quota exceeded or account inactive"
  }
}

Relay Errors

CodeHTTPDescription
INVALID_RELAY_KEY401Missing or invalid relay key (must start with rk-)
RELAY_NOT_FOUND401Relay account not found in database
RELAY_INACTIVE401Account suspended or revoked
MODEL_NOT_ALLOWED403Requested model/endpoint not in whitelist
DURATION_EXCEEDED400Requested duration exceeds account limit
RESOLUTION_EXCEEDED400Requested resolution exceeds account limit
QUOTA_EXCEEDED429Daily/monthly call limit or concurrent task limit reached
NO_API_KEY400Account has no API Key configured (contact admin)
NO_CREDENTIALS400Account has no AK/SK configured (contact admin, needed for assets)

Upstream Errors (from Volcengine)

When the upstream Volcengine API returns an error, the relay forwards the original response body as-is. Common Seedance errors:

Error CodeDescription
InputTextSensitiveContentDetectedText prompt contains sensitive content
InputImageSensitiveContentDetectedInput image contains sensitive content
OutputVideoSensitiveContentDetectedGenerated video flagged by content moderation
InputImageSensitiveContentDetected.PrivacyInformationReal human face detected without proper asset authorization
InternalServiceErrorVolcengine internal error, retry later

Quota & Rate Limit

Each relay account has configurable quotas:

LimitDescriptionDefault
daily_callsMaximum task creation calls per day (UTC+8 reset)100
monthly_callsMaximum task creation calls per month3,000
concurrent_tasksMaximum tasks in running/queued state simultaneously5
max_durationMaximum allowed video duration (seconds)15
max_resolutionMaximum allowed resolution (480p/720p/1080p)720p
allowed_modelsModel/endpoint ID whitelist (empty = no restriction)[]

When a quota limit is reached, the API returns 429 QUOTA_EXCEEDED. Concurrent task count is automatically decremented when a task reaches a terminal state (succeeded/failed/expired/cancelled) via the query endpoint.

Tip:Query your task status regularly to keep the concurrent task counter accurate. If you don't query, tasks may time out after ~48h and the counter will eventually self-correct.

Create Video Generation Task

Create a Seedance 2.0 video generation task. Supports text-to-video, image-to-video (first frame / first+last frame), and multimodal reference generation.

POST /relay/v3/contents/generations/tasks

Request Body

FieldTypeRequiredDescription
modelStringYesModel ID or Endpoint ID. e.g. doubao-seedance-2-0-260128 or ep-xxxxxxxx
contentArrayYesArray of content items (see below)
durationIntegerOptionalVideo duration in seconds. 4-15 for Seedance 2.0. Use -1 for auto. Default: 5
resolutionStringOptional480p / 720p / 1080p (1080p not supported by fast model). Default: 720p
ratioStringOptional16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9 / adaptive
generate_audioBooleanOptionalGenerate synchronized audio. Only Seedance 2.0 supports this.
safety_identifierStringOptionalEnd-user identifier for content tracing (max 64 chars). Auto-injected if not provided.
seedIntegerOptionalRandom seed for reproducibility

Content Items

TypeFieldsDescription
text{ "type": "text", "text": "prompt" }Text prompt describing the video
image_url{ "type": "image_url", "image_url": { "url": "..." } }First frame image. URL can be HTTP/HTTPS or asset://<ASSET_ID>
image_url
(last frame)
{ "type": "image_url", "image_url": { "url": "..." }, "role": "last_frame" } Last frame image (first+last frame mode)
image_url
(reference)
{ "type": "image_url", "image_url": { "url": "..." }, "role": "reference_image" } Reference image for multimodal generation

Response

{
  "id": "cgt-20260601120000-xxxxx"
}

Returns a task ID. Use the Query Task endpoint to poll for results.

Available Models

Model IDNameMax ResolutionAudio Support
doubao-seedance-2-0-260128Seedance 2.0 Standard1080pYes
doubao-seedance-2-0-fast-260128Seedance 2.0 Fast720pYes

You may also use a custom Endpoint ID (e.g. ep-20260528xxxxxx-xxxxx) if configured by the admin.

Query Task Status

Poll the status of a video generation task. Keep polling until the status is terminal.

GET /relay/v3/contents/generations/tasks/{task_id}

Path Parameters

ParameterTypeDescription
task_idStringTask ID returned from Create Task (e.g. cgt-xxxxx)

Response (Running)

{
  "id": "cgt-20260601120000-xxxxx",
  "model": "doubao-seedance-2-0-260128",
  "status": "running"
}

Response (Succeeded)

{
  "id": "cgt-20260601120000-xxxxx",
  "model": "doubao-seedance-2-0-260128",
  "status": "succeeded",
  "content": {
    "video_url": "https://ark-prod-asset.tos-cn-beijing.volces.com/...",
    "last_frame_url": "https://..."
  },
  "usage": {
    "completion_tokens": 50638,
    "total_tokens": 50638
  },
  "resolution": "720p",
  "ratio": "16:9",
  "duration": 5,
  "seed": 37072,
  "generate_audio": true
}

Task Status Values

StatusTerminal?Description
queuedNoTask is queued, waiting for resources
runningNoTask is generating the video
succeededYesVideo generated, content.video_url available
failedYesGeneration failed, check error field
expiredYesTask expired (typically after 48h)
cancelledYesTask was cancelled
Polling Strategy:Recommended polling interval: 5-10 seconds. When status reaches a terminal state, stop polling. The video URL is available for download for a limited time (typically 24h).

List Available Models & Endpoints

Query the available models and endpoints for your relay account. Useful for discovering which models/endpoints are configured.

GET /relay/v3/models

Response

{
  "success": true,
  "data": {
    "allowed_models": ["ep-20260528130905-bjj8g"],
    "endpoints": [
      {
        "id": "ep-20260528130905-bjj8g",
        "name": "seedance-2.0-fast",
        "status": "Running",
        "model_name": "doubao-seedance-2-0-fast",
        "model_version": "260128",
        "description": "Fast model endpoint"
      }
    ]
  }
}

allowed_models: If non-empty, only these model IDs / endpoint IDs are allowed for this account.
endpoints: All endpoints visible to the account's IAM sub-user. Status Running means the endpoint is active.

Asset Library Overview

The Asset Library allows you to upload personal images/videos as assets for use in Seedance 2.0 video generation (e.g., virtual avatar, reference footage). Assets are organized into Asset Groups.

Important:When creating an asset group for the first time, the root account must have signed the authorization letter in the Volcengine console. Contact your admin if you encounter authorization errors.

Asset Usage in Video Generation

Once an asset is uploaded and in active status, use its ID in the video generation prompt:

{
  "content": [
    { "type": "image_url", "image_url": { "url": "asset://asset-20260601-xxxxx" } },
    { "type": "text", "text": "The person in image 1 is dancing in the rain" }
  ]
}

Asset Requirements

TypeFormatsSizeOther
Imagejpeg, png, webp, bmp, tiff, gif, heic< 30MB, 300-6000pxAspect ratio 0.4 ~ 2.5
Videomp4, mov< 50MB, 480p-1080p2-15s, 24-60fps
Audiowav, mp3< 15MB2-15s

Create Asset Group

Create a group to organize related assets (e.g., all assets for one virtual character).

POST /relay/v3/assets/groups

Request Body

FieldTypeRequiredDescription
NameStringYesGroup name
GroupTypeStringYesAIGC
DescriptionStringOptionalGroup description

Response

{
  "ResponseMetadata": { ... },
  "Result": {
    "Id": "group-20260601-xxxxx"
  }
}

List Asset Groups

POST /relay/v3/assets/groups/list

Request Body

FieldTypeRequiredDescription
FilterObjectYes{ "GroupType": "AIGC" }. Optionally add "Name" for fuzzy search or "GroupIds" array.
PageNumberIntegerOptionalPage number, starting from 1. Default: 1
PageSizeIntegerOptionalItems per page. Default: 10

Request Example

{
  "Filter": { "GroupType": "AIGC" },
  "PageNumber": 1,
  "PageSize": 10
}

Create Asset (Upload)

Upload an asset (image/video/audio) to an asset group. This is an asynchronous API — the asset will be in processing status initially.

POST /relay/v3/assets

Request Body

FieldTypeRequiredDescription
GroupIdStringYesGroup ID from Create Asset Group
URLStringYesPublic URL of the file to upload
AssetTypeStringYesImage / Video / Audio
FileNameStringOptionalCustom file name

Response

{
  "ResponseMetadata": { ... },
  "Result": {
    "Id": "asset-20260601-xxxxx",
    "Status": "Processing"
  }
}

Get Asset

Query asset status and details. Poll until status is Active before using in video generation.

POST /relay/v3/assets/{asset_id}

Response (Active)

{
  "ResponseMetadata": { ... },
  "Result": {
    "Id": "asset-20260601-xxxxx",
    "Status": "Active",
    "AssetType": "Image",
    "PreviewUrl": "https://..."
  }
}

Asset status values: ProcessingActive (ready to use) or Failed.

Example: Text to Video

// POST /relay/v3/contents/generations/tasks
{
  "model": "doubao-seedance-2-0-260128",
  "content": [
    {
      "type": "text",
      "text": "A golden retriever running on a beach at sunset, cinematic, slow motion, 4K quality"
    }
  ],
  "duration": 5,
  "resolution": "720p",
  "ratio": "16:9",
  "generate_audio": true
}

Example: Image to Video (First Frame)

// POST /relay/v3/contents/generations/tasks
{
  "model": "doubao-seedance-2-0-260128",
  "content": [
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/first-frame.jpg" }
    },
    {
      "type": "text",
      "text": "The camera slowly zooms in, the person smiles and waves"
    }
  ],
  "duration": 5,
  "resolution": "720p",
  "ratio": "16:9"
}

Example: Asset-Based Video Generation

Use an uploaded virtual avatar asset as reference:

// Step 1: Upload asset (after creating group)
// POST /relay/v3/assets
{
  "GroupId": "group-20260601-xxxxx",
  "URL": "https://example.com/portrait.jpg",
  "AssetType": "Image"
}
// Response: { "Result": { "Id": "asset-20260601-xxxxx" } }

// Step 2: Wait for asset to be Active (poll GET /relay/v3/assets/asset-xxx)

// Step 3: Generate video using asset
// POST /relay/v3/contents/generations/tasks
{
  "model": "doubao-seedance-2-0-260128",
  "content": [
    {
      "type": "image_url",
      "image_url": { "url": "asset://asset-20260601-xxxxx" },
      "role": "reference_image"
    },
    {
      "type": "text",
      "text": "The person in image 1 is giving a keynote speech on stage"
    }
  ],
  "duration": 8,
  "resolution": "720p",
  "ratio": "16:9"
}

cURL Examples

Create Task

curl -X POST https://your-host/relay/v3/contents/generations/tasks \
  -H "Authorization: Bearer rk-your-relay-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [{"type": "text", "text": "A futuristic city at night with flying cars"}],
    "duration": 5,
    "resolution": "720p",
    "ratio": "16:9"
  }'

Query Task

curl https://your-host/relay/v3/contents/generations/tasks/cgt-xxxxx \
  -H "Authorization: Bearer rk-your-relay-key"

List Models

curl https://your-host/relay/v3/models \
  -H "Authorization: Bearer rk-your-relay-key"

List Asset Groups

curl -X POST https://your-host/relay/v3/assets/groups/list \
  -H "Authorization: Bearer rk-your-relay-key" \
  -H "Content-Type: application/json" \
  -d '{"Filter": {"GroupType": "AIGC"}, "PageNumber": 1, "PageSize": 10}'

Create Asset Group

curl -X POST https://your-host/relay/v3/assets/groups \
  -H "Authorization: Bearer rk-your-relay-key" \
  -H "Content-Type: application/json" \
  -d '{"Name": "My Character", "GroupType": "AIGC"}'

Upload Asset

curl -X POST https://your-host/relay/v3/assets \
  -H "Authorization: Bearer rk-your-relay-key" \
  -H "Content-Type: application/json" \
  -d '{
    "GroupId": "group-xxxxx",
    "URL": "https://example.com/portrait.jpg",
    "AssetType": "Image"
  }'