豆包视频生成
curl --request POST \
--url https://octopusx.ai/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"seconds": 123
}
'import requests
url = "https://octopusx.ai/v1/videos"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"seconds": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>', size: '<string>', seconds: 123})
};
fetch('https://octopusx.ai/v1/videos', 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://octopusx.ai/v1/videos",
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>',
'size' => '<string>',
'seconds' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://octopusx.ai/v1/videos"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://octopusx.ai/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octopusx.ai/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "video_bbfbc1d2-ab22-44ca-b9dd-bc16983acac2",
"object": "video",
"model": "doubao-seedance-1-5-pro_720p",
"status": "queued",
"progress": 0,
"created_at": 1761635478,
"size": "720x720"
}
OpenAI 格式
豆包视频生成
使用 POST /v1/videos 调用豆包模型提交异步视频任务。
POST
https://octopusx.ai
/
v1
/
videos
豆包视频生成
curl --request POST \
--url https://octopusx.ai/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"seconds": 123
}
'import requests
url = "https://octopusx.ai/v1/videos"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"seconds": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>', size: '<string>', seconds: 123})
};
fetch('https://octopusx.ai/v1/videos', 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://octopusx.ai/v1/videos",
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>',
'size' => '<string>',
'seconds' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://octopusx.ai/v1/videos"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://octopusx.ai/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octopusx.ai/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "video_bbfbc1d2-ab22-44ca-b9dd-bc16983acac2",
"object": "video",
"model": "doubao-seedance-1-5-pro_720p",
"status": "queued",
"progress": 0,
"created_at": 1761635478,
"size": "720x720"
}
豆包视频生成
豆包渠道使用POST /v1/videos 提交任务,以 multipart/form-data 提交。
- 路由入口是
POST /v1/videos。 - 当前使用
multipart/form-data提交。 - 支持文生视频、首帧生视频、首尾帧生视频。
- 首帧图片通过
first_frame_image字段上传,尾帧图片通过last_frame_image字段上传。 - 提交成功后返回任务
id与status,后续用 任务状态查询 轮询结果。
支持模型
doubao-seedance-1-0-pro_480pdoubao-seedance-1-0-pro_720pdoubao-seedance-1-0-pro_1080pdoubao-seedance-1-5-pro_480pdoubao-seedance-1-5-pro_720pdoubao-seedance-1-5-pro_1080p
方法与路径
POST /v1/videos
请求示例
curl -X POST https://octopusx.ai/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=doubao-seedance-1-5-pro_720p" \
-F "prompt=猫咪听歌摇头晃脑,下大雨" \
-F "size=4:3" \
-F "seconds=4"
import requests
resp = requests.post(
"https://octopusx.ai/v1/videos",
headers={"Authorization": "Bearer YOUR_API_KEY"},
data={
"model": "doubao-seedance-1-5-pro_720p",
"prompt": "猫咪听歌摇头晃脑,下大雨",
"size": "4:3",
"seconds": 4,
},
timeout=60,
)
print(resp.json())
首帧生视频示例
# 带首帧图片的请求示例
curl -X POST https://octopusx.ai/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=doubao-seedance-1-5-pro_720p" \
-F "prompt=让人物向前走并微笑" \
-F "size=16:9" \
-F "seconds=5" \
-F "first_frame_image=@/path/to/first-frame.png"
# 带首帧图片的请求示例
import requests
with open("first-frame.png", "rb") as f:
resp = requests.post(
"https://octopusx.ai/v1/videos",
headers={"Authorization": "Bearer YOUR_API_KEY"},
data={
"model": "doubao-seedance-1-5-pro_720p",
"prompt": "让人物向前走并微笑",
"size": "16:9",
"seconds": 5,
},
files={"first_frame_image": f},
timeout=60,
)
print(resp.json())
首尾帧生视频示例
# 带首尾帧图片的请求示例
curl -X POST https://octopusx.ai/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=doubao-seedance-1-5-pro_720p" \
-F "prompt=平滑过渡" \
-F "size=9:16" \
-F "seconds=5" \
-F "first_frame_image=@/path/to/first-frame.png" \
-F "last_frame_image=@/path/to/last-frame.png"
# 带首尾帧图片的请求示例
import requests
with open("first-frame.png", "rb") as f1, open("last-frame.png", "rb") as f2:
resp = requests.post(
"https://octopusx.ai/v1/videos",
headers={"Authorization": "Bearer YOUR_API_KEY"},
data={
"model": "doubao-seedance-1-5-pro_720p",
"prompt": "平滑过渡",
"size": "9:16",
"seconds": 5,
},
files={
"first_frame_image": f1,
"last_frame_image": f2,
},
timeout=60,
)
print(resp.json())
响应示例
{
"id": "video_bbfbc1d2-ab22-44ca-b9dd-bc16983acac2",
"object": "video",
"model": "doubao-seedance-1-5-pro_720p",
"status": "queued",
"progress": 0,
"created_at": 1761635478,
"size": "720x720"
}
认证
Authorization: Bearer YOUR_API_KEY
Body
模型名称。支持
doubao-seedance-1-0-pro_480p、doubao-seedance-1-0-pro_720p、doubao-seedance-1-0-pro_1080p、doubao-seedance-1-5-pro_480p、doubao-seedance-1-5-pro_720p、doubao-seedance-1-5-pro_1080p。提示词。生成视频的文本描述,支持中文和英文。
首帧图片。上传单个图片文件,用于首帧生视频场景。支持图片格式包括 png、jpeg、jpg、webp。
尾帧图片。上传单个图片文件,用于首尾帧生视频场景。支持图片格式包括 png、jpeg、jpg、webp。
视频宽高比。可选值包括
16:9、4:3、1:1、3:4、9:16、21:9、keep_ratio(与上传图片的宽高比保持一致)、adaptive(根据上传图片的比例自动选择最合适的宽高比)。视频时长(秒)。取值范围
>= 4 且 < 12。Response
任务 ID。
固定为
video。模型名称。
任务状态。可选值包括
queued(排队中)、processing(处理中)、completed(已完成)、failed(失败)、cancelled(已取消)。进度百分比(0-100)。
创建时间(Unix 时间戳)。
视频尺寸,例如
720x720。相关接口
⌘I