seedance-2-ext 視頻生成
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"seconds": 123,
"size": "<string>",
"resolution": "<string>",
"reference_image": "<string>",
"reference_images": [
"<string>"
],
"callback_url": "<string>",
"client_business_id": "<string>",
"trace_id": "<string>"
}
'import requests
url = "https://toapis.com/v1/videos/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"seconds": 123,
"size": "<string>",
"resolution": "<string>",
"reference_image": "<string>",
"reference_images": ["<string>"],
"callback_url": "<string>",
"client_business_id": "<string>",
"trace_id": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
seconds: 123,
size: '<string>',
resolution: '<string>',
reference_image: '<string>',
reference_images: ['<string>'],
callback_url: '<string>',
client_business_id: '<string>',
trace_id: '<string>'
})
};
fetch('https://toapis.com/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://toapis.com/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'seconds' => 123,
'size' => '<string>',
'resolution' => '<string>',
'reference_image' => '<string>',
'reference_images' => [
'<string>'
],
'callback_url' => '<string>',
'client_business_id' => '<string>',
'trace_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://toapis.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"seconds\": 123,\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"reference_image\": \"<string>\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"callback_url\": \"<string>\",\n \"client_business_id\": \"<string>\",\n \"trace_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://toapis.com/v1/videos/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"seconds\": 123,\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"reference_image\": \"<string>\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"callback_url\": \"<string>\",\n \"client_business_id\": \"<string>\",\n \"trace_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"seconds\": 123,\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"reference_image\": \"<string>\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"callback_url\": \"<string>\",\n \"client_business_id\": \"<string>\",\n \"trace_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "tsk_vid_xxx",
"object": "generation.task",
"model": "seedance-2-ext",
"status": "in_progress",
"progress": 10,
"created_at": 1781577600
}
seedance-ext
seedance-2-ext 視頻生成
使用 seedance-2-ext 模型生成視頻,支持文生視頻和參考圖片生成
POST
/
v1
/
videos
/
generations
seedance-2-ext 視頻生成
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"seconds": 123,
"size": "<string>",
"resolution": "<string>",
"reference_image": "<string>",
"reference_images": [
"<string>"
],
"callback_url": "<string>",
"client_business_id": "<string>",
"trace_id": "<string>"
}
'import requests
url = "https://toapis.com/v1/videos/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"seconds": 123,
"size": "<string>",
"resolution": "<string>",
"reference_image": "<string>",
"reference_images": ["<string>"],
"callback_url": "<string>",
"client_business_id": "<string>",
"trace_id": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
seconds: 123,
size: '<string>',
resolution: '<string>',
reference_image: '<string>',
reference_images: ['<string>'],
callback_url: '<string>',
client_business_id: '<string>',
trace_id: '<string>'
})
};
fetch('https://toapis.com/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://toapis.com/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'seconds' => 123,
'size' => '<string>',
'resolution' => '<string>',
'reference_image' => '<string>',
'reference_images' => [
'<string>'
],
'callback_url' => '<string>',
'client_business_id' => '<string>',
'trace_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://toapis.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"seconds\": 123,\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"reference_image\": \"<string>\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"callback_url\": \"<string>\",\n \"client_business_id\": \"<string>\",\n \"trace_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://toapis.com/v1/videos/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"seconds\": 123,\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"reference_image\": \"<string>\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"callback_url\": \"<string>\",\n \"client_business_id\": \"<string>\",\n \"trace_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"seconds\": 123,\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"reference_image\": \"<string>\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"callback_url\": \"<string>\",\n \"client_business_id\": \"<string>\",\n \"trace_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "tsk_vid_xxx",
"object": "generation.task",
"model": "seedance-2-ext",
"status": "in_progress",
"progress": 10,
"created_at": 1781577600
}
中國大陸用戶請注意: 中國大陸用戶請使用
https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。seedance-2-ext 是 Seedance 2.0 系列的促銷渠道模型,提供標準優惠版能力:
- 文生視頻、參考圖片生成
- 不支持參考視頻、參考音頻、首尾幀控制和視頻編輯
- 接口為異步任務:提交後返回
generation.task,完成後通過視頻任務狀態接口獲取結果。
認證
string
必填
使用 Bearer Token 認證:
Authorization: Bearer YOUR_API_KEY
請求參數
string
預設值:"seedance-2-ext"
必填
ToAPIs 公共模型名,固定使用
seedance-2-ext。string
描述場景、鏡頭運動、主體動作、風格和聲音氛圍。
integer
輸出視頻時長(秒),範圍
4–15。兼容字段 duration 也可以使用,無需同時傳入。string
輸出寬高比,支持
16:9、9:16、4:3、3:4、1:1、21:9。兼容字段 aspect_ratio 也可以使用。string
預設值:"720p"
輸出分辨率,固定為
720p。string
單張參考圖片的公開 URL。多張時請改用
reference_images。string[]
參考圖片 URL 數組,最多
9 張。也可以使用 image_with_roles(role 為 reference_image)顯式傳入。string
ToAPIs 任務完成回調地址,詳見任務 Webhook。
string
客戶側訂單號或業務任務 ID。提交後會隨任務保存,也可用
GET /v1/videos/generations/{client_business_id} 查詢。string
調用方自定義的鏈路追蹤 ID。
素材組合規則
| 請求內容 | 是否支持 | 說明 |
|---|---|---|
| 僅提示詞 | 是 | 文生視頻 |
| 參考圖片 | 是 | 最多 9 張 |
| 參考視頻 / 參考音頻 | 否 | 請使用 seedance-2.5-ext |
| 首幀 / 尾幀 | 否 | 不支持首尾幀模式 |
請求示例
文生視頻
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "seedance-2-ext",
"prompt": "日落時分的城市天際線,鏡頭緩慢拉遠。",
"seconds": 5,
"size": "16:9",
"resolution": "720p"
}'
參考圖片生成
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "seedance-2-ext",
"prompt": "讓圖片1中的產品緩慢旋轉展示。",
"seconds": 10,
"size": "1:1",
"reference_images": [
"https://example.com/product.png"
]
}'
響應
string
任務 ID,用於查詢狀態。
string
請求傳入該字段時返回。
string
固定為
generation.task。string
本次請求的模型名。
string
queued、in_progress、completed 或 failed。integer
0–100 的任務進度。integer
創建時間戳。
{
"id": "tsk_vid_xxx",
"object": "generation.task",
"model": "seedance-2-ext",
"status": "in_progress",
"progress": 10,
"created_at": 1781577600
}