ODance Dev API v1

Tạo video nhảy AI bằng code — REST JSON, key dùng credit của tài khoản bạn. Tạo key tại Cài đặt.

Xác thực

Gửi key ở header (2 cách đều được):

Authorization: Bearer od_live_xxxxxxxx...
X-Api-Key: od_live_xxxxxxxx...

Key sai/thiếu → 401 {"error":"api key khong hop le"}. Key thu hồi → 401 ngay.

Endpoints

GET /api/dev/v1/meThông tin user + credit
GET /api/dev/v1/modelsDanh sách model khả dụng
POST /api/dev/v1/createTạo job
GET /api/dev/v1/jobs/:idTrạng thái job
GET /api/dev/v1/jobs50 job mới nhất
GET /api/dev/v1/docsDocs JSON

Tạo job

POST /api/dev/v1/create
{
  "modelId": 1,                        // GET /models để lấy
  "imageUrl": "https://.../anh.png",   // ảnh nhân vật
  "videoUrl": "https://.../mau.mp4",   // video tham chiếu
  "seconds": "10",                     // 5 | 10 | 15 | 20
  "quality": "lite",                   // lite (720p) | pro (1080p)
  "ratio": "9:16",                     // 9:16 | 16:9 | 1:1
  "webhookUrl": "https://ban.vn/hook"  // tùy chọn — nhận POST khi job xong
}
→ 200 {"jobId": "uuid"}

Bảng giá (credit)

Lite (720p)5s=2 · 10s=3 · 15s=4 · 20s=5
Pro (1080p)5s=3 · 10s=4 · 15s=5 · 20s=6

1 credit = 500đée khi nạp. Credit trừ ngay khi tạo job, job fail được hoàn tự động.

Webhook

Nếu truyền webhookUrl (https), khi job xong ODance POST:

{
  "event": "job.done" | "job.failed",
  "jobId": "uuid",
  "status": "done" | "failed",
  "outputUrl": "https://.../outputs/xxx.mp4",
  "videoUrl": "https://dance.ostudio.io.vn/v/xxx",
  "ts": 1791359072499
}

Rate limit (theo key)

Limit tính theo từng key — nhiều dev khác nhau không giành bucket với nhau. Mặc định 60 req/phút/key.

Header responseRateLimit-Limit · RateLimit-Remaining · RateLimit-Reset
Vượt limit429 + Retry-After (giây)
Tùy biến khi tạo key{"name": "...", "rateLimit": {"windowMs": 60000, "max": 120}}

Ví dụ curl

curl -X POST https://dance.ostudio.io.vn/api/dev/v1/create \
  -H "Authorization: Bearer od_live_..." \
  -H "Content-Type: application/json" \
  -d '{"modelId":1,"imageUrl":"https://i.imgur.com/a.png","videoUrl":"https://.../v.mp4","seconds":"10","quality":"lite"}'
Tạo API key