> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# 建立任務（火山相容）

> 使用火山風格 REST body 或 Action 請求建立 Seedance 2.0 任務。

## 概覽

這些介面面向已經使用火山風格 Seedance 任務結構的團隊。鑑權使用 TokenLab Bearer API Key。返回的任務 ID 以 `cgt-` 開頭；請輪詢狀態介面，直到 `status` 變為 `succeeded`、`failed`、`cancelled` 或 `expired`。

也可以呼叫 Action 分發入口，支援 `CreateContentsGenerationsTasks`、`GetContentsGenerationsTask`、`ListContentsGenerationsTasks` 和 `DeleteContentsGenerationsTasks`。`Action` 和 `Version` 不區分大小寫。`Version` 可省略；如傳入則必須為 `2024-01-01`。

這一版不接受 `callback_url`。請透過輪詢查詢任務狀態，避免接入方誤以為回調已經生效。

另見 [Seedance 2.0 影片模型](/zh-Hant/guides/seedance-2-video) 和 [影片生成](/zh-Hant/guides/video-generation).

## 內容規則

* `type=text` 用於提示詞文字。
* `type=image_url` 不傳 `role` 時按首幀處理，也可以明確傳 `role=first_frame`。
* `role=last_frame` 必須和首幀一起使用。
* `role=reference_image`、`reference_video`、`reference_audio` 用於參考素材。
* 同一個請求中不要混用首尾幀輸入和參考素材。

## 參數說明

* `ratio` 支援 `16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9` 或 `adaptive`。
* `generate_audio` 預設為 `true`；需要靜音影片時傳 `false`。
* `service_tier=default` 可用。Seedance 2.0 相容任務會拒絕 `service_tier=flex`、`frames` 和 `camera_fixed=true`。
* 當所選模型支援時，`tools` 可以傳入類似 `{ "type": "web_search" }` 的物件。格式錯誤的 tool 項會被拒絕，而不是靜默忽略。

## 範例

```bash theme={null}
curl https://api.tokenlab.sh/api/v3/contents/generations/tasks \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "A cinematic forest at sunset"},
      {"type": "image_url", "role": "reference_image", "image_url": {"url": "https://example.com/ref.png"}}
    ],
    "ratio": "16:9",
    "duration": 5,
    "resolution": "720p",
    "generate_audio": true
  }'
```
