Generate speech

Inference (JSON + base64)

POSThttps://api.lucidweights.ai/v1/tts/inference

Converts text into speech and returns base64-encoded audio in JSON. Only speakers present in the registry are accepted.

FieldTypeDefaultDescription
textstringrequiredText to convert to speech
speakerstringrequiredRegistered speaker name
languagestringdefaultISO 639-1 language code
output_formatstringpcm_24000See output formats on the overview page
speedfloat1.0Range 0.1–2.0
expressive_levelinteger30Range 0–100; optimal 25–65
custom_pronunciationsobject{"words":{},"phonemes":{}}Per-request pronunciation overrides
translate_textbooleanfalseTranslate input before synthesis

Response

{
  "audio": "<base64-encoded audio>"
}
NOTE
If the speaker is not registered, the request returns 400 with a list of valid speaker names in detail.
Example
curl -X POST "https://api.lucidweights.ai/v1/tts/inference" \
  -H "accept: application/json" \
  -H "x-api-key: lw_YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The quick brown fox jumps over the lazy dog.",
    "speaker": "emily",
    "language": "en",
    "output_format": "pcm_24000",
    "speed": 1,
    "expressive_level": 30
  }'

File inference

POSThttps://api.lucidweights.ai/v1/tts/file-inference

Same request body as inference. Returns an audio file (audio/wav or audio/mpeg depending on output_format).

Example
curl -X POST "https://api.lucidweights.ai/v1/tts/file-inference" \
  -H "x-api-key: lw_YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The quick brown fox jumps over the lazy dog.",
    "speaker": "emily",
    "language": "en",
    "output_format": "pcm_24000"
  }' \
  --output output.wav