API basics
Integrate HEX Voice
Three steps: create a job → wait for completion → download the WAV. Base URL: https://tts.hextech.vn
1
Create speech
POST/v1/tts
Send text + API key. Receive a job_id. Each character = 1 credit.
bash
curl -X POST "https://tts.hextech.vn/v1/tts" \
-H "Authorization: Bearer hex_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello from HEX Voice","language":"vi"}'Response:
json
{
"job_id": "a1b2c3d4-…",
"status": "queued",
"credits_charged": 24,
"credit_balance": 76
}2
Check status
GET/v1/tts/{job_id}
Poll every 1–2 seconds until status is succeeded or failed.
bash
curl -sS "https://tts.hextech.vn/v1/tts/{job_id}"3
Download audio
GET/v1/tts/{job_id}/audio
Returns a WAV file. Call only when the job has succeeded.
bash
curl -sS "https://tts.hextech.vn/v1/tts/{job_id}/audio" -o speech.wavAuthentication
Every create-job request needs the header Authorization: Bearer hex_…. Create and manage keys at Studio → API.