Native streaming STT (WebSocket)
/v1/sttOpens 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.
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 |
Router VAD supplies turn_detection=acoustic only for OpenAI realtime
Whisper and Cartesia ink-whisper. 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 (AsyncAPI spec: /asyncapi.yaml).
Authorization
BearerAuth Tenant key supplied as the Authorization Bearer token.
In: header
Query Parameters
Use a specific STT provider.
Value in
- "deepgram"
- "elevenlabs"
- "soniox"
- "assemblyai"
- "fish"
- "groq"
- "grok"
- "cartesia"
- "together"
- "openai"
- "gemini"
- "fal"
- "cloudflare"
- "qwen"
- "inworld"
- "amazon"
- "sprag"
Model id: bare name (nova-3) or {author}/{modelName} slug (deepgram/nova-3). Required — a missing value is refused 400 model_required; the router applies no default model.
Expected language.
Actual raw mono audio bytes sent by the client. The router maps this declaration to the provider's native parameters but never resamples or transcodes.
Value in
- "pcm_8000"
- "pcm_16000"
- "pcm_22050"
- "pcm_24000"
- "pcm_44100"
- "pcm_48000"
- "ulaw_8000"
Input channel count. Defaults to mono (1).
1 <= value1auto uses provider segmentation or reviewed router VAD; manual requires stt.audio.commit.
"auto"Value in
- "auto"
- "manual"
Automatic detector intent. Explicit acoustic/semantic requests fail if unsupported.
"auto"Value in
- "auto"
- "acoustic"
- "semantic"
Trailing silence used for automatic acoustic segmentation.
0 <= valueMinimum speech duration before activation.
0 <= valueMinimum silence duration before a boundary.
0 <= valueMaximum wait for a provider turn/endpoint decision.
0 <= valuePortable speech/VAD threshold.
0 <= value <= 1Portable semantic end-of-turn threshold.
0 <= value <= 1Predictive eager-end threshold; predictive boundaries remain opt-in.
0 <= value <= 1Request mutable transcript hypotheses. There is no global default: when omitted, the selected model family's own behavior applies (false for Deepgram Flux, true elsewhere). The resolved value is echoed in stt.session.started.input_config.interim_results.
Request provider timestamps.
Request provider language detection metadata.
Repeated speech-recognition keyterms.
Recognition context or prompt.
Request speaker diarization.
Request provider-native transcript formatting.
Request filler/disfluency words when supported.
Server/client event grammar. normalized is the default sequenced stt.* contract; provider forwards the selected provider's frames without mapping, rewriting, deduplication, or router-generated JSON events. Provider mode requires a direct upstream realtime WebSocket.
"normalized"Value in
- "normalized"
- "provider"
Comma-separated or repeated provider IDs in preferred order. Providers not listed remain eligible.
Comma-separated or repeated provider IDs. Only these providers may serve the request.
Comma-separated or repeated provider IDs that must not serve the request.
Set to false to prevent fallback to another provider. Automatic provider retries are not currently supported.
Provider-specific options in bracket notation, such as provider_options[encoding]=linear16. Provider-native names are accepted only inside this namespace; unknown bare query parameters are rejected.
Header Parameters
Must be websocket to perform the protocol upgrade.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
import { readFile } from "node:fs/promises";import WebSocket from "ws";const audioChunk = await readFile("chunk.pcm");const ws = new WebSocket("wss://api.allmodels.io/v1/stt?provider=deepgram&model=deepgram/nova-3&audio_format=pcm_16000&event_format=normalized", { headers: { Authorization: `Bearer ${process.env.ALLMODELS_API_KEY}` }});ws.on("open", () => { ws.send(audioChunk); ws.send(JSON.stringify({ type: "stt.audio.commit" }));});ws.on("message", (data, isBinary) => { if (isBinary) process.stdout.write(data); else console.log(JSON.parse(data.toString()));});ws.on("error", console.error);import asyncioimport base64import jsonimport osfrom pathlib import Pathimport websocketsasync def main(): async with websockets.connect( "wss://api.allmodels.io/v1/stt?provider=deepgram&model=deepgram/nova-3&audio_format=pcm_16000&event_format=normalized", additional_headers={"Authorization": f"Bearer {os.environ['ALLMODELS_API_KEY']}"}, ) as socket: await socket.send(Path("chunk.pcm").read_bytes()) await socket.send(json.dumps({"type": "stt.audio.commit"})) async for message in socket: print(message if isinstance(message, str) else f"{len(message)} audio bytes")asyncio.run(main())curl --http1.1 -i "https://api.allmodels.io/v1/stt?provider=deepgram&model=deepgram/nova-3&audio_format=pcm_16000&event_format=normalized" \ -H "Authorization: Bearer $ALLMODELS_API_KEY" \ -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" \ -H "Sec-WebSocket-Key: SGVsbG9BbGxNb2RlbHMhIQ=="{ "error": "invalid_model", "provider": "soniox", "model": "bogus", "supported": [ "stt-rt-v5" ]}{ "error": "missing_api_key"}{ "error": "provider_not_allowed", "tried": [ "deepgram", "soniox", "assemblyai" ]}{ "error": "model_not_priced", "provider": "deepgram", "model": "flux-general-en"}{ "error": "websocket_upgrade_required"}{ "error": "auth_not_initialized"}Native streaming TTS (WebSocket) GET
Opens a WebSocket using the selected provider's text-to-speech protocol. The request must include `Upgrade: websocket`.
OpenAI SDK-compatible speech POST
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.
