การเชื่อมต่อ API ของ Grok Imagine Video
ใช้ Grok Imagine Video ผ่าน Rivya Public API v1 ด้วย model id grok-imagine-video, input ที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่าง response
grok-imagine-video
text, file
จำเป็นสำหรับโหมด reference
10
วิดีโอ
FIXED
5000 อักขระ
contract ของ request
ส่ง model id ที่ระดับบนสุด control เฉพาะโมเดลอยู่ใน params
| Key | Type | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|
| model | string | ใช่ | grok-imagine-video | ใช้ API model id grok-imagine-video |
| prompt | string | ใช่ | - | สูงสุด 5000 อักขระสำหรับโมเดลนี้ |
| params | object | ไม่ใช่ | - | object พารามิเตอร์เฉพาะโมเดล ใช้แถวด้านล่างสำหรับ key ที่อนุญาต |
| client_request_id | string | ไม่ใช่ | - | client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ |
พารามิเตอร์โมเดล
| Key | Type | จำเป็น | ค่าเริ่มต้น | ช่วง | ตัวเลือก | คำอธิบาย |
|---|---|---|---|---|---|---|
| mode | select | ไม่ใช่ | normal | - | fun, normal, spicy | โหมดการสร้าง |
| duration | number | ไม่ใช่ | 6 | min 6 / max 30 / step 1 | - | ระยะเวลา |
| resolution | select | ไม่ใช่ | 480p | - | 480p, 720p | ความละเอียด |
| aspect_ratio | select | ไม่ใช่ | 2:3 | - | 1:1, 16:9, 9:16, 2:3, 3:2 | อัตราส่วนภาพ |
policy การอัปโหลด
อัปโหลดไฟล์ reference ก่อน จากนั้นใส่ URL และ duration token ที่ได้กลับมาไว้ใน params.referenceMediaItems
รูปอ้างอิง: อัปโหลดไฟล์รูปภาพได้สูงสุด 1 ไฟล์สำหรับโปรเจกต์รูปภาพ
1
image
reference วิดีโอและเสียงควรมี durationToken จาก /api/v1/files เมื่อจำเป็นต้องตรวจ duration
| kind | ขนาดสูงสุด | MIME type |
|---|---|---|
| image | 10 MB | image/jpeg, image/png, image/webp |
request ขั้นต่ำ
{
"model": "grok-imagine-video",
"prompt": "A cinematic product reveal with smooth camera movement",
"params": {
"mode": "normal",
"duration": 6,
"resolution": "480p",
"aspect_ratio": "2:3"
}
}request แบบไฟล์ reference
{
"model": "grok-imagine-video",
"prompt": "A cinematic product reveal with smooth camera movement",
"params": {
"mode": "normal",
"duration": 6,
"resolution": "480p",
"aspect_ratio": "2:3",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}response จากการสร้าง
endpoint create ส่ง public task id กลับมา poll endpoint สถานะจนกว่างานจะสำเร็จหรือล้มเหลว
{
"id": "task_grok_imagine_video_example",
"status": "queued",
"model": "grok-imagine-video",
"reserved_credits": 10,
"final_credits": 0,
"created_at": "2026-05-11T00:00:00.000Z",
"updated_at": "2026-05-11T00:00:00.000Z",
"result": null,
"error": null
}error ทั่วไป
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
บางโหมดต้องใช้การอัปโหลด reference ผ่าน Files API