เอกสารอ้างอิง API
ภาพรวม API
ทำความเข้าใจการยืนยันตัวตน การส่งงาน การตรวจสอบสถานะ และ webhook ของ Seedance 2.0 Open API
Seedance 2.0 Open API ช่วยให้คุณส่งงานสร้างวิดีโอแบบ asynchronous จากผลิตภัณฑ์ของคุณเอง และรับผลลัพธ์เมื่อประมวลผลเสร็จแล้ว
Base URL
https://www.seedance2.inkAuthentication
คำขอ Open API ทั้งหมดใช้ Bearer token ที่สร้างจากแดชบอร์ด Seedance
Authorization: Bearer sd2_live_your_api_key{
"success": false,
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}ขั้นตอนการเชื่อมต่อ
- สร้าง API Key ในแดชบอร์ด Seedance
- ส่งงานด้วย
POST /api/open/v1/video/generations - เก็บค่า
requestIdที่ระบบส่งกลับมา - ทำ polling ไปที่
GET /api/open/v1/video/generations/{requestId}จนกว่างานจะจบ - หากต้องการ สามารถใช้ webhook เพื่อรับการแจ้งเตือนเมื่องานเสร็จ
Endpoint หลัก
| Method | Endpoint | Description |
|---|---|---|
GET | /api/open/v1/models | แสดงโมเดล ระยะเวลา อัตราส่วน ความละเอียด และข้อมูลราคา |
POST | /api/open/v1/video/generations | สร้างงานสร้างวิดีโอใหม่ |
GET | /api/open/v1/video/generations/{requestId} | ตรวจสอบสถานะงานและคืนค่า URL ของผลลัพธ์เมื่อพร้อม |
POST | /api/open/v1/video/generations/{requestId}/cancel | ยกเลิกงานที่อยู่ในคิวหรือกำลังประมวลผล |
Available Models
| Model | Best for | Supported durations | Resolutions |
|---|---|---|---|
seedance-2.0 | Highest quality, multimodal generation | 4-15 seconds | 480p, 720p, 1080p |
seedance-2.0-fast | Faster turnaround | 4-15 seconds | 480p, 720p, 1080p |
seedance-1.5-pro | Lower-cost fallback workloads | 5 or 10 seconds | 480p, 720p, 1080p |
Supported aspect ratios:
16:99:161:1
สถานะ
| Status | Description |
|---|---|
queued | ระบบรับคำขอแล้วและกำลังรอในคิว |
processing | ระบบกำลังประมวลผลการสร้าง |
succeeded | งานสำเร็จแล้วและมี output.url ให้ใช้งาน |
failed | งานล้มเหลว โปรดตรวจสอบ error |
cancelled | งานถูกยกเลิกก่อนเสร็จสิ้น |
Models Endpoint Example
curl https://www.seedance2.ink/api/open/v1/models{
"success": true,
"data": [
{
"id": "seedance-2.0",
"type": "video_generation",
"mode": "image_to_video",
"durations": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
"aspectRatios": ["16:9", "9:16", "1:1"],
"resolutions": ["480p", "720p", "1080p"],
"usdPerSecond": {
"480p": 0.05,
"720p": 0.1,
"1080p": 0.2
}
}
]
}Webhook
คุณสามารถกำหนด webhookUrl ต่อคำขอ หรือกำหนด callback เริ่มต้นไว้ที่ระดับ API Key
- หากมีทั้งสองแบบ ระบบจะใช้
webhookUrlจากคำขอก่อน - หากตั้งค่า Webhook Secret ระบบจะส่ง header
x-seedance-signatureมาด้วย - Webhook จะถูกส่งเมื่อสถานะของงานเป็นสถานะสุดท้ายเท่านั้น
x-seedance-signature: <hex_sha256_hmac>{
"success": true,
"requestId": "req_1234567890",
"status": "succeeded",
"output": {
"type": "video",
"url": "https://pub-your-bucket.r2.dev/open-api-results/req_1234567890.mp4"
},
"error": null
}รหัสข้อผิดพลาด
| HTTP status | Error code | Description |
|---|---|---|
400 | invalid_request | ข้อมูลคำขอไม่ตรงกับ schema ที่คาดไว้ |
401 | unauthorized | API Key หายไปหรือไม่ถูกต้อง |
402 | insufficient_credits | เครดิตไม่เพียงพอสำหรับสร้างงาน |
404 | not_found | ไม่พบงานภายใต้ API Key ปัจจุบัน |
429 | rate_limited | เกินลิมิตต่อหนึ่งนาทีหรือโควต้ารายเดือน |
500 | internal_error | เกิดข้อผิดพลาดภายในที่ไม่คาดคิด |
ขั้นตอนถัดไป
- อ่าน ข้อความเป็นวิดีโอ
- อ่าน ภาพเป็นวิดีโอ