allmodels.ioDocs
API ReferenceOpenAI SDK

OpenAI SDK-compatible speech

Generates speech with the official OpenAI SDK. Set the client's base URL to `https://api.allmodels.io/oai` and use your AllModels API key. Use `stream_format=audio` for audio bytes or `stream_format=sse` for OpenAI speech events. Use `provider_options` for provider-specific settings. You can also pass supported options directly as query parameters. If both forms set the same option, `provider_options[<name>]=<value>` takes precedence. Recognized enum and boolean option values are case-insensitive and are normalized to each provider's wire spelling; free-form values such as prompts, keyterms, and voice IDs retain their original case.

POST/oai/audio/speech

Generates speech with the official OpenAI SDK. Set the client's base URL to https://api.allmodels.io/oai and use your AllModels API key. Use stream_format=audio for audio bytes or stream_format=sse for OpenAI speech events.

Use provider_options for provider-specific settings. You can also pass supported options directly as query parameters. If both forms set the same option, provider_options[<name>]=<value> takes precedence. Recognized enum and boolean option values are case-insensitive and are normalized to each provider's wire spelling; free-form values such as prompts, keyterms, and voice IDs retain their original case.

Authorization

BearerAuth
AuthorizationBearer <token>

Tenant key supplied as the Authorization Bearer token.

In: header

Query Parameters

provider_order?array<string>

Comma-separated or repeated provider IDs in preferred order. Providers not listed remain eligible.

provider_only?array<string>

Comma-separated or repeated provider IDs. Only these providers may serve the request.

provider_ignore?array<string>

Comma-separated or repeated provider IDs that must not serve the request.

allow_fallbacks?boolean

Set to false to prevent fallback to another provider. Automatic provider retries are not currently supported.

provider_options?|||||||||||

Provider-specific options in bracket notation, such as provider_options[encoding]=linear16. You can also pass supported options directly as query parameters. If both forms set the same option, the bracketed value takes precedence.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

Client
Language
import { writeFile } from "node:fs/promises";import OpenAI from "openai";const client = new OpenAI({  apiKey: process.env.ALLMODELS_API_KEY,  baseURL: "https://api.allmodels.io/oai"});const response = await client.audio.speech.create({  model: "elevenlabs/eleven-turbo-v2-5",  voice: "pNInz6obpgDQGcFmaJgB",  input: "Hello from AllModels",  response_format: "mp3"});await writeFile("speech.mp3", Buffer.from(await response.arrayBuffer()));
"string"
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}

Native streaming STT (WebSocket) GET

Opens a WebSocket and emits normalized streaming speech-to-text events. The request must include `Upgrade: websocket`. Stream binary audio and use `stt.audio.commit`, `stt.audio.clear`, and `stt.session.close` controls. Server events share a sequenced `stt.*` envelope. Transcript updates remain separate from a unified flat `stt.signal` event whose state is `started`, `end_candidate`, `resumed`, or `end`. Optional `turn_scope` preserves utterance-versus-turn meaning; it is distinct from transcript-final `scope`. Only signals explicitly supplied by the selected provider are surfaced. Use `event_format=provider` for provider-native passthrough in both directions. Provider-mode server frames are forwarded without signal mapping, timestamp rewriting, deduplication, or router-generated JSON events. This mode requires a direct upstream realtime WebSocket; router-buffered Groq and Fal relays reject it because no provider event stream exists. `audio_format` is required and describes the unchanged raw bytes. No resampling, transcoding, or FFmpeg occurs in the streaming path. Portable flat parameters control commits, turn detection, VAD thresholds, partials, timestamps, language detection, keyterms/context, diarization, formatting, and filler words. Unknown bare parameters are rejected. Put provider-native names under `provider_options[<name>]`; native overrides win except that conflicting encoding/sample-rate/channel declarations return `conflicting_audio_format`. Portable input mapping: | Family | Default automatic behavior | Native translation / fallback | |---|---|---| | Deepgram Nova | acoustic endpointing | `endpointing`, `utterance_end_ms`, `vad_events` | | Deepgram Flux | semantic turns | `eot_threshold`, `eager_eot_threshold`, `eot_timeout_ms` | | ElevenLabs Scribe realtime | provider VAD | `commit_strategy=vad`, `vad_*`, `min_*` | | Soniox realtime | acoustic endpointing | `enable_endpoint_detection`, `max_endpoint_delay_ms` | | AssemblyAI streaming | provider turn detection | model-specific turn silence/confidence fields | | xAI Grok | acoustic; semantic when requested | `endpointing` or Smart Turn fields | | Cartesia ink-2 | semantic turns | `stream_mode=turns`; manual selects `manual` | | Cartesia ink-whisper | acoustic router VAD | no provider turn detector; router VAD segments the stream | | OpenAI transcription | server VAD | nested `turn_detection` session object | | OpenAI realtime Whisper | acoustic router VAD | provider detector disabled; router sends native commits | | Together | provider VAD | `threshold`, `min_silence_duration_ms`, `min_speech_duration_ms` | | Groq / Fal buffered relays | acoustic router VAD | router inspects declared little-endian PCM and commits without modifying bytes | Router VAD supplies `turn_detection=acoustic` only for OpenAI realtime Whisper, Cartesia `ink-whisper`, and the buffered Groq/Fal relays. Deepgram Flux has no router-VAD path — its client grammar carries no commit frame — so it serves semantic turn detection only and rejects `turn_detection=acoustic` with `unsupported_stt_option`. Each model family advertises only the portable options it can translate to a native parameter; an explicit option outside that set fails before audio with `unsupported_stt_option` rather than riding along as a silent no-op. Omitted options fall back to the family's own behavior — `interim_results`, for example, has no global default. Router VAD can create transcript commits but never manufactures provider-originated `stt.signal` events, and the signals a session may emit are fixed by the `capabilities` object echoed in `stt.session.started`. Authentication failures close the connection with code `4401` or `4403`. The message-level protocol is documented at [the realtime WebSocket reference](/realtime-reference) (AsyncAPI spec: [/asyncapi.yaml](/asyncapi.yaml)).

OpenAI SDK-compatible transcription POST

Transcribes an uploaded audio file with the official OpenAI JavaScript or Python SDK. Set `stream=true` only when the selected model supports streaming transcription. Use `provider_options` for provider-specific settings. You can also pass supported options directly as query parameters. If both forms set the same option, `provider_options[<name>]=<value>` takes precedence. Recognized enum and boolean option values are case-insensitive and are normalized to each provider's wire spelling; free-form values such as prompts, keyterms, and voice IDs retain their original case.