cURL
curl --request POST \
--url https://api.ttapi.io/sora/generations \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"model": "sora-2",
"prompt": "<string>",
"referImages": "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg",
"duration": 123,
"size": "small",
"character_url": "<string>",
"character_timestamps": "1,3",
"private": "true",
"hookUrl": "<string>"
}
'import requests
url = "https://api.ttapi.io/sora/generations"
payload = {
"model": "sora-2",
"prompt": "<string>",
"referImages": "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg",
"duration": 123,
"size": "small",
"character_url": "<string>",
"character_timestamps": "1,3",
"private": "true",
"hookUrl": "<string>"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'sora-2',
prompt: '<string>',
referImages: 'https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg',
duration: 123,
size: 'small',
character_url: '<string>',
character_timestamps: '1,3',
private: 'true',
hookUrl: '<string>'
})
};
fetch('https://api.ttapi.io/sora/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://api.ttapi.io/sora/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' => 'sora-2',
'prompt' => '<string>',
'referImages' => 'https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg',
'duration' => 123,
'size' => 'small',
'character_url' => '<string>',
'character_timestamps' => '1,3',
'private' => 'true',
'hookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/sora/generations"
payload := strings.NewReader("{\n \"model\": \"sora-2\",\n \"prompt\": \"<string>\",\n \"referImages\": \"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg\",\n \"duration\": 123,\n \"size\": \"small\",\n \"character_url\": \"<string>\",\n \"character_timestamps\": \"1,3\",\n \"private\": \"true\",\n \"hookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/sora/generations")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"sora-2\",\n \"prompt\": \"<string>\",\n \"referImages\": \"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg\",\n \"duration\": 123,\n \"size\": \"small\",\n \"character_url\": \"<string>\",\n \"character_timestamps\": \"1,3\",\n \"private\": \"true\",\n \"hookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/sora/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"sora-2\",\n \"prompt\": \"<string>\",\n \"referImages\": \"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg\",\n \"duration\": 123,\n \"size\": \"small\",\n \"character_url\": \"<string>\",\n \"character_timestamps\": \"1,3\",\n \"private\": \"true\",\n \"hookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "jobId"
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Sora 2 创建视频 [非官转] API
deprecated
通过文字&图片生成视频
POST
/
sora
/
generations
cURL
curl --request POST \
--url https://api.ttapi.io/sora/generations \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"model": "sora-2",
"prompt": "<string>",
"referImages": "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg",
"duration": 123,
"size": "small",
"character_url": "<string>",
"character_timestamps": "1,3",
"private": "true",
"hookUrl": "<string>"
}
'import requests
url = "https://api.ttapi.io/sora/generations"
payload = {
"model": "sora-2",
"prompt": "<string>",
"referImages": "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg",
"duration": 123,
"size": "small",
"character_url": "<string>",
"character_timestamps": "1,3",
"private": "true",
"hookUrl": "<string>"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'sora-2',
prompt: '<string>',
referImages: 'https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg',
duration: 123,
size: 'small',
character_url: '<string>',
character_timestamps: '1,3',
private: 'true',
hookUrl: '<string>'
})
};
fetch('https://api.ttapi.io/sora/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://api.ttapi.io/sora/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' => 'sora-2',
'prompt' => '<string>',
'referImages' => 'https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg',
'duration' => 123,
'size' => 'small',
'character_url' => '<string>',
'character_timestamps' => '1,3',
'private' => 'true',
'hookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/sora/generations"
payload := strings.NewReader("{\n \"model\": \"sora-2\",\n \"prompt\": \"<string>\",\n \"referImages\": \"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg\",\n \"duration\": 123,\n \"size\": \"small\",\n \"character_url\": \"<string>\",\n \"character_timestamps\": \"1,3\",\n \"private\": \"true\",\n \"hookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/sora/generations")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"sora-2\",\n \"prompt\": \"<string>\",\n \"referImages\": \"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg\",\n \"duration\": 123,\n \"size\": \"small\",\n \"character_url\": \"<string>\",\n \"character_timestamps\": \"1,3\",\n \"private\": \"true\",\n \"hookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/sora/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"sora-2\",\n \"prompt\": \"<string>\",\n \"referImages\": \"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg\",\n \"duration\": 123,\n \"size\": \"small\",\n \"character_url\": \"<string>\",\n \"character_timestamps\": \"1,3\",\n \"private\": \"true\",\n \"hookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "jobId"
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}这是 Sora 2 API 的核心视频生成接口。
如果你想查看完整的接口目录、推荐接入流程和相关能力,请先阅读 Sora 2 API 总览。
Body
application/json
注意:Flux生成图像接口同步返回的并不是任务的最终结果,任务的最终返回结果需要使用hookUrl参数接收异步通知,或者通过Flux查询任务结果 [blocked]接口进行查询。
sora-2 普通模式 sora-2-pro 高清模式
Available options:
sora-2, sora-2-pro Example:
"sora-2"
生成视频的描述词
垫图数组,不可传递真实的带有头像的人物图像,或者任何存在的美国产品的Logo。OpanAI规定,会因为不过审导致任务失败。 目前只会取第一个url
sora-2模式下,视频分辨率大体为 720 * 1280,横屏同理 sora-2-pro模式下,竖屏视频分辨率大体为 1024 *1792,横屏同理
Available options:
portrait 竖屏, landscape 横屏 视频时长,25s只在 sora-2-pro 模型下生效
支持范围 10 15 25
sora-2模型下默认10s sora-2-pro模型下默认15s
是否高清(只有sora-2-pro模式下支持,25s时长下只能选择标准清晰度)
Available options:
small:标准清晰度, large:HD清晰度 创建角色需要的视频链接
注意视频中一定不能出现真实人物,否则失败
视频角色出现的秒数范围,格式{start},{end}, 注意 end-start 的范围 1~3秒(结束时间减去开始时间范围为1到3秒)。
Example:
"1,3"
生成视频是否设置隐私,true - 隐私访问 false - 公开访问
回调通知地址,任务完成或失败将通过请地址进行通知,通知数据结构 [blocked]与fetch结构一致。如果未设置,则需要请求fetch接口 [blocked]进行查询
Last modified on May 5, 2026
⌘I