Skip to main content

Telnyx Voice: STT — Full Documentation

Complete page content for STT (Voice section) of the Telnyx developer docs (https://developers.telnyx.com). Root index: https://developers.telnyx.com/llms.txt · Lightweight index for this subsection: https://developers.telnyx.com/development/llms/voice-stt-llms-txt.md

Overview

Source: https://developers.telnyx.com/docs/voice/stt/overview.md
Telnyx STT transcribes audio to text in three ways: Stream audio over a persistent WebSocket connection. Real-time partial and final transcripts. Upload audio files via REST API. OpenAI-compatible endpoint. Enable transcription during live voice calls via Call Control or TeXML.

Quickstart

Source: https://developers.telnyx.com/docs/voice/stt/getting-started.md

Prerequisites

That’s it. No other setup required. Real-time transcription over a persistent connection. Send audio, get partial and final transcripts back as they happen. Install:
main.py:
Run it:
Install:
index.js:
Run it:

Example output

Upload an audio file and get the full transcript back. The endpoint is OpenAI SDK compatible — swap base_url and api_key and your existing code works. Install:
main.py:
Run it:
Install:
index.js:
Run it:
Or transcribe from a URL (no file upload needed):

Example response

For segment- or word-level timestamps, use model="deepgram/nova-3" with response_format=verbose_json. The Whisper models (openai/whisper-large-v3-turbo, openai/whisper-tiny) return text only.

What’s next


Models

Source: https://developers.telnyx.com/docs/voice/stt/models.md

Comparison

Engine Details

The default WebSocket engine. Best English accuracy and the richest feature set. For REST, you must explicitly set model="deepgram/nova-3" — the REST default is openai/whisper-large-v3-turbo. Models:
  • nova-3 — Latest and most accurate. Supports diarization, word-level timestamps, smart formatting, numerals, and punctuation via model_config. Use this unless you need the lowest possible latency.
  • nova-2 — Previous generation. Still supported but nova-3 is better in all benchmarks.
  • flux — Purpose-built for voice agents. Lowest latency with built-in end-of-turn detection — tells you when the speaker has finished so your agent can respond. WebSocket only.
Languages: 40+ languages across Deepgram models. Nova-3 supports multi mode (10 languages with code-switching). Flux supports English, Spanish, French, German, Hindi, Russian, Portuguese, Japanese, Italian, and Dutch. See Deepgram languages. Telnyx runs Whisper models on-network. Models:
  • openai/whisper-large-v3-turbo — Multilingual (50+ languages, auto-detected). Returns text only — no timestamps regardless of response format.
  • openai/whisper-tiny — Lightweight, lowest resource usage.
Languages: 50+ languages, auto-detected. Use auto_detect to skip the language hint. See the Whisper language list. Limitations: No diarization. No word-level timestamps. Google Cloud Speech-to-Text integration. Model: latest_long Languages: 125+ languages/locales. See Google Cloud STT languages. Microsoft Azure Speech Services integration. Model: azure/fast Languages: 100+ languages/locales with strong accent and dialect coverage. See Azure Speech languages. xAI Grok STT integration for real-time transcription. Model: xai/grok-stt Languages: 25 languages, including Arabic, English, French, German, Hindi, Japanese, Korean, Portuguese, Spanish, and Vietnamese. AssemblyAI Universal-Streaming integration for real-time voice agent transcription. Model: assemblyai/universal-streaming Languages: English, Spanish, German, French, Portuguese, and Italian. Speechmatics real-time transcription integration with high accuracy and multilingual support including bilingual packs. Model: speechmatics/standard Languages: English, Spanish, plus bilingual/multilingual packs including Arabic–English, Mandarin–English, English–Malay, English–Tamil, Tagalog, and Spanish–English bilingual. Also supports Basque, Galician, Irish, Maltese, Mongolian, Swahili, Uyghur, and Welsh. Features: Supports interim results (partial transcripts) and graceful CloseStream shutdown. Soniox real-time transcription integration with automatic language detection. Model: soniox/stt-rt-v4 Languages: Automatic detection — no language hint required. Features: Supports interim results (partial transcripts), endpointing, and graceful CloseStream shutdown. Self-hosted NVIDIA Parakeet integration for multilingual transcription with automatic language detection. Model: nvidia/parakeet-v3 Languages: Automatic detection — no language hint required. Features: Final transcripts only — no interim/partial results. Ignores endpointing. Accepts linear16/linear32 (16 kHz) audio only.

How to Choose

Need the highest accuracy for English? → Deepgram nova-3 — best WER (word error rate) across all English variants. Building a voice agent that needs to know when the user stopped talking? → Deepgram flux — lowest latency with built-in end-of-turn detection. Need to transcribe files in 50+ languages? → Telnyx openai/whisper-large-v3-turbo via REST API. Need diarization (who said what)? → Deepgram nova-3 with model_config.diarize: true. Need broad accent/dialect support? → Azure azure/fast — strong coverage across regional accents. Need Grok STT for real-time calls? → xAI xai/grok-stt via WebSocket or Voice API. Need low-latency streaming for voice agents? → AssemblyAI assemblyai/universal-streaming via WebSocket or Voice API. Need high-accuracy multilingual with bilingual packs? → Speechmatics speechmatics/standard via WebSocket or Voice API. Need real-time transcription with automatic language detection? → Soniox soniox/stt-rt-v4 via WebSocket or Voice API. Need self-hosted multilingual transcription with automatic language detection? → Parakeet nvidia/parakeet-v3 via WebSocket or Voice API.

Specifying the Engine and Model

WebSocket — set via query parameters:
REST API — set via the model body parameter:

Migration

Source: https://developers.telnyx.com/docs/voice/stt/migration.md
Most migrations require changing 2–3 lines of code. Pick your current provider below.

WebSocket

The wire protocol is the same — send binary audio frames, receive JSON transcripts. What changes Response field mapping

REST

What changes Response field mapping

WebSocket

The wire protocol is the same — send binary audio frames, receive JSON transcripts. Config mapping Response field mapping

REST

What changes Response shape: identical. Telnyx returns the same {"text": "..."} shape — no parsing changes needed.

REST

The easiest migration — Telnyx REST is OpenAI SDK compatible. Change the API key and base URL, everything else stays the same.
Python
JavaScript
What changes Response shape: Telnyx returns the same {"text": "..."} shape — no parsing changes needed for the default json response format. Note on verbose_json: OpenAI’s Whisper API returns segments with timestamps when you set response_format=verbose_json. Telnyx’s Whisper models (openai/whisper-large-v3-turbo, openai/whisper-tiny) return text only — no segments. If you need timestamps, switch to model="deepgram/nova-3" which supports segment- and word-level timestamps via model_config.

WebSocket

Google uses gRPC with protobuf. Telnyx uses WebSocket with JSON — no protobuf compilation, no service account credentials.
See the Quickstart for full WebSocket code. Config mapping What you drop: protobuf definitions, gRPC client setup, service account credentials. Response field mapping

WebSocket

AWS Transcribe Streaming uses HTTP/2 with event streams via the amazon-transcribe-streaming-sdk. Telnyx uses a plain WebSocket — no AWS SDK, no SigV4 signing, no IAM credentials.
Send binary audio frames, receive JSON transcripts. No AWS SDK, no SigV4 signing, no IAM. See the Quickstart for full code. Config mapping Response field mapping

WebSocket

The Azure Speech SDK wraps a region-specific WebSocket with SDK abstractions and event handlers. Telnyx uses a plain WebSocket — no SDK install, no region routing.
Send binary audio frames, receive JSON transcripts. No SDK install, no region routing. See the Quickstart for full code. Config mapping Response field mapping What you drop: Azure Speech SDK install, region routing, event-handler boilerplate, subscription key management.

REST

What changes Response field mapping

WebSocket

Lifecycle

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming.md
Real-time speech-to-text over a persistent WebSocket connection. Send audio, receive transcripts.

Endpoint

Connection Lifecycle

1. Handshake

The connection starts as an HTTP GET with Upgrade: websocket. The server responds with 101 Switching Protocols, then the connection upgrades to WebSocket frames.
You can also connect directly to the WebSocket endpoint without an HTTP upgrade:
The same query parameters apply. Once connected, the message protocol is identical. All configuration is set at connect time via query parameters — engine, model, format, language, options. Cannot be changed mid-session. See Parameters for the full list. Invalid parameters return a JSON error and the connection closes.

2. Streaming

Once connected, audio and transcription flow concurrently — no request/response pairing. Client → Server Server → Client See Messages for the complete wire protocol reference.

3. Teardown

Send {"type": "CloseStream"} (Deepgram, Speechmatics, and Soniox) to flush remaining audio and close gracefully. The server finishes processing, sends any remaining transcripts, then closes the WebSocket.
For other engines, close the WebSocket connection directly. Dropping the connection without CloseStream works but may lose buffered audio on Deepgram, Speechmatics, and Soniox. See Examples for complete code samples.

Overview

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters.md
All parameters are passed as query string values on the WebSocket URL. Locked at connection time — cannot be changed mid-session. Deepgram, Telnyx, Google, Azure, xAI, AssemblyAI, Speechmatics, Soniox, Parakeet See Engines & Models See Audio Formats Hz. Required for raw encodings (linear16, mulaw, alaw). Ignored for container formats. Invalid value returns error 40005. Language code or auto-detect behavior varies by engine. See Language for details. "true" for partial transcripts. See Interim Results for details. Silence detection in ms for engines that support endpointing. "false" to disable. See Endpointing for details. PII redaction. Deepgram only. See Redaction for details. Comma-separated boost terms. Deepgram Nova-3/Flux. See Keyword Boosting for details. Legacy keyword boosting with intensifiers. Deepgram Nova. See Keyword Boosting for details. Azure Speech Services region. Flux only. Confidence threshold for EndOfTurn events. See End-of-Turn Detection for details. Flux only. Max silence before forcing EndOfTurn. See End-of-Turn Detection for details. Flux only. Speculative EagerEndOfTurn threshold. Disabled by default. See End-of-Turn Detection for details.

Example


Audio Formats

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/audio-formats.md
Set via the input_format query parameter. Audio is sent as binary WebSocket frames — chunked bytes, no base64, no JSON wrapping. Container formats (mp3, webm, etc.) are self-describing: the server demuxes the byte stream and extracts encoding/sample rate from headers. Raw formats have no metadata, so you must set sample_rate explicitly. Works for both real-time capture (microphone, MediaRecorder, telephony bridge) and file streaming (read a file in chunks, push through the socket).

Browser Capture

Output from MediaRecorder or similar browser APIs. Container headers carry sample rate.

Telephony

Codecs from voice networks. Raw frames, sample_rate required.
Invalid sample rate returns error 40005.

Raw PCM

Uncompressed audio from microphones, processing pipelines, or SDKs. sample_rate required.
Invalid sample rate returns error 40005.

Recorded File

Pre-recorded files read in chunks and streamed through the socket. Container headers carry sample rate.

Engine Compatibility

Unsupported format/engine combination returns error 40002. Unsupported Flux format returns error 40006. Deepgram has three model generations with different format support. Flux is the most restrictive of Deepgram’s models — it drops mp3, flac, webm_opus, amr_nb, amr_wb, g729, and speex compared to Nova. Universal formats (all engines and models): wav, linear16.

Engines & Models

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/engines-and-models.md
Set via transcription_engine and model query parameters.

Engines

Flux Model

Deepgram’s lowest-latency model with built-in end-of-turn detection. Designed for real-time voice agents. See Audio Formats for supported formats.

End-of-Turn Detection

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/end-of-turn.md
Deepgram Flux only. These parameters return a 400 error on non-Flux models. Flux uses a confidence-based system to decide when a speaker has finished their turn. Confidence threshold (0.50.9) for triggering an EndOfTurn event. Higher values require more certainty the speaker is done — fewer false positives but slightly more latency. Lower values respond faster but may cut speakers off mid-thought. Confidence threshold (0.30.9) for triggering an early EagerEndOfTurn event. Not set by default — setting it enables eager mode. When fired, your agent can start generating a response speculatively. If the speaker resumes, a TurnResumed event cancels it. Must be ≤ eot_threshold. Lower values = earlier triggers, more false starts. Typical range: 0.30.5 for ~150–250 ms latency savings at the cost of ~50–70% more LLM calls. Maximum silence in ms (50010000) before forcing EndOfTurn regardless of confidence. Resets when speech resumes. Increase for speakers who pause frequently; decrease for rapid-fire Q&A.

Event Flow

Without eager mode (eot_threshold only):
With eager mode (eager_eot_threshold set):

Configuration Profiles

Default — balanced for general use:
Low-latency — fast response, more false starts:
High-reliability — fewer interruptions, more latency:

Language

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/language.md
BCP-47 language code. Default: en-US.

Auto-Detection

Pass multi to enable automatic language detection. The aliases auto and auto_detect are silently mapped to multi.

Engine Support

Supported Languages

For most engines, Telnyx passes the language code directly without validation. The supported set depends on which engine you use. Speechmatics is the exception — Telnyx accepts shorthand codes for bilingual/multilingual packs and maps them to the provider’s language + domain configuration internally.

Common Codes


Interim Results

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/interim-results.md
Deepgram, Speechmatics, and Soniox. Other engines ignore this parameter. Controls whether the server sends partial (non-final) transcripts as speech is processed.
Default: false. Pass "true" as a string. interim_results=false (default) — Server sends only final transcripts. Each message has is_final: true. Lower message volume, higher latency per result.
interim_results=true — Server sends evolving partial transcripts as audio is processed, followed by a final. Partials have is_final: false and are replaced by the next message.
Partial transcripts have confidence: 0.0 — confidence is only meaningful on final results.

Endpointing

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/endpointing.md
Deepgram, xAI, Google, Speechmatics, and Soniox. Other engines ignore this parameter. Controls how long the engine waits after silence before finalizing an utterance. Soniox has a different valid range. When transcription_engine=Soniox, this parameter maps to max_endpoint_delay_ms and must be between 500 and 3000 ms. Values outside that range are rejected. The default (100 ms) and the low-value examples below apply to Deepgram, xAI, Google, and Speechmatics only.
Default: 100 ms (not applicable to Soniox — Soniox endpointing is disabled unless a value in the 500–3000 ms range is provided).

Values

Trade-offs

Low values (50–100 ms) — Fast response. Utterances may split mid-sentence on short pauses. (Deepgram, xAI, Google, Speechmatics only — below Soniox minimum.) High values (300–1000 ms) — More complete sentences. Higher latency before finalization. Soniox range (500–3000 ms) — Minimum 500 ms. Use 500–800 ms for responsive turn detection, 1000–3000 ms for longer utterances with natural pauses. Disabled ("false") — No automatic splits. Use Finalize control messages to manually trigger boundaries, or rely on CloseStream for a single final transcript.

Interaction With Utterance End

When endpointing triggers, Deepgram sends the final transcript followed by an utterance end event (if utterance_end_ms is configured server-side — currently 1000 ms).
The utterance end marker signals “this speaker turn is done.” See Messages for details.

Keyword Boosting

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/keyword-boosting.md
Deepgram only. Other engines ignore these parameters. Two parameters control keyword boosting. They target different Deepgram model generations.

keyterm — Nova-3 and Flux

Comma-separated list of terms to boost. Simple — no intensifiers.
Deepgram Nova-3 and Flux only. Ignored on older models.

keywords — Nova (Legacy)

Terms with optional intensity scores. Format: keyword:intensifier.
Deepgram Nova only. Not supported on Flux (silently ignored).

Which To Use

Examples

Boost multiple terms on Nova-3:
Boost with intensifiers on legacy Nova:

Redaction

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/parameters/redaction.md
Deepgram only. Other engines ignore this parameter. Replaces sensitive data in transcripts with placeholder text.

Values

Multiple values can be passed as comma-separated:

Output

Redacted content is replaced in the transcript text. The exact replacement format depends on the Deepgram model.
Redaction applies to final and interim results. There is no way to get the un-redacted version once redaction is enabled for a session.

Messages

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/responses.md
The WebSocket carries two frame types: binary frames (audio) from client to server, and JSON text frames in both directions.

Client → Server

Audio Data

Binary WebSocket frames containing raw audio bytes. No base64, no JSON wrapping. Recommended chunk size: 2048–8192 bytes. Smaller chunks reduce latency; larger chunks reduce round trips.

Control Messages

JSON text frames with a type field.
Finalize
CloseStream
KeepAlive
Unknown text frames are silently ignored.

Server → Client

All server messages are JSON text frames.

Transcription Result

Emitted for each recognized speech segment (partial or final).

Utterance End

Emitted on speaker pause (Deepgram). Empty transcript, is_final: true.

Error

Emitted on validation or connection errors. Connection closes shortly after.

Message Flow

interim_results=false (default) — server sends only final transcripts:
interim_results=true — server sends partials, then final:
Partials are best-effort and may revise. Only is_final: true results are stable.

Errors

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/errors.md
If you send an invalid parameter (unsupported engine, format, or format/engine combination), the server responds with a JSON error and closes the connection.

Error Response Format

Error Codes


Examples

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/examples.md
Stream a WAV file and print transcripts.
Python
JavaScript

Production Patterns

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/production-patterns.md
Use these patterns when running the standalone WebSocket STT endpoint in production.

Connection Recovery

Treat the WebSocket session as disposable. Reconnect on network failure, server close, idle timeout, and process restart. Set all query parameters on every reconnect. STT configuration cannot be changed mid-session.

Backoff

Use bounded exponential backoff with jitter. Add random jitter of 0-500 ms per attempt. Reset the attempt counter after a stable connection. Do not retry immediately on authentication or validation errors. Fix the API key, query parameters, engine, model, or format first.

Partials

Enable interim_results=true when the application needs live captions or low-latency UI updates. Store final transcript segments separately from the current partial. This prevents duplicate text when a final result arrives after one or more interim results.

Audio Buffering

Buffer audio at the producer boundary, not inside the WebSocket send loop. Avoid unbounded queues. A slow or disconnected socket should not grow memory usage indefinitely. For live audio, prefer dropping stale buffered audio over sending it late. Late audio increases transcript delay and can make captions appear out of sync.

Keepalive

For Deepgram sessions, send {"type": "KeepAlive"} during long silence periods. Keep sending audio as binary frames when audio is available. For other engines, use the WebSocket client’s ping/pong support when available and reconnect on missed heartbeats.

Monitoring

Track connection, latency, transcript, and buffer metrics. Log the selected transcription_engine, model, input_format, sample_rate, and interim_results value with each session. Redact API keys and user audio.

Shutdown

Use graceful shutdown for planned stops.
  1. Drain the audio queue.
  2. Send {"type": "CloseStream"}.
  3. Wait for final transcript messages.
  4. Close the WebSocket.
Set a shutdown timeout. If final messages do not arrive before the timeout, close the socket and mark the transcript as incomplete.

Pricing

Source: https://developers.telnyx.com/docs/voice/stt/websocket-streaming/pricing.md
Pricing for WebSocket STT varies by engine and model. Contact sales or check the pricing page for current rates.

REST API

Overview

Source: https://developers.telnyx.com/docs/voice/stt/rest-api.md
POST /v2/ai/audio/transcriptions Synchronous file transcription. Upload audio or pass a URL, get text back.

Feature Support

If you’re coming from alternative providers:

Quick Start

Python
JavaScript

Overview

Source: https://developers.telnyx.com/docs/voice/stt/rest-api/parameters.md
All parameters are sent as multipart/form-data. Model to use for transcription. See Models for details. Values: openai/whisper-large-v3-turbo (default), openai/whisper-tiny, deepgram/nova-3 Audio file to transcribe. Mutually exclusive with file_url. See Audio Formats for supported formats, size limits, and per-model restrictions. Publicly accessible URL to an audio file. Mutually exclusive with file. See Audio Formats for details on how file and file_url differ. Language hint. Behavior varies by model — see Language. Output shape. See Response Format. Values: json (default), verbose_json Timestamp detail level. Only valid with response_format=verbose_json — returns 400 otherwise. Values: segment Deepgram-specific options. Only valid with deepgram/nova-3 — returns 400 for other models. See Model Config.

Models

Source: https://developers.telnyx.com/docs/voice/stt/rest-api/parameters/models.md
Your choice of model determines which audio formats are accepted, what language values are valid, and what response fields are available.

openai/whisper-large-v3-turbo

Default model. Multilingual. Auto-detected if language omitted. See Whisper docs for the full language list. Returns text only — no timestamps regardless of response_format.

openai/whisper-tiny

Lightweight, lowest resource usage. Multilingual (50+ languages, auto-detected). Returns text only — no timestamps.

deepgram/nova-3

Highest accuracy for English. Advanced features (diarization, word timestamps, smart formatting, numerals, punctuation) available via model_config. Defaults language to en if omitted. Can also set language inside model_config — top-level field takes precedence. See Deepgram language docs for details.

Audio Formats

Source: https://developers.telnyx.com/docs/voice/stt/rest-api/parameters/audio-formats.md
Applies to both file (multipart upload) and file_url (URL download).

Common

  • Max size: 100 MB
  • Processing: All audio is decoded, resampled to 16kHz, and mixed to mono via ffmpeg before transcription. Container format doesn’t matter as long as ffmpeg can decode it — the validated extension list is the actual restriction.

Supported Formats

file vs file_url

One of file or file_url is required. Sending both returns 400.

Model Config

Source: https://developers.telnyx.com/docs/voice/stt/rest-api/parameters/model-config.md
Deepgram only. Returns 400 if used with other models. Pass-through to Deepgram’s pre-recorded API query parameters. Every key-value pair in model_config is forwarded directly — Telnyx does not validate individual options.

Commonly Used Options

Example

model_config can be sent as a JSON string in the multipart form field. The server parses it before forwarding.

Unvalidated Pass-Through

Any Deepgram query parameter can be passed. If Deepgram adds new options, they work immediately without a Telnyx API update. Conversely, invalid keys are forwarded and may cause Deepgram to return an error. Refer to Deepgram’s API reference for the full list of supported parameters.

Response Format

Source: https://developers.telnyx.com/docs/voice/stt/rest-api/parameters/response.md
Controlled by the response_format parameter.

json (Default)

Text only.

verbose_json

Adds duration (seconds) and timestamped segmentsonly when using deepgram/nova-3. The Whisper models (openai/whisper-large-v3-turbo, openai/whisper-tiny) return text only regardless of response_format. See the Timestamp Availability table below. Example response with model=deepgram/nova-3:
Set timestamp_granularities[]=segment alongside response_format=verbose_json. Using timestamp_granularities without verbose_json returns 400.

Segment Fields

Timestamp Availability by Model

Streaming Response (Undocumented)

Sending Accept: application/stream+json returns newline-delimited JSON chunks as segments are transcribed. Each line:
This is used internally but not in the public OAS spec.

Pricing

Source: https://developers.telnyx.com/docs/voice/stt/rest-api/pricing.md
Pricing for REST API STT varies by engine and model. Contact sales or check the pricing page for current rates.

In-Call

In-Call Transcription

Source: https://developers.telnyx.com/docs/voice/stt/in-call-transcription.md
In-call transcription enables real-time STT on live voice calls. The audio codec is managed by the Telnyx platform — no format configuration needed. Two integration paths: Engine selection (Telnyx, Google, Deepgram, Azure, xAI, AssemblyAI, Speechmatics, Soniox, Parakeet) is specified as a parameter on the transcription command. Same engines as WebSocket streaming.

API Reference (STT)

Audio

  • Transcribe speech to text: Transcribe speech to text. This endpoint is consistent with the OpenAI Transcription API and may be used with the OpenAI JS or Python SDK.