[POST] Tạo Text To Speech
API dùng để chuyển văn bản thành giọng nói (Text-to-Speech) bằng dịch vụ TTS của LarVoice. Kết quả trả về là một JSON chứa thông tin.
🔐 Authentication
-
API Key: Gửi qua header
Header cần có
apikey: 92d80a807743fa1bfa337777212ce6d4
📤 Request
Method
POST
Content-Type
multipart/form-data
Parameters
Field | Type | Required | Default | Description |
---|---|---|---|---|
text |
string | ✅ Yes | — | Nội dung văn bản cần chuyển thành giọng nói |
voice_id |
int | ✅ Yes | — | ID giọng đọc |
voice_guest_id |
int | No | = voice_id | ID khách sử dụng giọng |
language_id |
int | ✅ Yes | 1 |
Ngôn ngữ sử dụng (1 = Vietnamese) |
model_id |
int | ✅ Yes | 1 |
ID mô hình phát âm ( 1 = Mới nhất) |
format | string | ✅ Yes | wav | Xuất file |
📥 Example
curl --location 'https://larvoice.com/api/tts' \--header 'apikey:339c1d4b4f9f11e8d8a3f57587882c97' \--form 'text="Xin Chào các bạn. Xin Chào các bạn"' \--form 'voice_id=836' \--form 'language_id=1' \--form 'model_id=1' \--form 'format="wav"'
📤 Response
Success Response (200 OK)
{"id": 11729,"uuid": "0bb07ee4-cd72-4a56-bf3a-583028bae886","result_url": "https://larvoice.com/api/tts/11729","status": "pending"}
Error Response (400, 500)
{ "error": "Missing required fields: text and voice_id"}