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.
| Field | Type | Default | Description |
|---|---|---|---|
| text | string | required | Text to convert to speech |
| speaker | string | required | Registered speaker name |
| language | string | default | ISO 639-1 language code |
| output_format | string | pcm_24000 | See output formats on the overview page |
| speed | float | 1.0 | Range 0.1–2.0 |
| expressive_level | integer | 30 | Range 0–100; optimal 25–65 |
| custom_pronunciations | object | {"words":{},"phonemes":{}} | Per-request pronunciation overrides |
| translate_text | boolean | false | Translate 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