创建视频
curl --request POST \
--url https://api.aiohub.org/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "doubao-seedance-2-5-260628",
"prompt": "A blue ceramic cup on a wooden table in daylight.",
"seconds": "4",
"size": "1280x720"
}
'import requests
url = "https://api.aiohub.org/v1/videos"
payload = {
"model": "doubao-seedance-2-5-260628",
"prompt": "A blue ceramic cup on a wooden table in daylight.",
"seconds": "4",
"size": "1280x720"
}
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: 'doubao-seedance-2-5-260628',
prompt: 'A blue ceramic cup on a wooden table in daylight.',
seconds: '4',
size: '1280x720'
})
};
fetch('https://api.aiohub.org/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://api.aiohub.org/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' => 'doubao-seedance-2-5-260628',
'prompt' => 'A blue ceramic cup on a wooden table in daylight.',
'seconds' => '4',
'size' => '1280x720'
]),
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://api.aiohub.org/v1/videos"
payload := strings.NewReader("{\n \"model\": \"doubao-seedance-2-5-260628\",\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\",\n \"seconds\": \"4\",\n \"size\": \"1280x720\"\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://api.aiohub.org/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-seedance-2-5-260628\",\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\",\n \"seconds\": \"4\",\n \"size\": \"1280x720\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/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\": \"doubao-seedance-2-5-260628\",\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\",\n \"seconds\": \"4\",\n \"size\": \"1280x720\"\n}"
response = http.request(request)
puts response.read_body{
"id": "task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ",
"object": "video",
"model": "doubao-seedance-2-5-260628",
"status": "queued",
"progress": 0,
"created_at": 1791275108,
"seconds": "4",
"size": "1280x720"
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}创建视频 · OpenAI 视频
使用 OpenAI 视频 格式提交 Seedance 视频任务,查看示例、输入限制和完整参数。
POST
/
v1
/
videos
创建视频
curl --request POST \
--url https://api.aiohub.org/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "doubao-seedance-2-5-260628",
"prompt": "A blue ceramic cup on a wooden table in daylight.",
"seconds": "4",
"size": "1280x720"
}
'import requests
url = "https://api.aiohub.org/v1/videos"
payload = {
"model": "doubao-seedance-2-5-260628",
"prompt": "A blue ceramic cup on a wooden table in daylight.",
"seconds": "4",
"size": "1280x720"
}
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: 'doubao-seedance-2-5-260628',
prompt: 'A blue ceramic cup on a wooden table in daylight.',
seconds: '4',
size: '1280x720'
})
};
fetch('https://api.aiohub.org/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://api.aiohub.org/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' => 'doubao-seedance-2-5-260628',
'prompt' => 'A blue ceramic cup on a wooden table in daylight.',
'seconds' => '4',
'size' => '1280x720'
]),
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://api.aiohub.org/v1/videos"
payload := strings.NewReader("{\n \"model\": \"doubao-seedance-2-5-260628\",\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\",\n \"seconds\": \"4\",\n \"size\": \"1280x720\"\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://api.aiohub.org/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-seedance-2-5-260628\",\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\",\n \"seconds\": \"4\",\n \"size\": \"1280x720\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/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\": \"doubao-seedance-2-5-260628\",\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\",\n \"seconds\": \"4\",\n \"size\": \"1280x720\"\n}"
response = http.request(request)
puts response.read_body{
"id": "task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ",
"object": "video",
"model": "doubao-seedance-2-5-260628",
"status": "queued",
"progress": 0,
"created_at": 1791275108,
"seconds": "4",
"size": "1280x720"
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}已有 OpenAI SDK
创建响应的关键字段如下。保存
拿到任务标识后,转到 查询任务。
client.videos 集成时使用这个格式。支持文生视频和单张首帧图生视频,输出 720p。参考音频、多张参考图和视频编辑请使用 Ark / Seedance。
接入配置
OpenAI SDK 的 Base URL 填https://api.aiohub.org/v1,API key 填完整的 AIOHub sk- API 令牌。这是视频接口,不使用 Chat Completions 或 Responses。
请求示例
把<AIOHUB_API_KEY> 替换为完整 API 令牌。所选分组需包含示例中的 Seedance 模型。
curl https://api.aiohub.org/v1/videos \
-H "Authorization: Bearer <AIOHUB_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-5-260628",
"prompt": "A blue ceramic cup on a wooden table in daylight.",
"seconds": "4",
"size": "1280x720"
}'
id,不要再次提交创建请求来查询进度。
{"id": "task_example", "object": "video", "status": "queued", "progress": 0}
参数范围
JSON 请求使用application/json;上传图片文件时使用 multipart/form-data,文件字段为 input_reference。尺寸不匹配时先裁剪或缩放图片再提交。
SDK 完整示例
SDK 完整示例
安装
openai SDK,并在运行环境中设置 AIOHUB_API_KEY。示例只在生成成功后下载。import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["AIOHUB_API_KEY"], base_url="https://api.aiohub.org/v1")
video = client.videos.create(
model="doubao-seedance-2-5-260628",
prompt="木桌上的蓝色陶瓷杯,自然光,镜头缓慢推进。",
seconds="4",
size="1280x720",
)
video = client.videos.poll(video.id)
if video.status != "completed":
raise RuntimeError(f"Video generation failed: {video.error}")
with open("video.mp4", "wb") as f:
f.write(client.videos.download_content(video.id).read())
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.AIOHUB_API_KEY, baseURL: "https://api.aiohub.org/v1" });
let video = await client.videos.create({
model: "doubao-seedance-2-5-260628",
prompt: "木桌上的蓝色陶瓷杯,自然光,镜头缓慢推进。",
seconds: "4",
size: "1280x720",
});
while (video.status !== "completed" && video.status !== "failed") {
await new Promise((r) => setTimeout(r, 15000));
video = await client.videos.retrieve(video.id);
}
if (video.status !== "completed") {
throw new Error(JSON.stringify(video.error));
}
const bytes = await (await client.videos.downloadContent(video.id)).arrayBuffer();
授权
API key (sk-xxx)
请求体
application/jsonmultipart/form-data