Learning resourcesReviewed · OpenRouter

OpenRouter Python text-to-speech reference

OpenRouter's Python text-to-speech reference helps developers add generated speech to applications, but available controls depend on the chosen model and provider. It documents speech requests, audio responses, multiple-speaker input, reference-based voice features and routing options.

Researched 15 Nov 2026

In short.

OpenRouter's Python text-to-speech reference helps developers integrate generated speech, with model-specific support as its main constraint. It explains the create_speech operation, required inputs, optional voice and delivery controls, provider routing and error types. Installation instructions, SDK version, pricing and usage rights are not established by this page. No code was executed or audio assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete selected page at [https://openrouter.ai/docs/client-sdks/python/sdks/tts/README.md], including its example, parameter support notes, response type and error table. The linked documentation index, component definitions, retry configuration and other pages are excluded. No code was executed, audio generated, provider behavior verified or performance measured. Installation, prices and rights remain unknown where the page supplies no evidence.

The overview

identity

This is the OpenRouter Python SDK reference for tts.create_speech at [https://openrouter.ai/docs/client-sdks/python/sdks/tts/README.md]. It documents one operation that synthesizes speech and returns an audio response.

assessment

The page is useful for constructing a speech request and identifying which options need model-specific confirmation. Its parameter and error tables provide integration detail, but its example stops at printing the response. It is insufficient on its own for choosing a model by audio quality, cost or latency.

users

The reference suits Python developers adding narration, spoken responses or supported multi-speaker dialogue to an application. Beginners get a short request example, while experienced developers get routing, retry and tracing parameters. Familiarity with Python client libraries, API credentials and handling audio responses is assumed.

capabilities

Requests require input and a model identifier. Optional controls include a provider-specific voice, output format, playback speed and delivery instructions. The create_speech description names MP3, PCM and WAV as example formats, without mapping format support to individual models.

Input can also contain turns with separate text, voices and instructions. The page limits multi-speaker support to Gemini TTS, Fish Audio models other than S1, and Speechify dialogue models. Reference inputs support documented voice-cloning or voice-design modes: audio mode accepts one to three clips, each with an optional transcript, plus at most one optional scene image on providers that condition the cloned voice on its setting; image mode accepts exactly one image reference. Routing is restricted to endpoints supporting the submitted reference features.

Using it

requirements

The example uses Python, imports OpenRouter from openrouter and reads an API key from OPENROUTER_API_KEY. A model identifier and input are mandatory; a voice is optional in the parameter table. The page does not specify package installation, supported Python versions, the SDK version or model-access requirements.

mechanism

The client sends a speech request and returns an httpx.Response containing raw audio in the requested format. Provider settings expose routing preferences through order, only, ignore and allow_fallbacks, alongside data-policy preferences named zdr and data_collection. Their detailed semantics are not explained here.

The page states that session_id and user are used for Broadcast and private logging and are never sent to the provider. Session identifiers have a 256-character maximum, and a body value overrides the x-session-id header. Trace metadata supports named tracing fields and additional metadata forwarded to configured Broadcast destinations.

setup

Following the example requires making the OpenRouter client available, supplying OPENROUTER_API_KEY, creating the client in a context manager and calling its tts.create_speech method. Application URL, display-name and category headers are optional metadata. Installation commands and audio-saving or playback steps are absent.

example

The documented request is open_router.tts.create_speech(input="Hello world", model="mistralai/voxtral-mini-tts-2603", response_format="pcm", speed=1.0, voice="en_paul_neutral"). It requests PCM audio and prints the returned response object. The page provides no resulting audio or execution output, and this request was not run.

Assessment & evidence

limitations

Delivery instructions are documented for OpenAI gpt-4o-mini-tts, Gemini TTS and Fish Audio models and are ignored by other providers. Speed works only where supported; other providers may ignore it or return status 400 for a non-default value. A shared parameter therefore does not guarantee shared behavior.

Supported languages, numerical input limits, pronunciation quality, latency and throughput are not established. Listed failures include authentication, payment, oversized payloads, rate limits, provider overload and network timeouts. No runtime or listening assessment was performed.

reasoning

The documented common request interface suggests a convenient integration point for applications considering several speech providers. The practical tradeoff is that an application must still account for differing feature support: selecting a voice, delivery instruction or speed value does not establish that every routed model will honor it.

alternatives

Within the documented interface, model choice offers different feature combinations. The page names OpenAI, Gemini, Fish Audio and Speechify models in support notes and uses a Mistral model in its example. It provides no comparative quality, latency or pricing evidence and does not assess alternative SDKs or services.

evidence

The source is the complete documentation page captured as selected-page.txt from [https://openrouter.ai/docs/client-sdks/python/sdks/tts/README.md]. It contains an example, parameter descriptions, a response type and an error table. These establish documented behavior, not independently observed execution or audio quality. Linked component definitions, the documentation index and other pages are outside the available evidence.

Access & freshness

costs

Prices, billing units, free allowances, minimum balance and provider-specific charges are unknown from this page. The error table includes PaymentRequiredResponseError with status 402, but that does not establish a price or billing arrangement.

rights

The page does not state documentation or SDK licenses, commercial-use terms for generated audio, or permissions governing reference audio and images. Those rights remain unknown from the supplied evidence.

freshness

The page was captured on 15 November 2026 at 11:13:59 UTC. It supplies no publication date, SDK release version or update history. Model availability and provider behavior after that capture are unknown.

actions

Before adopting the API, confirm installation requirements, model availability, pricing and usage rights. Match the intended voice, format, instructions and reference inputs to documented model support. Then verify audio handling and relevant error responses in your application; the supplied example does not demonstrate those outcomes.

Evidence for this report

selected-page.txtselected · checked 2026-11-15