API Docs

Tích hợp tạo giọng đọc tự động.

API TTS, clone voice và quy tắc phát âm cho team muốn build SaaS riêng trên hạ tầng LarVoice.

Tạo audio ngay Trừ đúng số ký tự
taogiong.com
curl -X POST "https://taogiong.com/v1/tts" \
  -H "content-type: application/json" \
  -H "x-api-key: sk_tts_..." \
  -d '{
    "gen_text": "Xin chào, đây là giọng đọc thử.",
    "language": "vi",
    "output_format": "wav"
  }'
Endpoint/v1/tts
AuthHeader: x-api-key
Voice/v1/voices
Rate limit60 req/phút
Features

TTS, clone voice, pronunciation.

Tạo audio

Gửi gen_text, chọn ref_audio_url, ref_audio_2_url, tốc độ và output format. API trả stream_status_url để poll và lấy final_audio_url.

Sửa từng câu

Dùng edit_idedits[].index để tạo preview hoặc merge lại audio mà không tạo lại toàn bộ.

Clone voice

Upload WAV 5-7 giây qua /v1/voices. API trả URL cố định dạng /voice-refs/.../audio để dùng làm ref_audio_url hoặc ref_audio_2_url...ref_audio_10_url.

Pronunciation

Lưu rule phát âm theo tài khoản, ví dụ ai thành ây ai. TTS và edit tự áp dụng trước khi tính ký tự.

Integration

Quy trình tích hợp.

# 1. Upload giọng clone
curl -X POST "https://taogiong.com/v1/voices" \
  -H "x-api-key: YOUR_KEY" \
  -F "name=Giọng narrator" \
  -F "voice=@voice-6s.wav"

# 2. Lưu quy tắc phát âm
curl -X PUT "https://taogiong.com/v1/pronunciation" \
  -H "content-type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{"enabled":true,"rules":[{"from":"ai","to":"ây ai"}]}'

# 3. Tạo audio
curl -X POST "https://taogiong.com/v1/tts" \
  -H "content-type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{"gen_text":"[audio_1] Xin chào. [audio_2] Đây là giọng thứ hai.","language":"vi","ref_audio_url":"https://taogiong.com/voice-refs/vref_0123456789abcdef0123456789abcdef/audio","ref_audio_2_url":"https://taogiong.com/voice-refs/vref_fedcba9876543210fedcba9876543210/audio","ref_audio_3_url":"https://taogiong.com/voice-refs/vref_11111111111111111111111111111111/audio","output_format":"wav"}'

# 4. Poll trạng thái
curl -X GET "https://taogiong.com/v1/tts/stream/job_0123456789abcdef0123456789abcdef/status" \
  -H "x-api-key: YOUR_KEY"

# 5. Sửa câu bằng edit_id
curl -X POST "https://taogiong.com/v1/tts/edit" \
  -H "content-type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{"edit_id":"<edit-id>","edits":[{"index":2,"text":"câu mới"}]}'
# Response mẫu
{
  "ok": true,
  "stream": true,
  "status": "processing",
  "stream_status": "processing",
  "job_id": "job_0123456789abcdef0123456789abcdef",
  "cost_credits": 34,
  "audio_url": "https://taogiong.com/v1/tts/stream/job_0123456789abcdef0123456789abcdef/file/chunk_0.wav",
  "stream_status_url": "https://taogiong.com/v1/tts/stream/job_0123456789abcdef0123456789abcdef/status",
  "final_audio_url": null,
  "output_format": "wav",
  "duration_seconds": null,
  "edit_id": "job_0123456789abcdef0123456789abcdef",
  "edit_units": [],
  "chunks": []
}