Documentation
Text-to-Speech
POST /v1/audio/speech converts text into spoken audio.
Use it when
- You need voice playback in an app
- You want narration, announcements, or assistant voice output
Code examples
1curl -X POST https://api.navy/v1/audio/speech \
2 -H "Authorization: Bearer sk-navy-YOUR_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "gpt-4o-mini-tts",
6 "voice": "alloy",
7 "input": "Welcome to the NavyAI platform."
8 }' \
9 --output speech.mp3Parameters
model(string, required) —tts-1,tts-1-hd,eleven_v3,gpt-4o-mini-tts,gemini-2.5-flash-preview-ttsinput(string, required) — Text to convert (max 4096 chars for ElevenLabs)voice(string, required) — Voice ID. OpenAI:alloy,ash,coral,echo,fable,nova,onyx,sage,shimmer. ElevenLabs:alice,aria,bill,brian,callum,charlie,charlotte,chris,daniel,eric,george,jessica,laura,liam,lily,matilda,river,sarah,will. Gemini:Puck,Charon,Kore,Fenrir,Aoedespeed(number, optional) — 0.25–4.0 (OpenAI models only)response_format(string, optional) —mp3,opus,aac,flac(OpenAI only). ElevenLabs always returnsaudio/mpeg; Gemini always returnsaudio/wav.stability(number, optional) — ElevenLabs only. 0.0–1.0, defaults to0.5. Lower values are more expressive, higher values are more consistent.similarity_boost(number, optional) — ElevenLabs only. 0.0–1.0, defaults to0.5. Higher values stick closer to the cloned voice.with-timestamps(boolean, optional) — ElevenLabs only. Iftrue, returns JSON with per-character timestamps instead of raw audio. Useful for karaoke-style highlights.
Notes
- Response content-type depends on the provider: OpenAI uses the
response_formatyou set, ElevenLabs returnsaudio/mpeg(or JSON whenwith-timestampsis true), Gemini returnsaudio/wav(24 kHz mono PCM in a WAV container). - ElevenLabs caps
inputat 4,096 characters. Longer text must be chunked client-side. - Keep text chunks moderate if you need responsive playback.