创建视频生成任务
curl --request POST \
--url https://api.gravitex.ai/api/v3/contents/generations/tasks \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"content": [
{}
],
"prompt": "<string>",
"callback_url": "<string>",
"return_last_frame": true,
"service_tier": "<string>",
"execution_expires_after": 123,
"generate_audio": true,
"safety_identifier": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"seed": 123,
"watermark": true
}
'import requests
url = "https://api.gravitex.ai/api/v3/contents/generations/tasks"
payload = {
"model": "<string>",
"content": [{}],
"prompt": "<string>",
"callback_url": "<string>",
"return_last_frame": True,
"service_tier": "<string>",
"execution_expires_after": 123,
"generate_audio": True,
"safety_identifier": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"seed": 123,
"watermark": True
}
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>',
content: [{}],
prompt: '<string>',
callback_url: '<string>',
return_last_frame: true,
service_tier: '<string>',
execution_expires_after: 123,
generate_audio: true,
safety_identifier: '<string>',
resolution: '<string>',
ratio: '<string>',
duration: 123,
seed: 123,
watermark: true
})
};
fetch('https://api.gravitex.ai/api/v3/contents/generations/tasks', 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://api.gravitex.ai/api/v3/contents/generations/tasks",
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>',
'content' => [
[
]
],
'prompt' => '<string>',
'callback_url' => '<string>',
'return_last_frame' => true,
'service_tier' => '<string>',
'execution_expires_after' => 123,
'generate_audio' => true,
'safety_identifier' => '<string>',
'resolution' => '<string>',
'ratio' => '<string>',
'duration' => 123,
'seed' => 123,
'watermark' => true
]),
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://api.gravitex.ai/api/v3/contents/generations/tasks"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"content\": [\n {}\n ],\n \"prompt\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"seed\": 123,\n \"watermark\": true\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://api.gravitex.ai/api/v3/contents/generations/tasks")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"content\": [\n {}\n ],\n \"prompt\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"seed\": 123,\n \"watermark\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gravitex.ai/api/v3/contents/generations/tasks")
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 \"content\": [\n {}\n ],\n \"prompt\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"seed\": 123,\n \"watermark\": true\n}"
response = http.request(request)
puts response.read_bodySeedance 2.0(/generations/tasks)
创建视频生成任务
Seedance 2.0 New POST /api/v3/contents/generations/tasks
POST
/
api
/
v3
/
contents
/
generations
/
tasks
创建视频生成任务
curl --request POST \
--url https://api.gravitex.ai/api/v3/contents/generations/tasks \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"content": [
{}
],
"prompt": "<string>",
"callback_url": "<string>",
"return_last_frame": true,
"service_tier": "<string>",
"execution_expires_after": 123,
"generate_audio": true,
"safety_identifier": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"seed": 123,
"watermark": true
}
'import requests
url = "https://api.gravitex.ai/api/v3/contents/generations/tasks"
payload = {
"model": "<string>",
"content": [{}],
"prompt": "<string>",
"callback_url": "<string>",
"return_last_frame": True,
"service_tier": "<string>",
"execution_expires_after": 123,
"generate_audio": True,
"safety_identifier": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"seed": 123,
"watermark": True
}
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>',
content: [{}],
prompt: '<string>',
callback_url: '<string>',
return_last_frame: true,
service_tier: '<string>',
execution_expires_after: 123,
generate_audio: true,
safety_identifier: '<string>',
resolution: '<string>',
ratio: '<string>',
duration: 123,
seed: 123,
watermark: true
})
};
fetch('https://api.gravitex.ai/api/v3/contents/generations/tasks', 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://api.gravitex.ai/api/v3/contents/generations/tasks",
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>',
'content' => [
[
]
],
'prompt' => '<string>',
'callback_url' => '<string>',
'return_last_frame' => true,
'service_tier' => '<string>',
'execution_expires_after' => 123,
'generate_audio' => true,
'safety_identifier' => '<string>',
'resolution' => '<string>',
'ratio' => '<string>',
'duration' => 123,
'seed' => 123,
'watermark' => true
]),
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://api.gravitex.ai/api/v3/contents/generations/tasks"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"content\": [\n {}\n ],\n \"prompt\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"seed\": 123,\n \"watermark\": true\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://api.gravitex.ai/api/v3/contents/generations/tasks")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"content\": [\n {}\n ],\n \"prompt\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"seed\": 123,\n \"watermark\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gravitex.ai/api/v3/contents/generations/tasks")
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 \"content\": [\n {}\n ],\n \"prompt\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"return_last_frame\": true,\n \"service_tier\": \"<string>\",\n \"execution_expires_after\": 123,\n \"generate_audio\": true,\n \"safety_identifier\": \"<string>\",\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"seed\": 123,\n \"watermark\": true\n}"
response = http.request(request)
puts response.read_body简介
提交 Seedance 2.0 官方镜像异步视频生成任务,成功返回任务id。content 与 prompt 至少提供一个。
与 BytePlus Ark 官方接口请求体、响应体完全一致。
认证
string
必填
Bearer Token,如
Bearer sk-your_token_keystring
application/json请求参数
string
必填
模型 ID:
seedance-2-0 / seedance-2-0-fast / seedance-2-0-NSFWarray
内容数组:
text / image_url / video_url / audio_url,各元素可带 role(first_frame / last_frame / reference_image / reference_video / reference_audio);与 prompt 至少提供一个string
简化写法,与
content 二选一string
任务状态变化时的回调地址
boolean
默认值:"false"
是否返回最后一帧图片
string
默认值:"default"
default / flexinteger
默认值:"172800"
任务过期时间(秒),范围
[3600, 259200]boolean
默认值:"true"
是否生成音频
string
终端用户唯一标识(建议传用户 ID 的哈希)
string
默认值:"720p"
480p / 720p / 1080p / 4K(seedance-2-0-fast 仅支持 480p/720p)string
默认值:"adaptive"
16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptiveinteger
默认值:"5"
秒数,
[4,15] 或 -1(自动)integer
默认值:"-1"
随机种子
boolean
默认值:"false"
是否加水印
content[].image_url.url / video_url.url / audio_url.url 支持三种值:公网 URL、Base64(data:image/png;base64,...)、asset://<ASSET_ID> 素材库引用。请求示例
curl -X POST https://api.gravitex.ai/api/v3/contents/generations/tasks \
-H "Authorization: Bearer sk-your_token_key" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2-0",
"content": [
{"type": "text", "text": "黄金时刻,无人机航拍连绵山脉"}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": true
}'
响应示例
{
"id": "cgt-20260708094649-mxfjc"
}
⌘I
