创建视频任务
curl --request POST \
--url https://xuwuai.com/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "veo-3.1-fast-generate-preview",
"prompt": "A cinematic lion at sunset",
"seconds": 6,
"size": "1280x720",
"input_reference": [
"https://example.com/image.jpg"
]
}
'import requests
url = "https://xuwuai.com/v1/videos"
payload = {
"model": "veo-3.1-fast-generate-preview",
"prompt": "A cinematic lion at sunset",
"seconds": 6,
"size": "1280x720",
"input_reference": ["https://example.com/image.jpg"]
}
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: 'veo-3.1-fast-generate-preview',
prompt: 'A cinematic lion at sunset',
seconds: 6,
size: '1280x720',
input_reference: ['https://example.com/image.jpg']
})
};
fetch('https://xuwuai.com/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://xuwuai.com/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' => 'veo-3.1-fast-generate-preview',
'prompt' => 'A cinematic lion at sunset',
'seconds' => 6,
'size' => '1280x720',
'input_reference' => [
'https://example.com/image.jpg'
]
]),
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://xuwuai.com/v1/videos"
payload := strings.NewReader("{\n \"model\": \"veo-3.1-fast-generate-preview\",\n \"prompt\": \"A cinematic lion at sunset\",\n \"seconds\": 6,\n \"size\": \"1280x720\",\n \"input_reference\": [\n \"https://example.com/image.jpg\"\n ]\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://xuwuai.com/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"veo-3.1-fast-generate-preview\",\n \"prompt\": \"A cinematic lion at sunset\",\n \"seconds\": 6,\n \"size\": \"1280x720\",\n \"input_reference\": [\n \"https://example.com/image.jpg\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://xuwuai.com/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\": \"veo-3.1-fast-generate-preview\",\n \"prompt\": \"A cinematic lion at sunset\",\n \"seconds\": 6,\n \"size\": \"1280x720\",\n \"input_reference\": [\n \"https://example.com/image.jpg\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "video_abc123",
"object": "video",
"created_at": 1761234567,
"status": "queued",
"model": "veo-3.1-fast-generate-preview",
"prompt": "A cinematic lion at sunset",
"progress": 0,
"seconds": 6,
"size": "1280x720"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}视频
视频生成
通过 OpenAI 兼容 /v1/videos 创建和管理 Sora 视频任务
POST
/
v1
/
videos
创建视频任务
curl --request POST \
--url https://xuwuai.com/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "veo-3.1-fast-generate-preview",
"prompt": "A cinematic lion at sunset",
"seconds": 6,
"size": "1280x720",
"input_reference": [
"https://example.com/image.jpg"
]
}
'import requests
url = "https://xuwuai.com/v1/videos"
payload = {
"model": "veo-3.1-fast-generate-preview",
"prompt": "A cinematic lion at sunset",
"seconds": 6,
"size": "1280x720",
"input_reference": ["https://example.com/image.jpg"]
}
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: 'veo-3.1-fast-generate-preview',
prompt: 'A cinematic lion at sunset',
seconds: 6,
size: '1280x720',
input_reference: ['https://example.com/image.jpg']
})
};
fetch('https://xuwuai.com/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://xuwuai.com/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' => 'veo-3.1-fast-generate-preview',
'prompt' => 'A cinematic lion at sunset',
'seconds' => 6,
'size' => '1280x720',
'input_reference' => [
'https://example.com/image.jpg'
]
]),
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://xuwuai.com/v1/videos"
payload := strings.NewReader("{\n \"model\": \"veo-3.1-fast-generate-preview\",\n \"prompt\": \"A cinematic lion at sunset\",\n \"seconds\": 6,\n \"size\": \"1280x720\",\n \"input_reference\": [\n \"https://example.com/image.jpg\"\n ]\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://xuwuai.com/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"veo-3.1-fast-generate-preview\",\n \"prompt\": \"A cinematic lion at sunset\",\n \"seconds\": 6,\n \"size\": \"1280x720\",\n \"input_reference\": [\n \"https://example.com/image.jpg\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://xuwuai.com/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\": \"veo-3.1-fast-generate-preview\",\n \"prompt\": \"A cinematic lion at sunset\",\n \"seconds\": 6,\n \"size\": \"1280x720\",\n \"input_reference\": [\n \"https://example.com/image.jpg\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "video_abc123",
"object": "video",
"created_at": 1761234567,
"status": "queued",
"model": "veo-3.1-fast-generate-preview",
"prompt": "A cinematic lion at sunset",
"progress": 0,
"seconds": 6,
"size": "1280x720"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}通过
当你需要直接上传参考图文件时,使用 multipart 表单:
当你使用 JSON 请求体时,
/v1/videos 创建 OpenAI 兼容的 Sora 视频任务。本文只描述 OpenAI 官方契约;关于 Xuwu 的模型分组路由、经济型分组与平台扩展字段,请参考 Sora 视频路由与分组。
官方参考
创建视频任务
multipart/form-data
当你需要直接上传参考图文件时,使用 multipart 表单:
curl -X POST "https://xuwuai.com/v1/videos" \
-H "Authorization: Bearer $TOKEN" \
-F "model=sora-2" \
-F "prompt=百事可乐宣传片,都市街拍风,年轻活力,镜头运动丰富" \
-F "seconds=8" \
-F "size=720x1280" \
-F "input_reference=@/absolute/path/to/ref.jpg"
application/json
当你使用 JSON 请求体时,input_reference 应为单个对象,而不是数组:
curl -X POST "https://xuwuai.com/v1/videos" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "百事可乐宣传片,都市街拍风,年轻活力,镜头运动丰富",
"seconds": 8,
"size": "720x1280",
"input_reference": {
"image_url": "https://example.com/ref.jpg"
}
}'
input_reference 的官方 JSON 结构是单个对象,例如 { "image_url": "..." } 或 { "file_id": "..." };不要传 ["https://..."] 这样的数组。请求字段
model:模型名称,例如sora-2、sora-2-proprompt:视频生成提示词seconds:使用当前 OpenAI 官方文档允许的时长值。当前 API Reference 公开了4、8、12;Video Generation Guide 还描述了部分官方 Sora 2 / Sora 2 Pro 工作流中的更长时长。请以你配置的官方渠道实际支持能力为准。size:使用当前 OpenAI 官方文档允许的分辨率值。当前 API Reference 列出720x1280、1280x720、1024x1792、1792x1024;Video Generation Guide 还描述了部分官方sora-2-pro工作流中的1920x1080、1080x1920。input_reference:multipart/form-data下:单个文件字段application/json下:单个对象,例如{"image_url":"..."}或{"file_id":"file_..."}
响应示例
{
"id": "video_691209aab0a08198a4e78870277f7e3d0215e09cec47a737",
"object": "video",
"created_at": 1762789802,
"status": "queued",
"model": "sora-2",
"prompt": "百事可乐宣传片",
"progress": 0,
"seconds": "8",
"size": "720x1280"
}
官方工作流
- 创建任务:
POST /v1/videos - 查询状态:
GET /v1/videos/{video_id},见 视频查询 - 下载结果:
GET /v1/videos/{video_id}/content,见 视频下载
如果你对外承诺“OpenAI 官方兼容”,请把这份页面视为公开契约边界;经济型分组的时长槽位、宽高比别名和角色扩展字段不应继续写入 OpenAI 主文档。
Authorizations
API Key
Body
application/jsonmultipart/form-data
模型名称
Available options:
veo-3.1-generate-preview, veo-3.1-fast-generate-preview Example:
"veo-3.1-fast-generate-preview"
文本提示词
Example:
"A cinematic lion at sunset"
视频时长(秒):4、6、8
Example:
6
分辨率
Available options:
1280x720, 720x1280, 1920x1080, 1080x1920 Example:
"1280x720"
参考图 URL 数组(1-3 张)
Example:
["https://example.com/image.jpg"]
Response
任务创建成功
任务 ID
Example:
"video_abc123"
Available options:
video Example:
"video"
创建时间戳
Example:
1761234567
完成时间戳
任务状态
Available options:
queued, in_progress, completed, failed Example:
"queued"
模型名称
Example:
"veo-3.1-fast-generate-preview"
提示词
进度(0-100)
Example:
0
视频时长
Example:
6
分辨率
Example:
"1280x720"
视频直链(完成后返回)
Show child attributes
Show child attributes