Lightning V3.1
Generate speech from text (Lightning V3.1)
<Warning>Endpoint scheduled for retirement. This URL will stop accepting requests 60 days from the Lightning v3.1 Pro launch (2026-05-15) — i.e. on 2026-07-14. The Lightning v3.1 model itself is current and stays. Migrate to POST /waves/v1/tts and select Lightning v3.1 via the model body field (default).</Warning>
Synthesize speech from text in a single request. The simplest way to get audio when you have the full text up front — pass text + voice_id, get back binary audio.
When to use this
- Use this for short utterances you can render before playback (notifications, prompts, batch jobs, audio file generation).
- Use the SSE streaming endpoint when you want playback to start before the full audio is ready (long passages, latency-sensitive apps).
- Use the WebSocket endpoint when text arrives incrementally (LLM token streams, live captioning).
Key features
- 44 kHz natural, expressive synthesis
- Cloned voice IDs (voice_*) work — same param as catalog voices
- 12 documented languages — see the model card for the full list
- Output formats: pcm, mp3, wav, ulaw, alaw
- Sample rates: 8 kHz – 44.1 kHz
- Speed: 0.5× – 2×
- Per-call pronunciation dictionaries via pronunciation_dicts
Examples
cURL
curl -X POST "https://api.smallest.ai/waves/v1/lightning-v3.1/get_speech" \
-H "Authorization: Bearer $SMALLEST_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: audio/wav" \
-d '{
"text": "Hello from Lightning v3.1.",
"voice_id": "magnus",
"sample_rate": 24000,
"output_format": "wav"
}' --output speech.wav
Python (pip install smallestai>=4.4.0)
from smallestai import SmallestAI
client = SmallestAI(api_key="YOUR_API_KEY")
with open("speech.wav", "wb") as f:
for chunk in client.waves.synthesize_lightning_v3_1(
text="Hello from Lightning v3.1.",
voice_id="magnus",
sample_rate=24000,
output_format="wav",
# Optional: cloned voice support
# voice_id="voice_FlPKRWI7DX",
# Optional: pin pronunciations for specific words
# pronunciation_dicts=["<your dict id>"],
):
f.write(chunk)
JavaScript / TypeScript (using fetch)
const res = await fetch("https://api.smallest.ai/waves/v1/lightning-v3.1/get_speech", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SMALLEST_API_KEY}`,
"Content-Type": "application/json",
Accept: "audio/wav",
},
body: JSON.stringify({
text: "Hello from Lightning v3.1.",
voice_id: "magnus",
sample_rate: 24000,
output_format: "wav",
}),
});
const audio = Buffer.from(await res.arrayBuffer());
require("node:fs").writeFileSync("speech.wav", audio);
Common gotchas
- Set Accept: audio/wav. Omitting it can return an empty or unplayable response.
- Cloned voices (voice_* from add_voice) work on this endpoint and support pronunciation_dicts.
- pronunciation_dicts validates IDs at request time. Passing an unknown ID returns Invalid input data — create the dict first via the pronunciation-dicts endpoint and save the returned id.
- Pronunciation matching is case-sensitive. Add both Synopsis and synopsis if your text uses both casings.
- 44.1 kHz output is supported but most playback environments are happy with 24 kHz — drop the sample rate if bandwidth matters.
- JavaScript / TypeScript: the official smallestai npm package predates Lightning v3.1, so call this endpoint with fetch or axios as shown above.
post/waves/v1/lightning-v3.1/get_speech
Headers
Accept'audio/wav' required
Must be audio/wav to receive binary audio. Required for proper playback.
Request body
Example request
{
"output_format": "mp3"
}Response
Synthesized speech retrieved successfully.