# GPT-4o mini TTS API on TokenRa Model ID: `gpt-4o-mini-tts` Get an API key: https://tokenra.io/register?utm_source=llms-agent&utm_medium=model-llms Updated: 2026-12-02 > GPT-4o mini TTS is OpenAI's text-to-speech model served on TokenRa. Send JSON to POST /v1/audio/speech and the response body is the audio file itself. Steer the tone with `instructions`, or set `stream_format` to `sse` to receive audio chunks as they are generated. Input text costs $0.9 per million tokens and generated audio $31.5 per million audio tokens. - Provider: OpenAI - Type: Text-to-speech - Input: JSON with the text to speak (up to 4096 characters) - Output: Audio file (mp3, opus, aac, wav, pcm) or an SSE stream - Mode: Synchronous, or SSE stream ## Pricing - Input text: $0.9 per million tokens - Generated audio: $31.5 per million audio tokens - A normal call counts 1000 audio tokens per minute of speech, rounded up to the next second, so one minute costs about $0.03 - With `stream_format` set to `sse`, the token count the upstream reports in the final event is billed instead - Example: 9 input tokens and 4 seconds of speech = 9 x $0.9/M + 67 x $31.5/M, about $0.0021 ## Capabilities & endpoints - `POST https://tokenra.io/v1/audio/speech`: Generate speech. Send application/json. Returns the audio file, or Server-Sent Events when `stream_format` is `sse`. ## Parameters - `model` (required): Must be `gpt-4o-mini-tts`. - `input` (required): Text to speak, up to 4096 characters. Longer text returns 400. - `voice` (required): One of alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse, marin, cedar. - `instructions` (optional): Free-text direction for tone, pace, accent or emotion. - `response_format` (optional): One of `mp3` (default), `opus`, `aac`, `wav`, `pcm`. - `speed` (optional): 0.25 to 4.0. Default 1. - `stream_format` (optional): Set to `sse` to stream Server-Sent Events. ## Streaming Each `speech.audio.delta` event carries a base64 audio chunk in `audio`. The stream ends with a `speech.audio.done` event whose `usage` holds `input_tokens`, `output_tokens` and `total_tokens`. ## Errors - 400: missing `input` or `voice`, unknown voice, `speed` outside 0.25-4.0, input over 4096 characters, or unsupported `response_format`. - 401: invalid or missing API key. - 403: balance too low, or the token has no access to `gpt-4o-mini-tts`. - 503: no available channel for the model in your group. ## Example ```bash curl https://tokenra.io/v1/audio/speech \ -H "Authorization: Bearer $TOKENRA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "gpt-4o-mini-tts", "input": "Today is a wonderful day to build something people love!", "voice": "coral", "instructions": "Speak in a cheerful and positive tone.", "response_format": "mp3"}' \ --output speech.mp3 ```