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.
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.
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"
}'
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.
Dùng edit_id và edits[].index để tạo preview hoặc merge lại audio mà không tạo lại toàn bộ.
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.
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ự.
# 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": []
}