影片
選擇模型,查看建立任務、查詢狀態及下載影片的呼叫範例。
影片模型
其他影片 API
可靈 4.0 Omni
Use a Token168 API key with access to kling-4.0. The path selects the model. Replace example media URLs with reachable HTTPS URLs or authorized asset:// references.
請求參數 ↓POST /omni-video/kling-4.0curl -X POST https://www.token168.cc/omni-video/kling-4.0 \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"type": "prompt",
"text": "A white ceramic cup on a plain wooden table. Static camera, soft daylight."
}
],
"settings": {
"resolution": "720p",
"duration": 3,
"aspect_ratio": "16:9"
}
}'請求參數
| 欄位 | 支援值與行為 |
|---|---|
| contents[].type / text | Include one prompt item with text. Use @id to reference media or a voice by its unique ID. |
| contents[].type / url / id | Use first_frame, middle_frame, last_frame, refer_image, feature_video or base_video. Use a reachable URL and a unique id when referencing the item from the prompt. |
| contents[].voice_id | Use a supported preset voice_id and assign it a unique id. The subject library and element_id are unsupported. |
| settings.resolution | 720p or 1080p. Defaults to 1080p. 4k is not supported. |
| settings.dynamic_range | sdr. hdr is not supported. |
| settings.audio | native generates audio and is the default. original, which preserves input audio, is not supported. |
| settings.aspect_ratio | 21:9, 16:9, 9:16, 1:1 or adaptive. With a feature video and no edit video or keyframe, use a fixed ratio. 4:3 and 3:4 are not supported. |
| settings.duration | 選填整數,3 至 30 秒。省略時依提示詞或待編輯影片決定,備用值為 10 秒。 |
| options.watermark_info.enabled | Optional boolean. With true, check outputs[].watermark_url for an available watermarked copy. |
| options.callback_url / external_task_id | Not supported. Poll by the task ID returned after creation. |
| GET /tasks / POST /tasks | GET accepts task_ids with up to 20 IDs. external_task_ids and cursor listing via POST are not supported. |
| HTTP 400 / 501 | Unsupported create parameters or task query parameters return HTTP 400 with a message. Cursor-based listing returns HTTP 501. |
| Pricing | Prices depend on resolution and whether there is video input. Without video input, billable seconds equal output seconds. With video input, billable seconds equal max(total input seconds, output seconds) plus output seconds. See Pricing for rates. |
Set TASK_ID to data.id from the create response. Poll while status is submitted or processing. On succeeded, set VIDEO_URL to outputs[0].url and download it promptly. On failed, inspect the task message.
GET /tasks?task_ids=…curl --get "https://www.token168.cc/tasks" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
--data-urlencode "task_ids=$TASK_ID"VIDEO_URL = outputs[0].url
outputs[0].urlcurl --fail "$VIDEO_URL" --output video.mp4下載浮水印版
WATERMARK_URL = outputs[0].watermark_url
outputs[0].watermark_urlcurl --fail "$WATERMARK_URL" --output video-watermark.mp4Wan 3.0
標準版與 Prime 的文生影片呼叫範例。
此範例會生成 5 秒、480P、16:9 的無聲影片,請儲存回傳的 id。
POST /v1/videoscurl -X POST https://www.token168.cc/v1/videos \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan3.0-video",
"prompt": "A red toy boat floats gently on a calm blue pond, soft daylight, steady camera, no text, no people.",
"duration": 5,
"size": "480P",
"metadata": {
"input": {
"prompt": "A red toy boat floats gently on a calm blue pond, soft daylight, steady camera, no text, no people.",
"media": []
},
"parameters": {
"ratio": "16:9",
"audio": false
}
}
}'請求參數
| 欄位 | 支援值與行為 |
|---|---|
| model | wan3.0-video / wan3.0-video-prime |
| prompt / metadata.input.prompt | 提示词或素材至少传一项。两处提示词同时填写时,以 metadata.input.prompt 为准。模型按字符计数,超过 20000 字符会截断。 |
| metadata.input.media[] | 每项填 type 和 url。文生视频可省略。first_frame、last_frame 各最多一张,last_frame 需要 first_frame。reference_image、reference_video、reference_audio 上限依次为 10、5、5。file 和 link 各最多一项且互斥。首尾帧不可与参考素材混用。 |
| metadata.input.media[].url | 使用可访问的 URL 或支持的 data URI。参考视频、参考音频每个都须为 1~15 秒,各类型合计最多 15 秒。参考视频至少 16 fps。 |
| size / metadata.parameters.resolution | 可选 480P、720P、1080P,默认 1080P。示例用顶层 size 指定分辨率。两处同时填写时,以 metadata.parameters.resolution 为准。 |
| duration / metadata.parameters.duration | 整数 2~30 秒,-1 为智能时长,默认 5 秒。使用输入视频时,输入视频总时长加输出时长不可超过 30 秒。两处同时填写时,以嵌套字段为准。 |
| metadata.parameters.ratio | adaptive(默认)、16:9、9:16、1:1、4:3 或 3:4。请在 Token168 使用这些值,当前兼容入口不支持 21:9。 |
| metadata.parameters.audio | 布尔值,默认 true。填 false 生成无声视频。 |
| metadata.parameters.seed | 整数 −1~2147483647。相同种子仍可能生成不同结果。 |
| metadata.parameters.prompt_extend | 布尔值,默认 true。使用 file 或 link 时必须为 true。 |
| metadata.parameters.watermark | 布尔值,默认 false。设为 true 时 Wan 输出带水印。 |
將 video_task_123 換成建立回傳的 id。queued 或 in_progress 時繼續查詢,completed 後下載。unknown 時先查原任務再決定是否重送。
GET /v1/videos/{task_id}curl https://www.token168.cc/v1/videos/video_task_123 \
-H "Authorization: Bearer $TOKEN168_API_KEY"任務完成後,把 video_task_123 換成同一任務的 id,即可下載 MP4。
GET /v1/videos/{task_id}/contentcurl https://www.token168.cc/v1/videos/video_task_123/content \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
--output video.mp4其他影片 API
Seedance 文字生成影片
文字生成影片僅在 content 中保留 text 項;生成參數仍放在頂層,不加入圖片別名或 metadata 包裝。
curl https://www.token168.cc/api/v3/contents/generations/tasks \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0-260128",
"content": [
{"type": "text", "text": "A futuristic tech city, but with a strange, surreal quality. People are more open and free, focused on developing themselves. The city blends pristine natural ecosystems with modern technology. Residential areas are highly ecological, green development is advanced, all power comes from green electricity, and controlled nuclear fusion, space elevators, and extremely deep underground spaces have already been achieved."}
],
"duration": 4,
"resolution": "480p",
"ratio": "16:9",
"generate_audio": false,
"watermark": false
}'
MediaKit 口型對齊
video_url 和 audio_url 可使用 HTTPS 網址或 asset:// 素材 ID,無需傳入 model;入口內部使用 byteplus-lip-sync 能力,執行 Key 權限、選擇通道與按秒計費。enable_video_loop 預設為 false,明確指定的 false 也會保留。
輸入網址須在整個排隊與處理期間內可存取,已知過期或即將過期的簽章網址會在提交前遭拒。每份輸入最多 64 MiB、1800 秒;影片要求單人、非 HDR 的 H.264 MP4,音訊支援 MP3、AAC、WAV、M4A、FLAC。媒體串流驗證不等同於人臉數量或口型品質檢測。
平台先偵測輸入時長再預扣額度;loop=false 依較短輸入估算,loop=true 依音訊估算。成功後以 result.duration 與建立時的價格快照結算一次,確定失敗則退回預扣。提交結果為 unknown 時請查詢原任務,勿重複提交。
使用建立時傳回的 Token168 task_id 查詢,狀態為 running、completed、failed 或 unknown。completed 後 result.video_url 為平台短期授權下載連結,請勿公開分享;直接呼叫不含授權參數的產物網址仍須 API Key 驗證。供應商輸出連結僅有效 24 小時,請及時下載;目前入口不承諾永久保存成片,也不會自動更新任意外部來源網址的簽章。
curl -X POST https://www.token168.cc/api/v1/tools/lip-sync \
-H 'Authorization: Bearer <TOKEN168_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{"video_url":"asset://<VIDEO_ID>","audio_url":"asset://<AUDIO_ID>","enable_video_loop":false}'
curl https://www.token168.cc/api/v1/tasks/<TASK_ID> \
-H 'Authorization: Bearer <TOKEN168_API_KEY>'
curl https://www.token168.cc/v1/tasks/<TASK_ID>/artifacts/video/content \
-H 'Authorization: Bearer <TOKEN168_API_KEY>' -o lip-sync.mp4
舊版相容路徑
既有整合可繼續使用已設定的相容路由,但請求內容須遵循對應模型協定,並非 Seedance 原生格式。新接入 Seedance 請使用上方原生範例;這些路由不表示所有模型皆支援相同的圖片別名。
| 路徑 | 狀態 | 說明 |
|---|---|---|
| /v1/videos | 可用 | 相容建立入口;請求內容遵循所選模型協定。 |
| /v1/videos/{task_id} | 可用 | 相容狀態查詢入口。 |
| /v1/videos/{task_id}/content | 可用 | 內容代理路徑。 |
| /v1/video/generations | 可用 | 舊版建立路徑。 |
| /v1/video/generations/{task_id} | 可用 | 舊版狀態路徑。 |