Audio & Realtime
Create Speech
Generates audio from the input text
Use GET /v1/models?recommended_for=tts to get current speech models.
Request Body
The response mode depends on the selected model and stream_format. For longer input, allow an HTTP client timeout of at least 120s.
Optional fields, voices, output formats, and SSE support depend on the selected model. Check GET /v1/models/{model} before sending them. Unsupported parameters can return 400 unsupported_parameter.
TTS model ID. Find current choices with GET /v1/models?recommended_for=tts. There is no default model.
The text to generate audio for. Maximum 4096 characters; a model can set a lower limit, see its details.
Voice selector. Pass a voice name from the model's details, such as eve for grok-tts, or an object like { "id": "voice-id" } for models that accept voice IDs.
Voice ID for models that list this parameter, such as speech-2.8-turbo.
Optional style or delivery instructions, up to 2000 characters, for models that list this parameter.
Optional speaking style prompt, up to 2000 characters, for models that list this parameter, such as qwen3-tts-1-7b-voicedesign.
Language code, such as en-US, for models that support it.
Audio format. Accepted values depend on the model: for example grok-tts returns mp3 only, and qwen3-tts-flash returns wav. Check the model's details before sending a value.
audioTokenLab delivery format: audio or sse. Send sse only when the model's details list it.
Speech speed for models that support it. TokenLab accepts 0.25 to 4.0; a model can narrow the range.
Sampling temperature from 0 to 2, for models that list this parameter.
Response
With stream_format=audio, the response contains audio bytes. Models that support stream_format=sse return a text/event-stream response; parse its events instead of saving the entire response as an audio file.
Request
curl -X POST "https://api.tokenlab.sh/v1/audio/speech" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-tts",
"voice": "eve",
"input": "Hello, welcome to TokenLab!"
}' \
--output speech.mp3Voice Samples
Voices depend on the model. Read the voice values in the model details from GET /v1/models/{model} before you send one. For example, grok-tts accepts eve, ara, rex, sal, and leo.
Response
<binary audio data>Important fields
HTTP response media type: the audio format, or text/event-stream for SSE.
Audio bytes for audio; an event stream for sse. Choose the parser using Content-Type and the requested mode.
MiniMax Speech 2.8 Turbo synthesizes a script in a selected voice with a speed-focused workflow, useful for responsive spoken interfaces and narration.
{
"model": "speech-2.8-turbo",
"input": "Welcome to TokenLab.",
"voice_id": "male-qn-qingse",
"speed": 1,
"response_format": "mp3",
"stream_format": "audio"
}Authorization
BearerAuth API Key authentication. Create or manage API keys in Dashboard > API > API Keys.
In: header
Headers
Per-request Delivery policy. Overrides the API key and Workspace defaults. Auto tries TokenLab Verified first and may switch once to Official only before output, request acceptance, or persistent resource creation.
Value in
- "auto"
- "verified"
- "official"
Request Body
application/json
Response
application/json
application/json
application/json
application/json
application/json
application/json