Speech
Text to speech
Turn text into natural speech with Gemini’s and ElevenLabs’ text-to-speech models, through OpenAI’s speech API: a voice you pick, and MP3, WAV or PCM back in a few seconds.
/v1/audio/speechElevenLabs’ models are priced on the text alone, by the character, and the audio is included:
Make speech
from openai import OpenAIclient = OpenAI(base_url="https://api.zurelay.com/v1", api_key="YOUR_ZURELAY_KEY")speech = client.audio.speech.create( model="gemini-3.1-flash-tts", voice="Kore", input="Your order has shipped and arrives on Friday.", instructions="Say it warmly, at a relaxed pace",)speech.write_to_file("shipped.mp3")Any OpenAI SDK works: point it at https://api.zurelay.com/v1 and call its speech method. The reply is the audio file itself.
An ElevenLabs model is called the same way, with one of its own voices and no instructions:
curl https://api.zurelay.com/v1/audio/speech \ -H "Authorization: Bearer $ZURELAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "eleven-v4", "voice": "Talia", "input": "Your order has shipped and arrives on Friday." }' -o shipped.mp3Parameters
modelstringrequired- A speech model ID from the table.
inputstringrequired- The text to speak, up to 5,000 characters. Split longer text into several requests.
voicestring- One of the model’s voices below, or an OpenAI voice name such as
alloyornova. DefaultKoreon Gemini’s models andTaliaon ElevenLabs’. A voice from the other lab is refused. instructionsstring- How to say it, in plain words:
Say cheerfully,Whisper, like a secret,Read slowly, like a bedtime story. Up to 2,000 characters. Not on Gemini 3.8 Flash TTS, which reads its text word for word, or on ElevenLabs’ models: a request with instructions is refused there. response_formatstringmp3(the default),wav, orpcm: raw 24 kHz, 16-bit, mono samples.speednumber- The pace, from
0.7to1.2, on Eleven Multilingual v2 and Eleven Flash v2.5. Eleven v4, v4 Turbo and v3 accept it but speak at their own pace. Gemini’s models accept only1: ask for the pace ininstructionsinstead. modelsarray- Smart routing for this request: other speech models to try, in order, if the model is down. See Smart routing.
Voices
Gemini’s models speak with these 30 voices:
Code written for OpenAI keeps working: its voice names map to a Gemini voice of a similar character.
ElevenLabs’ models speak with these 17 voices:
OpenAI’s voice names work on them too:
Style and pacing
- Describe the delivery the way you’d brief a voice actor: mood, pace, volume, accent.
- Keep the direction in
instructionsand only the words to say ininput, so the direction isn’t read out. - The language is picked up from the text, so a Spanish sentence is spoken in Spanish.
- Gemini 3.8 Flash TTS takes no
instructions: it reads every word ofinputaloud. Write Google’s vocal tags into the text where the sound belongs, such as<laugh>,<sigh>,<breath>or<short pause>. - ElevenLabs’ models take no
instructionseither. On Eleven v4, v4 Turbo and v3, write ElevenLabs’ audio tags into the text in square brackets, such as[laughs],[whispers],[sighs]or[excited]. The tags count as characters of text.
Paying for speech
ElevenLabs’ models are billed on the characters of text you send, spaces, punctuation and audio tags included, at the price per 1,000 characters in their table. The audio is included, whatever its length. A minute of speech is about 850 characters. On these models x-zurelay-input-tokens is the number of characters billed and x-zurelay-output-tokens is 0.
Gemini’s speech is billed on tokens: the text you send at the input price, and the audio you get back at the output price. Each second of audio is a set number of tokens, which the table lists for each model, so its last column is what a minute costs. Each reply says what it was billed on in its x-zurelay-input-tokens and x-zurelay-output-tokens headers, and every request is in your request log. Requests that fail cost nothing. Speech stays on the model you asked for, even with automatic smart routing. Only your own rules or a request’s models list can have another speech model answer when it’s down: x-zurelay-model names it, and it’s billed at its price.
Try voices and styles in the dashboard’s Playground.
Questions, or something missing? Ask our support team and we’ll answer by email, usually within a minute.