Tích hợp API Sora 2
Dùng Sora 2 qua Rivya Public API v1 với model id sora-2, input được hỗ trợ, tham số, quy tắc Files API, tín dụng và ví dụ response.
sora-2
text, file
Bắt buộc cho reference modes
6
Video
FIXED
10000 ký tự
Hợp đồng yêu cầu
Gửi model id ở top level. Điều khiển riêng của mô hình nằm trong params.
| Key | Type | Bắt buộc | Default | Mô tả |
|---|---|---|---|---|
| model | string | Có | sora-2 | Dùng API model id sora-2. |
| prompt | string | Có | - | Tối đa 10000 ký tự cho mô hình này. |
| params | object | Không | - | Object tham số riêng của mô hình. Dùng các dòng bên dưới để xem key được phép. |
| client_request_id | string | Không | - | Client-side id tùy chọn để trace request trong hệ thống của bạn. |
Tham số mô hình
| Key | Type | Bắt buộc | Default | Range | Options | Mô tả |
|---|---|---|---|---|---|---|
| n_frames | select | Không | 10 | - | 10, 15 | Thời lượng |
| aspect_ratio | select | Không | landscape | - | landscape, portrait | Tỷ lệ khung hình |
| remove_watermark | select | Không | false | - | false, true | Xóa watermark |
| upload_method | select | Không | s3 | - | s3, oss | Đích tải lên |
Chính sách tải lên
Upload reference files trước, rồi đặt URL và duration token được trả về vào params.referenceMediaItems.
Ảnh tham chiếu: Tải lên tối đa 1 tệp hình ảnh cho dự án hình ảnh.
1
image
Tham chiếu video và audio nên mang durationToken từ /api/v1/files khi cần xác minh duration.
| kind | Kích thước tối đa | MIME types |
|---|---|---|
| image | 10 MB | image/jpeg, image/png, image/webp |
Yêu cầu tối thiểu
{
"model": "sora-2",
"prompt": "A cinematic product reveal with smooth camera movement",
"params": {
"n_frames": "10",
"aspect_ratio": "landscape",
"remove_watermark": "false",
"upload_method": "s3"
}
}Yêu cầu có tệp tham chiếu
{
"model": "sora-2",
"prompt": "A cinematic product reveal with smooth camera movement",
"params": {
"n_frames": "10",
"aspect_ratio": "landscape",
"remove_watermark": "false",
"upload_method": "s3",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}Phản hồi tạo
Create endpoint trả về public task id. Poll status endpoint cho đến khi task succeeded hoặc failed.
{
"id": "task_sora_2_example",
"status": "queued",
"model": "sora-2",
"reserved_credits": 6,
"final_credits": 0,
"created_at": "2026-05-11T00:00:00.000Z",
"updated_at": "2026-05-11T00:00:00.000Z",
"result": null,
"error": null
}Lỗi thường gặp
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
Một số mode cần Files API reference uploads.