Chuyển đến nội dung chính
POST
/
v1
/
videos
Create a Sora video job
curl --request POST \
  --url https://api.cometapi.com/v1/videos \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'prompt=A paper airplane glides across a desk.' \
  --form input_reference='@example-file'
{
  "created_at": 1773296991,
  "id": "video_69b25d5f467c81908733a56bc236b4df",
  "model": "sora-2",
  "object": "video",
  "progress": 0,
  "seconds": "4",
  "size": "1280x720",
  "status": "queued"
}
Sử dụng endpoint này để bắt đầu một tác vụ render Sora mới từ văn bản, hoặc từ văn bản kèm một hình ảnh tham chiếu. API trả về một video id ngay lập tức và không chờ render hoàn tất.

Bắt đầu với tác vụ nhỏ nhất nhưng hữu ích

  • Dùng sora-2 để lặp thử nhanh hơn hoặc sora-2-pro khi chất lượng đầu ra quan trọng hơn tốc độ
  • Giữ seconds4 cho yêu cầu đầu tiên của bạn
  • Bắt đầu với size: 1280x720 trừ khi bạn thực sự cần đầu ra theo chiều dọc
  • Chỉ tải lên tối đa một hình ảnh tham chiếu

Luồng end-to-end

1

Tạo tác vụ render

Gửi model, prompt, seconds, và size, sau đó lưu id được trả về.
2

Truy vấn cho đến khi tác vụ hoàn tất

Gọi Truy xuất Video cho đến khi trạng thái chuyển thành completed hoặc failed.
3

Tải xuống hoặc remix kết quả

Khi render hoàn tất, lấy tệp bằng Truy xuất Nội dung Video. Nếu bạn muốn một biến thể có điều chỉnh mục tiêu, hãy dùng Remix Video trên kết quả đã hoàn tất.

Hành vi của Sora vẫn áp dụng

OpenAI mô tả cùng luồng tạo -> truy xuất -> tải xuống trong Videos API. Trên CometAPI, bạn vẫn giữ nguyên cấu trúc request của Sora, nhưng sử dụng base URL và key của CometAPI. Các URL tải xuống sau khi hoàn tất chỉ có hiệu lực tạm thời, vì vậy hãy sao chép các tài nguyên đã hoàn tất vào hệ thống lưu trữ của riêng bạn nếu bạn cần lưu giữ lâu dài.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Nội dung

multipart/form-data
prompt
string
bắt buộc

Text prompt that describes the video you want to create.

Ví dụ:

"A paper airplane glides across a desk."

model
string
mặc định:sora-2

Sora model ID. Choose a current model from the Models page.

Ví dụ:

"sora-2"

seconds
enum<string>
mặc định:4

Clip duration in seconds.

Tùy chọn có sẵn:
4,
8,
12
Ví dụ:

"4"

size
enum<string>
mặc định:1280x720

Output resolution formatted as width x height.

Tùy chọn có sẵn:
720x1280,
1280x720,
1024x1792,
1792x1024
Ví dụ:

"1280x720"

input_reference
file

Optional reference image uploaded as a file. The image should match the target size you request.

Phản hồi

200 - application/json

Video job accepted.

created_at
integer
bắt buộc
id
string
bắt buộc
model
string
bắt buộc
object
string
bắt buộc
progress
integer
bắt buộc
seconds
string
bắt buộc
size
string
bắt buộc
status
string
bắt buộc