Skip to main content
OpenRouter supports text-to-speech (TTS) via a dedicated /api/v1/audio/speech endpoint that is compatible with the OpenAI Audio Speech API. Send text and receive a raw audio byte stream in your chosen format.

Model Discovery

You can find TTS models in several ways:

Via the API

Use the output_modalities query parameter on the Models API to discover TTS models:

On the Models Page

Visit the Models page and filter by output modalities to find models capable of speech synthesis. Look for models that list "speech" in their output modalities.

API Usage

Send a POST request to /api/v1/audio/speech with the text you want to synthesize. The response is a raw audio byte stream — not JSON — so you can pipe it directly to a file or audio player.

Basic Example

Request Parameters

When voice is omitted, OpenRouter only forwards the request to providers whose adapter supports a provider-side default voice. For other providers, the request is rejected with a validation error.

Voice Cloning

Some models support stateless voice cloning: you send a short sample of reference audio directly with the TTS request, and the generated speech mimics that voice. No separate voice-creation or upload step is required. Pass the reference audio as a base64 input_audio part in input_references (a data:audio/...;base64, URI also works), and optionally include its transcript as a text part:
Note: some providers for a voice-cloning model may not support voice cloning — check the supports_voice_cloning field on the endpoints API. Limits and requirements:
  • Supported audio formats for the reference sample are provider-specific.
  • input_references accepts at most one input_audio part and one text part, and requires input_audio.
  • The reference audio is limited to 20 MiB of base64 (15 MiB of decoded audio); larger requests are rejected with a 400.

Provider-Specific Options

You can pass provider-specific options using the provider parameter. Options are keyed by provider slug, and only the options for the matched provider are forwarded:

Azure (MAI-Voice-2)

Azure TTS uses SSML internally, but this is fully abstracted — you only need the standard parameters. The voice parameter takes an Azure voice name (e.g., en-US-Harper:MAI-Voice-2), and speed is supported (range: 0.5–2.0). For expressive synthesis, pass style and optionally styledegree via provider options:

Response Format

The TTS endpoint returns a raw audio byte stream, not JSON. The response includes the following headers:

Output Formats

Pricing

TTS models are priced per character of input text. Pricing varies by model and provider. You can check the per-character cost for each model on the Models page or via the Models API.

OpenAI SDK Compatibility

The TTS endpoint is fully compatible with the OpenAI SDK. You can use the OpenAI client libraries by pointing them at OpenRouter’s base URL:

Best Practices

  • Choose the right format: Use mp3 for storage and general playback. Use pcm for real-time streaming pipelines where latency matters
  • Voice selection: Different providers offer different voices. Check the model’s documentation or experiment with available voices to find the best fit for your use case
  • Input length: For very long texts, consider splitting the input into smaller segments and concatenating the audio output. This can improve reliability and reduce latency for the first audio chunk
  • Speed parameter: The speed parameter is only supported by certain providers (e.g., OpenAI). It is silently ignored by providers that don’t support it

Troubleshooting

Empty or corrupted audio file?
  • Verify the response_format matches how you’re saving the file (e.g., don’t save pcm output with a .mp3 extension)
  • Check the response status code — non-200 responses return JSON error bodies, not audio
Model not found?
  • Use the Models page to find available TTS models
  • Verify the model slug is correct (e.g., openai/gpt-4o-mini-tts-2025-12-15, not gpt-4o-mini-tts)
Voice not available?
  • Available voices vary by provider. Check the provider’s documentation for supported voice identifiers
  • Each model has its own set of voices — check the model’s page on the Models page for the full list