ApiX Docs
Docs / Text to speech
·View as Markdown

Text to speech

POST /v1/audio/speech returns raw audio bytes.

bash
curl "$APIX_BASE/v1/audio/speech" \
  -H "Authorization: Bearer $APIX_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "1/heygen-voice-1-turbo:free",
    "input": "Hello, this is a test.",
    "voice": "nadine"
  }' --output voice.pcm
FieldNotes
inputtext to read
voiceone of the model voices
response_formatthe catalog value is enforced (pcm here; HeyGen rejects mp3)

The reply has Content-Type: audio/pcm;rate=44100;channels=1 and the generation id in X-Generation-Id. HeyGen voices: nadine, tabitha, bram, gareth, noelle, meredith, sabrina, lucian, weston, vincent.

Voice cloning#

Send a reference recording and its transcript instead of voice:

json
{
  "model": "1/heygen-voice-1-turbo:free",
  "input": "This is a clone test.",
  "input_references": [
    {"type": "input_audio", "input_audio": {"data": "data:audio/wav;base64,UklGR..."}},
    {"type": "text", "text": "Transcript of the reference recording."}
  ]
}

One to three clips. Each clip can be followed by its transcript; you may also add one image as a scene reference. Nothing is stored server-side.

To use a voice you already cloned in your provider account, connect your key there (BYOK) and pass its id as voice.