Speech (Text-to-Speech)
POST /v1/speech — synthesize spoken audio from text through the assigned route.
POST /v1/speech converts text into spoken audio. The assigned route must include a model with the audio_output capability.
For the reverse direction — turning audio into text — see Audio and STT.
Request
curl https://ai.latentkit.com/v1/speech \
-H "Authorization: Bearer $LATENTKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Welcome to LatentKit. Your request was routed automatically.",
"voice": "alloy",
"response_format": "mp3",
"speed": 1.0
}'Fields
| Field | Description |
|---|---|
input | Text to synthesize (required) |
voice | Voice name when the route model supports voice selection (e.g. alloy) |
response_format | Output audio format when supported (e.g. mp3, wav, opus) |
speed | Playback speed multiplier when supported (must be greater than 0) |
response_profile | fast, balanced, or deep when the route allows overrides |
Voice names and formats are provider-specific. Because the route decides which provider executes, prefer widely supported values, or pin a specific model in the routing policy when your product depends on one exact voice.
SDK
const speech = await client.speech.create({
input: 'Welcome to LatentKit.',
voice: 'alloy',
response_format: 'mp3',
});speech = client.speech.create(
input="Welcome to LatentKit.",
voice="alloy",
response_format="mp3",
)Response
Speech responses use the unified runtime envelope (id, provider, model, policy_version_id, usage). Inspect the returned payload for the audio content field your route's provider adapter produces — typically base64-encoded audio data plus format metadata.
Managed Billing
Platform Access speech consumes workspace credits when the selected model is available for managed usage. BYOK speech is charged by your provider account. Check current availability and pricing in the console.
Audio output inside chat
Chat requests can also request spoken output by including "modalities": ["audio"] when the route model supports audio output. When present, LatentKit requires the audio_output capability for route eligibility.
Troubleshooting
NO_HEALTHY_PROVIDERmeans no route model has theaudio_outputcapability. Enable a TTS-capable model on a connection and add it to the route.- If a model is unavailable through Platform Access, use a supported BYOK connection or select another route model.
Related
- Audio and STT — transcription and translation
- Models & providers
- Routes & policies