# Gemini Omni 1.1 Flash API เอกสารอ้างอิง API ฉบับสมบูรณ์สำหรับโมเดลสร้างวิดีโอ Google Gemini Omni 1.1 Flash ## รุ่นโมเดล API นี้รองรับโมเดลสี่รุ่น: | โมเดล | ID | คำอธิบาย | |-------|-----|-------------| | **Gemini Omni 1.1 Flash Text to Video** | `gemini-omni-1.1-flash-text-to-video` | สร้างวิดีโอจากพรอมต์ข้อความ | | **Gemini Omni 1.1 Flash Image to Video** | `gemini-omni-1.1-flash-image-to-video` | ทำให้ภาพเริ่มต้นที่จำเป็นเคลื่อนไหว พร้อมคำแนะนำจากเฟรมสุดท้ายที่เลือกใส่ได้ | | **Gemini Omni 1.1 Flash Video Edit** | `gemini-omni-1.1-flash-video-edit` | ใช้การเปลี่ยนแปลงตามพรอมต์กับวิดีโอที่มีอยู่ | | **Gemini Omni 1.1 Flash Reference to Video** | `gemini-omni-1.1-flash-reference-to-video` | สร้างวิดีโอจากภาพและวิดีโออ้างอิงที่เลือกใส่ได้ | ## การเปรียบเทียบโดยย่อ | คุณสมบัติ | Text to Video | Image to Video | Video Edit | Reference to Video | |---------|---------------|----------------|------------|--------------------| | อินพุตหลัก | พรอมต์ข้อความ | ภาพเริ่มต้น + พรอมต์ข้อความ | วิดีโอต้นฉบับ + พรอมต์ข้อความ | พรอมต์ข้อความ + ข้อมูลอ้างอิงที่เลือกใส่ได้ | | ระยะเวลา | 3-10 วินาที | 3-10 วินาที | วิดีโอต้นฉบับต้องมีความยาว 3-10 วินาที | 3-10 วินาที | | ตัวเลือกความละเอียด | 360p, 720p, 1080p, 4k | 360p, 720p, 1080p, 4k | 360p, 720p, 1080p, 4k | 360p, 720p, 1080p, 4k | | อัตราส่วนภาพ | 16:9, 9:16 | 16:9, 9:16 | ไม่รองรับ | 16:9, 9:16 | | อินพุตที่เลือกใส่ได้ | ไม่มี | ภาพสุดท้าย | ไม่มี | สูงสุด 10 ภาพและ 3 วิดีโอ | ## Endpoint ที่ใช้ร่วมกัน Gemini Omni 1.1 Flash ทุกรุ่นใช้ endpoint งานวิดีโอ: ``` POST /api/v1/video/task ``` ## Gemini Omni 1.1 Flash Text to Video ### พารามิเตอร์ที่จำเป็น | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `model_name` | string | ต้องเป็น `"gemini-omni-1.1-flash-text-to-video"` | | `prompt` | string | คำอธิบายแบบข้อความของวิดีโอที่ต้องการสร้าง | | `aspect_ratio` | string | อัตราส่วนภาพเอาต์พุต: `"16:9"` หรือ `"9:16"` | | `resolution` | string | ความละเอียดเอาต์พุต: `"360p"`, `"720p"`, `"1080p"` หรือ `"4k"` | | `duration` | number | ระยะเวลาเอาต์พุตเป็นวินาที ตั้งแต่ 3 ถึง 10 | ### ตัวอย่างคำขอ ```javascript const response = await fetch('https://api.flaq.ai/api/v1/video/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'gemini-omni-1.1-flash-text-to-video', prompt: 'A cinematic tracking shot follows a sailboat crossing a glowing ocean at sunset', aspect_ratio: '16:9', resolution: '1080p', duration: 8 }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## Gemini Omni 1.1 Flash Image to Video ### พารามิเตอร์ที่จำเป็น | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `model_name` | string | ต้องเป็น `"gemini-omni-1.1-flash-image-to-video"` | | `prompt` | string | คำอธิบายแบบข้อความของการเคลื่อนไหวและพัฒนาการของฉากที่ต้องการ | | `image_url` | string | URL ของภาพเฟรมเริ่มต้นที่จำเป็น | | `aspect_ratio` | string | อัตราส่วนภาพเอาต์พุต: `"16:9"` หรือ `"9:16"` | | `resolution` | string | ความละเอียดเอาต์พุต: `"360p"`, `"720p"`, `"1080p"` หรือ `"4k"` | | `duration` | number | ระยะเวลาเอาต์พุตเป็นวินาที ตั้งแต่ 3 ถึง 10 | ### พารามิเตอร์ที่เลือกใส่ได้ | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `image_end_url` | string | URL ของภาพเฟรมสุดท้ายที่เลือกใส่ได้ | ### ตัวอย่างคำขอ ```javascript { model_name: 'gemini-omni-1.1-flash-image-to-video', prompt: 'The girl walks toward the camera while the city lights shimmer behind her', image_url: 'https://example.com/start-frame.jpg', image_end_url: 'https://example.com/end-frame.jpg', aspect_ratio: '9:16', resolution: '1080p', duration: 8 } ``` ## Gemini Omni 1.1 Flash Video Edit ### พารามิเตอร์ที่จำเป็น | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `model_name` | string | ต้องเป็น `"gemini-omni-1.1-flash-video-edit"` | | `prompt` | string | คำสั่งแบบข้อความที่อธิบายการแก้ไขที่จะนำไปใช้ | | `video_url` | string | URL ของวิดีโอต้นฉบับ วิดีโอต้นฉบับต้องมีความยาวตั้งแต่ 3 ถึง 10 วินาที | | `resolution` | string | ความละเอียดเอาต์พุต: `"360p"`, `"720p"`, `"1080p"` หรือ `"4k"` | **หมายเหตุ:** Video Edit ไม่รองรับ `aspect_ratio` หรือ `duration` อย่าใส่พารามิเตอร์ใดพารามิเตอร์หนึ่งในคำขอ ### ตัวอย่างคำขอ ```javascript { model_name: 'gemini-omni-1.1-flash-video-edit', prompt: 'A small ball rolls into the scene and captures the attention of the cat', video_url: 'https://example.com/source-video.mp4', resolution: '1080p' } ``` ## Gemini Omni 1.1 Flash Reference to Video ภาพและวิดีโออ้างอิงเป็นตัวเลือก และสามารถใช้แยกกันหรือใช้ร่วมกันได้ ### พารามิเตอร์ที่จำเป็น | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `model_name` | string | ต้องเป็น `"gemini-omni-1.1-flash-reference-to-video"` | | `prompt` | string | คำอธิบายแบบข้อความของวิดีโอที่ต้องการสร้าง | | `aspect_ratio` | string | อัตราส่วนภาพเอาต์พุต: `"16:9"` หรือ `"9:16"` | | `resolution` | string | ความละเอียดเอาต์พุต: `"360p"`, `"720p"`, `"1080p"` หรือ `"4k"` | | `duration` | number | ระยะเวลาเอาต์พุตเป็นวินาที ตั้งแต่ 3 ถึง 10 | ### อินพุตอ้างอิงที่เลือกใส่ได้ | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `images` | string[] | URL ของภาพอ้างอิงสูงสุด 10 รายการ | | `videos` | string[] | URL ของวิดีโออ้างอิงสูงสุด 3 รายการ แต่ละวิดีโอต้องมีความยาวไม่เกิน 3 วินาที | ### ตัวอย่างคำขอ ```javascript { model_name: 'gemini-omni-1.1-flash-reference-to-video', prompt: 'Use the references to create a cinematic shot of a small boat approaching from the distance', aspect_ratio: '16:9', resolution: '1080p', duration: 8, images: ['https://example.com/boat-reference.jpg'], videos: ['https://example.com/motion-reference.mp4'] } ``` ## รูปแบบการตอบกลับ ### การตอบกลับเริ่มต้น โมเดลทั้งหมดจะส่งคืน `task_id` สำหรับการสำรวจสถานะ: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` ### การตอบกลับจากการสำรวจสถานะ สำรวจ `GET /api/v1/video/{taskId}` เพื่อตรวจสอบสถานะ: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "succeed", "task_status_msg": null, "task_result": { "credit": 0.2, "videos": [ { "url": "https://example.com/generated-video.mp4" } ] } } } ``` ### ค่าสถานะ - `submitted`: ยอมรับงานแล้วและกำลังรอการประมวลผล - `processing`: กำลังสร้างวิดีโอ - `succeed`: สร้างวิดีโอเสร็จสมบูรณ์ - `failed`: การสร้างวิดีโอล้มเหลว ## แนวทางปฏิบัติที่แนะนำ 1. **การกำหนดทิศทางพรอมต์**: อธิบายตัวแบบ การกระทำ การเคลื่อนไหวของกล้อง แสง และลำดับการดำเนินฉากให้ชัดเจน 2. **การตั้งค่าที่จำเป็น**: ระบุความละเอียดที่รองรับเสมอ และสำหรับรุ่นอื่นนอกเหนือจาก Video Edit ให้ระบุอัตราส่วนภาพและระยะเวลาที่รองรับ 3. **อินพุตภาพ**: ใช้ URL ที่เสถียรและเข้าถึงได้แบบสาธารณะสำหรับภาพเริ่มต้น ภาพสุดท้าย และภาพอ้างอิง 4. **อินพุต Video Edit**: ตรวจสอบว่าวิดีโอต้นฉบับมีความยาวระหว่าง 3 ถึง 10 วินาทีก่อนส่ง 5. **ขีดจำกัดข้อมูลอ้างอิง**: ส่งภาพไม่เกิน 10 ภาพและวิดีโอ 3 รายการ และกำหนดให้วิดีโออ้างอิงแต่ละรายการมีความยาวไม่เกิน 3 วินาที