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.mp3

Parameters

  • model (string, required) — tts-1, tts-1-hd, eleven_v3, gpt-4o-mini-tts, gemini-2.5-flash-preview-tts
  • input (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, Aoede
  • speed (number, optional) — 0.25–4.0 (OpenAI models only)
  • response_format (string, optional) — mp3, opus, aac, flac (OpenAI only). ElevenLabs always returns audio/mpeg; Gemini always returns audio/wav.
  • stability (number, optional) — ElevenLabs only. 0.0–1.0, defaults to 0.5. Lower values are more expressive, higher values are more consistent.
  • similarity_boost (number, optional) — ElevenLabs only. 0.0–1.0, defaults to 0.5. Higher values stick closer to the cloned voice.
  • with-timestamps (boolean, optional) — ElevenLabs only. If true, 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_format you set, ElevenLabs returns audio/mpeg (or JSON when with-timestamps is true), Gemini returns audio/wav (24 kHz mono PCM in a WAV container).
  • ElevenLabs caps input at 4,096 characters. Longer text must be chunked client-side.
  • Keep text chunks moderate if you need responsive playback.