Voice API / Documentation

v1 · Stable

Tích hợp Text-to-Speech rõ ràng, nhanh chóng.

Dùng một endpoint thống nhất để tạo audio qua ElevenLabs, MiniMax hoặc CapCut. Tài liệu này đủ ngắn để bắt đầu, đủ rõ để vận hành.

01

Xác thực

Gửi API key trong header Bearer. Không đưa key vào JavaScript hoặc frontend công khai.

Authorization: Bearer sk_live_...
02

Tạo audio

Endpoint trả về HTTP 202 cùng request ID. Dùng request ID để kiểm tra trạng thái xử lý.

curl https://voice.emtroly.online/v1/text-to-speech \
  -H "Authorization: Bearer $VOICE_API_KEY" \
  -H "Idempotency-Key: order-123" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Xin chào Việt Nam",
    "provider": "minimax",
    "voice_id": "YOUR_VOICE_ID",
    "model_id": "speech-2.8-turbo",
    "language_code": "Vietnamese"
  }'
03

Kiểm tra request

Poll request ID cho đến khi trạng thái chuyển sang completed hoặc failed.

curl https://voice.emtroly.online/v1/requests/REQUEST_ID \
  -H "Authorization: Bearer $VOICE_API_KEY"
04

Kiểm tra số dư

Đọc số dư hiện tại trước khi đưa request vào production.

curl https://voice.emtroly.online/v1/balance \
  -H "Authorization: Bearer $VOICE_API_KEY"
05

Mã trạng thái

Các mã thường gặp khi tích hợp.

202Đang xử lý401Key không hợp lệ402Số dư không đủ429Vượt rate limit502Provider lỗi