# Veo 3.1 API เอกสารอ้างอิง API ฉบับสมบูรณ์สำหรับโมเดลสร้างวิดีโอ Veo 3.1. ## ตัวเลือกโมเดล API นี้รองรับโมเดล 4 ตัวเลือก: | โมเดล | ID | ความเร็ว | คำอธิบาย | |-------|-----|-------|-------------| | **Veo 3.1 Text to Video** | `veo3.1-text-to-video` | Standard | การสร้าง text-to-video คุณภาพสูง | | **Veo 3.1 Image to Video** | `veo3.1-image-to-video` | Standard | การสร้าง image-to-video คุณภาพสูง | | **Veo 3.1 Fast Text to Video** | `veo3.1-fast-text-to-video` | Fast | การสร้าง text-to-video ที่เร็วขึ้น | | **Veo 3.1 Fast Image to Video** | `veo3.1-fast-image-to-video` | Fast | การสร้าง image-to-video ที่เร็วขึ้น | ## เปรียบเทียบอย่างรวดเร็ว | ฟีเจอร์ | Standard | Fast | |---------|----------|------| | ความเร็วการสร้าง | ~2-3 นาที | ~1-2 นาที | | คุณภาพ | สูงสุด | สูง | | อัตราส่วนภาพ | 16:9, 9:16 | 16:9, 9:16 | | ฟีเจอร์ | Text to Video | Image to Video | |---------|---------------|----------------| | อินพุต | พรอมต์ข้อความ | รูปภาพ + พรอมต์ข้อความ | | เฟรมเริ่มต้น | ไม่รองรับ | ไม่บังคับ | | เฟรมสิ้นสุด | ไม่รองรับ | ไม่บังคับ | | เสียง | ไม่รองรับ | ไม่รองรับ | ## Veo 3.1 ข้อความเป็นวิดีโอ (Standard & Fast) ### จุดเชื่อมต่อ ``` POST /api/v1/video/task ``` ### พารามิเตอร์คำขอ #### จำเป็น | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `model_name` | string | `"veo3.1-text-to-video"` หรือ `"veo3.1-fast-text-to-video"` | | `prompt` | string | พรอมต์สำหรับสร้างวิดีโอ | #### ไม่บังคับ | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `aspect_ratio` | string | อัตราส่วนภาพวิดีโอ: `"16:9"` หรือ `"9:16"` | ### ตัวอย่างคำขอ **เวอร์ชัน Standard:** ```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: 'veo3.1-text-to-video', prompt: 'A time-lapse of a flower blooming' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` **เวอร์ชัน Fast:** ```javascript { model_name: 'veo3.1-fast-text-to-video', prompt: 'A time-lapse of a flower blooming' } ``` ## Veo 3.1 รูปภาพเป็นวิดีโอ (Standard & Fast) ### พารามิเตอร์คำขอ #### จำเป็น | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `model_name` | string | `"veo3.1-image-to-video"` หรือ `"veo3.1-fast-image-to-video"` | | `prompt` | string | พรอมต์สำหรับสร้างวิดีโอ | #### ไม่บังคับ | พารามิเตอร์ | ประเภท | คำอธิบาย | |-----------|------|-------------| | `aspect_ratio` | string | อัตราส่วนภาพวิดีโอ: `"16:9"` หรือ `"9:16"` | | `image_url` | string | URL รูปภาพเฟรมเริ่มต้นแบบไม่บังคับ | | `image_end_url` | string | เฟรมสุดท้ายของวิดีโอ | ### ตัวอย่างคำขอ **เวอร์ชัน Standard:** ```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: 'veo3.1-image-to-video', image_url: 'https://example.com/image.jpg', prompt: 'Camera slowly zooms in, soft wind movement' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` **เวอร์ชัน Fast:** ```javascript { model_name: 'veo3.1-fast-image-to-video', image_url: 'https://example.com/image.jpg', prompt: 'Camera slowly zooms in, soft wind movement' } ``` ## รูปแบบการตอบกลับ ### การตอบกลับเริ่มต้น ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` ### การตอบกลับจากการ Poll Poll `/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`: การสร้างวิดีโอล้มเหลว ## เวลาประมวลผล - **เวอร์ชัน Standard**: ~2-3 นาที - **เวอร์ชัน Fast**: ~1-2 นาที ใช้การ Poll เพื่อตรวจสถานะการสร้างทุก 5-10 วินาที. ## แนวทางปฏิบัติที่ดี - ระบุการเคลื่อนไหวของกล้องและไดนามิกของฉากให้เฉพาะเจาะจง - เวอร์ชัน Fast ให้คุณภาพดีพร้อมการประมวลผลที่เร็วขึ้น - เวอร์ชัน Standard ให้เอาต์พุตคุณภาพสูงสุด - ใช้พรอมต์ที่อธิบายละเอียดเพื่อผลลัพธ์ที่ดีขึ้น