WebSockets

Murf TTS API supports WebSocket streaming, enabling low-latency, bidirectional communication over a persistent connection. It’s designed for building responsive voice experiences like interactive voice agents, live conversations, and other real-time applications.

New: Pass model = falcon-2 to use our Falcon 2 model in text-to-speech streaming endpoints, designed for ultra-low latency (~100 ms). WebSocket streaming supports Falcon only.

With a single WebSocket connection, you can stream text input and receive synthesized audio continuously, without the overhead of repeated HTTP requests. This makes it ideal for use cases where your application sends or receives text in chunks and needs real-time audio to deliver a smooth, conversational experience.

Simple WebSocket Connection

Endpoint

wss://global.api.murf.ai/v1/speech/stream-input

global geo-routes your connection to the nearest datacenter. Use it unless you have a data-residency requirement, in which case pin to a regional host such as wss://in.api.murf.ai/v1/speech/stream-input — see Available Regions for the full list.

api.murf.ai is a legacy alias that always resolves to us-east and does not geo-route. Note also that /v1/speech/stream-input is the WebSocket path; /v1/speech/stream is the HTTP streaming endpoint.

Quickstart

This guide walks you through setting up and making your first WebSocket streaming request.

1

Getting Started

Generate an API key here. Store the key in a secure location, as you’ll need it to authenticate your requests. You can optionally save the key as an environment variable in your terminal.

# Export an environment variable on macOS or Linux systems
export MURF_API_KEY="your_api_key_here"
2

Install required packages

This guide uses the websockets and pyaudio Python packages. The websockets package is essential for the core functionality.

Note: pyaudio is used in this quickstart guide to demonstrate playing the audio received from the WebSocket. However, it is not required to use Murf WebSockets if you have a different method for handling or playing the audio stream.

pyaudio depends on PortAudio, you may need to install it first.

PyAudio depends on PortAudio, a cross-platform audio I/O library. You may need to install PortAudio separately if it’s not already on your system.

brew install portaudio

Once you have installed PortAudio, you can install the required Python packages using the following command:

Install Python packages
pip install websockets pyaudio
3

Streaming Text and Playing Synthesized Audio

import asyncio
import websockets
import json
import base64
import pyaudio
# import os
API_KEY = "YOUR_API_KEY" # Or use os.getenv("MURF_API_KEY") if you have set the API key as an environment variable
WS_URL = "wss://global.api.murf.ai/v1/speech/stream-input"
CONTEXT_ID = "quickstart-1"
PARAGRAPH = "With a single WebSocket connection, you can stream text input and receive synthesized audio continuously, without the overhead of repeated HTTP requests. This makes it ideal for use cases where your application sends or receives text in chunks and needs real-time audio to deliver a smooth, conversational experience"
# Audio format settings (must match your API output)
SAMPLE_RATE = 24000
CHANNELS = 1
FORMAT = pyaudio.paInt16
async def tts_stream():
async with websockets.connect(
f"{WS_URL}?api-key={API_KEY}&model=falcon-2&sample_rate=24000&channel_type=MONO&format=WAV"
) as ws:
# Send voice config first, before any text
voice_config_msg = {
"voice_config": {
"voiceId": "Gordon",
"locale":"en-US",
"style": "Conversation",
"rate": 0,
"pitch": 0
},
"context_id": CONTEXT_ID
}
print(f'Sending payload : {voice_config_msg}')
await ws.send(json.dumps(voice_config_msg))
# Use the same context ID on the text frame
text_msg = {
"text": PARAGRAPH,
"end": True, # This closes the context and frees its concurrency slot
"context_id": CONTEXT_ID
}
print(f'Sending payload : {text_msg}')
await ws.send(json.dumps(text_msg))
# Setup audio stream
pa = pyaudio.PyAudio()
stream = pa.open(format=FORMAT, channels=CHANNELS, rate=SAMPLE_RATE, output=True)
first_chunk = True
try:
while True:
response = await ws.recv()
data = json.loads(response)
print(f'Received data: {data}')
if "audio" in data:
audio_bytes = base64.b64decode(data["audio"])
# Only the first chunk of a context carries the WAV header
if first_chunk and len(audio_bytes) > 44:
audio_bytes = audio_bytes[44:]
first_chunk = False
stream.write(audio_bytes)
if data.get("error"):
print(f'Error {data["error_code"]}: {data["error"]}')
if data.get("fatal"):
break
if data.get("warning"):
print(f'Warning {data["warning_code"]}: {data["warning"]}')
if data.get("final"):
break
finally:
stream.stop_stream()
stream.close()
pa.terminate()
if __name__ == "__main__":
asyncio.run(tts_stream())

Choosing a voice

Choose a voice from the Falcon 2 Supported Voices section.

What matters is that the voice exists in the Falcon catalog. An unknown voice returns an INVALID_VOICE error with "fatal": true, and the message points you to GET /v1/speech/voices?model=FALCON.

Using voice settings with Context IDs

A context_id does not alter the values in voice_config; it determines which independent context owns those settings. If you include a context_id on a text frame, send a voice_config frame with the same context_id first.

A configuration sent without context_id belongs only to the default context, so named contexts do not inherit it. Text sent to an unconfigured named context uses the default voice and produces a NO_VOICE_CONFIG warning. The context keeps its configured settings for its lifetime, even if you later change the default context’s configuration.

For a single default stream, you can omit context_id from both frames. See Context ID for multi-turn and interruption examples.

Audio format and the WAV header

With format=WAV, the first audio chunk of a context starts with a 44-byte WAV header whose RIFF-size and data-size fields are 0xFFFFFFFF — the “length unknown, read to end of stream” sentinel — because the total length isn’t known mid-stream. Only the first chunk has it.

  • Playing progressively: feed the bytes straight to a streaming decoder. It honours the sentinel.
  • Saving to a file: strip the first 44 bytes, concatenate the rest, then write your own header with the real length. Otherwise players show a bogus duration and can’t seek.
  • Avoiding it entirely: request format=PCM for headerless little-endian 16-bit samples.

Field naming

Request fields accept both snake_case and camelCase (context_id/contextId, min_buffer_size/minBufferSize, max_buffer_delay_in_ms/maxBufferDelayInMs, predictive_chunking/predictiveChunking). Responses are always snake_case.

Note that voice_config itself uses camelCase inside (voiceId), which is why both spellings are accepted at the top level.

min_buffer_size, max_buffer_delay_in_ms and predictive_chunking are top-level siblings of text, not members of voice_config. Nesting them inside voice_config fails silently.

Machine-readable schema

Every frame, field and query parameter is defined in the WebSockets API reference, generated from our AsyncAPI document. Use it when generating a client.

Falcon 2 Supported Voices

Voice IDSupported LocalesVoice Styles
Aliciaen-US (English - US & Canada)Conversation
Alinaen-US (English - US & Canada)Conversation
Amaraen-US (English - US & Canada)Conversational
Angelaen-US (English - US & Canada)Promo
Arianaen-US (English - US & Canada)Conversation
Caleben-US (English - US & Canada)Conversation
Charlesen-US (English - US & Canada)Conversation
Cooperen-US (English - US & Canada)Conversation
Daisyen-US (English - US & Canada)Conversation
Danielen-US (English - US & Canada)Conversation
Edmunden-US (English - US & Canada)Conversation
Ezekielen-US (English - US & Canada)Conversational
Gordonen-US (English - US & Canada)Conversational
Granten-US (English - US & Canada)Conversational
Jaydenen-US (English - US & Canada)Conversation
Josieen-US (English - US & Canada)Conversation
Judithen-US (English - US & Canada)Conversational
Lunaen-US (English - US & Canada)Conversation
Madisonen-US (English - US & Canada)Conversational
Matthewen-US (English - US & Canada)Conversation
Mavericken-US (English - US & Canada)Conversation
Michelleen-US (English - US & Canada)Conversation
Milesen-US (English - US & Canada)AIAgent, Customer Support Agent
Mollyen-US (English - US & Canada)Conversation
Natalieen-US (English - US & Canada)Conversation
Ronnieen-US (English - US & Canada)Conversation
Wayneen-US (English - US & Canada)Conversation
Willen-US (English - US & Canada)Conversation
Abiramien-US (English - US & Canada), hi-IN (Hindi - India)Conversational
Alexisen-US (English - US & Canada), fr-CA (French - Canada)Conversational
Bertieen-US (English - US & Canada), en-UK (English - UK)Conversational
Blazejen-US (English - US & Canada), pl-PL (Polish - Poland)Conversational
Carlosen-US (English - US & Canada), es-MX (Spanish - Mexico)Conversational
Carmenen-US (English - US & Canada), es-ES (Spanish - Spain)Conversational
Dirken-US (English - US & Canada), nl-NL (Dutch - Netherlands)Conversation
Diyaen-US (English - US & Canada), gu-IN (Gujarati - India), mr-IN (Marathi - India), vi-VN (Vietnamese - Vietnam)Conversational
Elviraen-US (English - US & Canada)Conversation
Giuliaen-US (English - US & Canada)Conversational
Heidien-US (English - US & Canada), en-UK (English - UK)Conversational
Heitoren-US (English - US & Canada), pt-BR (Portuguese - Brazil)Conversational
Isadoraen-US (English - US & Canada), pt-BR (Portuguese - Brazil)Conversation
Joshuaen-US (English - US & Canada), en-UK (English - UK)Conversational
Laraen-US (English - US & Canada), de-DE (German - Germany)Conversational
Merelen-US (English - US & Canada), nl-NL (Dutch - Netherlands)Conversational
Nimishaen-US (English - US & Canada), ml-IN (Malayalam - India)Conversational
Ralfen-US (English - US & Canada), de-DE (German - Germany)Conversational
Voice IDSupported LocalesVoice Styles
Benedicten-UK (English - UK)Conversational
Bertieen-UK (English - UK), en-US (English - US & Canada)Conversational
Freddieen-UK (English - UK)Conversational
Hazelen-UK (English - UK)Conversational
Heidien-UK (English - UK), en-US (English - US & Canada)Conversational
Hugoen-UK (English - UK)Conversational
Joshuaen-UK (English - UK), en-US (English - US & Canada)Conversational
Julieten-UK (English - UK)Conversational
Lydiaen-UK (English - UK)Conversational
Masonen-UK (English - UK)Conversational
Pearlen-UK (English - UK)Conversational
Rubyen-UK (English - UK)Conversational
Sharonen-UK (English - UK)Conversational
Theoen-UK (English - UK)Narration
Voice IDSupported LocalesVoice Styles
Abhinaven-IN (English - India), hi-IN (Hindi - India), kn-IN (Kannada - India), mr-IN (Marathi - India)Conversational
Anishaen-IN (English - India), as-IN (Assamese - India), bn-IN (Bangla - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), pa-IN (Punjabi - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversation
Anushaen-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Nikhilen-IN (English - India), hi-IN (Hindi - India)Conversational
Poojaen-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), ta-IN (Tamil - India), te-IN (Telugu - India), vi-VN (Vietnamese - Vietnam)Conversational
Priyaen-IN (English - India), hi-IN (Hindi - India)Conversational
Samaren-IN (English - India), as-IN (Assamese - India), hi-IN (Hindi - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Hardiken-IN (English - India), gu-IN (Gujarati - India), hi-IN (Hindi - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Voice IDSupported LocalesVoice Styles
Harperen-AU (English - Australia)Conversational
Ivyen-AU (English - Australia)Conversational
Jimmen-AU (English - Australia)Conversational
Leytonen-AU (English - Australia)Conversational
Sophiaen-AU (English - Australia)Narration
Voice IDSupported LocalesVoice Styles
Adéliefr-FR (French - France)Conversational
Axelfr-FR (French - France)Conversational
Guillaumefr-FR (French - France)Conversational
Justinefr-FR (French - France)Conversational
Voice IDSupported LocalesVoice Styles
Alexisfr-CA (French - Canada), en-US (English - US & Canada)Conversational
Clémentfr-CA (French - Canada)Conversational
Voice IDSupported LocalesVoice Styles
Björnde-DE (German - Germany), vi-VN (Vietnamese - Vietnam)Conversational
Ernade-DE (German - Germany)Conversational
Larade-DE (German - Germany), en-US (English - US & Canada)Conversational
Ralfde-DE (German - Germany), en-US (English - US & Canada)Conversational
Voice IDSupported LocalesVoice Styles
Carloses-MX (Spanish - Mexico), en-US (English - US & Canada)Conversational
Luisaes-MX (Spanish - Mexico)Conversational
Valeriaes-MX (Spanish - Mexico)Conversational
Voice IDSupported LocalesVoice Styles
Carmenes-ES (Spanish - Spain), en-US (English - US & Canada)Conversational
Javieres-ES (Spanish - Spain)Conversational
Voice IDSupported LocalesVoice Styles
Angeloit-IT (Italian - Italy)Conversational
Gretait-IT (Italian - Italy)Conversational
Verait-IT (Italian - Italy)Conversational
Vincenzoit-IT (Italian - Italy)Conversational
Voice IDSupported LocalesVoice Styles
Beníciopt-BR (Portuguese - Brazil)Conversational
Eloapt-BR (Portuguese - Brazil)Conversational
Gustavopt-BR (Portuguese - Brazil)Conversational
Heitorpt-BR (Portuguese - Brazil), en-US (English - US & Canada)Conversational
Isadorapt-BR (Portuguese - Brazil), en-US (English - US & Canada)Conversational
Silviopt-BR (Portuguese - Brazil)Conversational
Yagopt-BR (Portuguese - Brazil)Conversational
Voice IDSupported LocalesVoice Styles
Jiaozh-CN (Mandarin - China), vi-VN (Vietnamese - Vietnam)Conversational
Taozh-CN (Mandarin - China)Conversational
Weizh-CN (Mandarin - China)Conversational
Yuxanzh-CN (Mandarin - China)Conversational
Voice IDSupported LocalesVoice Styles
Dirknl-NL (Dutch - Netherlands), en-US (English - US & Canada)Conversational
Famkenl-NL (Dutch - Netherlands)Conversational
Merelnl-NL (Dutch - Netherlands), en-US (English - US & Canada)Conversational
Voice IDSupported LocalesVoice Styles
Ayushihi-IN (Hindi - India)Conversation
Poojahi-IN (Hindi - India), en-IN (English - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), ta-IN (Tamil - India), te-IN (Telugu - India), vi-VN (Vietnamese - Vietnam)Conversational
Karthikeyanhi-IN (Hindi - India), ta-IN (Tamil - India)Conversation
Abhinavhi-IN (Hindi - India), en-IN (English - India), kn-IN (Kannada - India), mr-IN (Marathi - India)Conversational
Amanhi-IN (Hindi - India)Conversational
Karanhi-IN (Hindi - India), kn-IN (Kannada - India)Conversational
Khyatihi-IN (Hindi - India)Conversational
Namritahi-IN (Hindi - India), kn-IN (Kannada - India), tr-TR (Turkish - Turkey)Conversational
Shwetahi-IN (Hindi - India)Conversational
Sunainahi-IN (Hindi - India), kn-IN (Kannada - India)Conversational
Aaravhi-IN (Hindi - India)Conversation
Abhikhi-IN (Hindi - India)Conversation
Abiramihi-IN (Hindi - India), en-US (English - US & Canada)Conversation
Aliahi-IN (Hindi - India)Conversational
Anishahi-IN (Hindi - India), as-IN (Assamese - India), bn-IN (Bangla - India), en-IN (English - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), pa-IN (Punjabi - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Anushahi-IN (Hindi - India), en-IN (English - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Arnabhi-IN (Hindi - India)Conversation
Arohihi-IN (Hindi - India)Conversational
Eashwarhi-IN (Hindi - India)Conversation
Hardikhi-IN (Hindi - India), en-IN (English - India), gu-IN (Gujarati - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Ishahi-IN (Hindi - India)Conversational
Ishanihi-IN (Hindi - India)Conversation
Madhavanhi-IN (Hindi - India), ml-IN (Malayalam - India)Conversational
Nikhilhi-IN (Hindi - India), en-IN (English - India)Conversational
Priyahi-IN (Hindi - India), en-IN (English - India)Conversational
Samarhi-IN (Hindi - India), as-IN (Assamese - India), en-IN (English - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Sarveshhi-IN (Hindi - India)Conversation
Vaibhavhi-IN (Hindi - India), mr-IN (Marathi - India)Conversational
Voice IDSupported LocalesVoice Styles
Jangmiko-KR (Korean - South Korea)Conversational
Jong-suko-KR (Korean - South Korea)Conversational
Seokko-KR (Korean - South Korea)Conversational
Voice IDSupported LocalesVoice Styles
Karthikeyanta-IN (Tamil - India), hi-IN (Hindi - India)Conversational
Anishata-IN (Tamil - India), as-IN (Assamese - India), bn-IN (Bangla - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), pa-IN (Punjabi - India), te-IN (Telugu - India)Conversational
Poojata-IN (Tamil - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), te-IN (Telugu - India), vi-VN (Vietnamese - Vietnam)Conversational
Samarta-IN (Tamil - India), as-IN (Assamese - India), en-IN (English - India), hi-IN (Hindi - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), te-IN (Telugu - India)Conversational
Voice IDSupported LocalesVoice Styles
Blazejpl-PL (Polish - Poland), en-US (English - US & Canada)Conversational
Jacekpl-PL (Polish - Poland)Conversational
Kasiapl-PL (Polish - Poland)Conversational
Voice IDSupported LocalesVoice Styles
Debaratibn-IN (Bangla - India)Conversational
Subhankarbn-IN (Bangla - India), mr-IN (Marathi - India)Conversational
Anishabn-IN (Bangla - India), as-IN (Assamese - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), pa-IN (Punjabi - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Voice IDSupported LocalesVoice Styles
Denkija-JP (Japanese - Japan)Conversational
Kenjija-JP (Japanese - Japan)Conversational
Kimija-JP (Japanese - Japan)Conversational
Voice IDSupported LocalesVoice Styles
Diyagu-IN (Gujarati - India), en-US (English - US & Canada), mr-IN (Marathi - India), vi-VN (Vietnamese - Vietnam)Conversational
Hardikgu-IN (Gujarati - India), en-IN (English - India), hi-IN (Hindi - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Voice IDSupported LocalesVoice Styles
Harshithakn-IN (Kannada - India)Conversational
Abhinavkn-IN (Kannada - India), en-IN (English - India), hi-IN (Hindi - India), mr-IN (Marathi - India)Conversational
Anishakn-IN (Kannada - India), as-IN (Assamese - India), bn-IN (Bangla - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), mr-IN (Marathi - India), or-IN (Odia - India), pa-IN (Punjabi - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Anushakn-IN (Kannada - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), te-IN (Telugu - India)Conversational
Hardikkn-IN (Kannada - India), en-IN (English - India), gu-IN (Gujarati - India), hi-IN (Hindi - India), te-IN (Telugu - India)Conversational
Harpreetkn-IN (Kannada - India), mr-IN (Marathi - India), pa-IN (Punjabi - India)Conversational
Karankn-IN (Kannada - India), hi-IN (Hindi - India)Conversational
Namritakn-IN (Kannada - India), hi-IN (Hindi - India), tr-TR (Turkish - Turkey)Conversational
Poojakn-IN (Kannada - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), ta-IN (Tamil - India), te-IN (Telugu - India), vi-VN (Vietnamese - Vietnam)Conversational
Prajaktakn-IN (Kannada - India), mr-IN (Marathi - India), te-IN (Telugu - India)Conversational
Prathameshkn-IN (Kannada - India), mr-IN (Marathi - India), te-IN (Telugu - India)Conversational
Samarkn-IN (Kannada - India), as-IN (Assamese - India), en-IN (English - India), hi-IN (Hindi - India), mr-IN (Marathi - India), or-IN (Odia - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Sunainakn-IN (Kannada - India), hi-IN (Hindi - India)Conversational
Voice IDSupported LocalesVoice Styles
Madhavanml-IN (Malayalam - India), hi-IN (Hindi - India)Conversational
Nimishaml-IN (Malayalam - India), en-US (English - US & Canada)Conversational
Voice IDSupported LocalesVoice Styles
Prajaktamr-IN (Marathi - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Prathameshmr-IN (Marathi - India), kn-IN (Kannada - India), te-IN (Telugu - India)Conversational
Vaibhavmr-IN (Marathi - India), hi-IN (Hindi - India)Conversational
Abhinavmr-IN (Marathi - India), en-IN (English - India), hi-IN (Hindi - India), kn-IN (Kannada - India)Conversational
Anishamr-IN (Marathi - India), as-IN (Assamese - India), bn-IN (Bangla - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), or-IN (Odia - India), pa-IN (Punjabi - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Diyamr-IN (Marathi - India), en-US (English - US & Canada), gu-IN (Gujarati - India), vi-VN (Vietnamese - Vietnam)Conversational
Harpreetmr-IN (Marathi - India), kn-IN (Kannada - India), pa-IN (Punjabi - India)Conversational
Samarmr-IN (Marathi - India), as-IN (Assamese - India), en-IN (English - India), hi-IN (Hindi - India), kn-IN (Kannada - India), or-IN (Odia - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Subhankarmr-IN (Marathi - India), bn-IN (Bangla - India)Conversational
Voice IDSupported LocalesVoice Styles
Harmanpa-IN (Punjabi - India)Conversational
Harpreetpa-IN (Punjabi - India), kn-IN (Kannada - India), mr-IN (Marathi - India)Conversational
Anishapa-IN (Punjabi - India), as-IN (Assamese - India), bn-IN (Bangla - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), ta-IN (Tamil - India), te-IN (Telugu - India)Conversational
Voice IDSupported LocalesVoice Styles
Anishate-IN (Telugu - India), as-IN (Assamese - India), bn-IN (Bangla - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), pa-IN (Punjabi - India), ta-IN (Tamil - India)Conversational
Anushate-IN (Telugu - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India)Conversational
Hardikte-IN (Telugu - India), en-IN (English - India), gu-IN (Gujarati - India), hi-IN (Hindi - India), kn-IN (Kannada - India)Conversational
Poojate-IN (Telugu - India), en-IN (English - India), hi-IN (Hindi - India), hi-LATN (Hinglish - India), kn-IN (Kannada - India), ta-IN (Tamil - India), vi-VN (Vietnamese - Vietnam)Conversational
Prajaktate-IN (Telugu - India), kn-IN (Kannada - India), mr-IN (Marathi - India)Conversational
Prathameshte-IN (Telugu - India), kn-IN (Kannada - India), mr-IN (Marathi - India)Conversational
Samarte-IN (Telugu - India), as-IN (Assamese - India), en-IN (English - India), hi-IN (Hindi - India), kn-IN (Kannada - India), mr-IN (Marathi - India), or-IN (Odia - India), ta-IN (Tamil - India)Conversational

Available Regions

Use the region closest to your users for the lowest latency.

Region (City/Area)Endpoint
Global (Routes to the nearest server)wss://global.api.murf.ai/v1/speech/stream-input
US-Eastwss://us-east.api.murf.ai/v1/speech/stream-input
US-Westwss://us-west.api.murf.ai/v1/speech/stream-input
Indiawss://in.api.murf.ai/v1/speech/stream-input
Canadawss://ca.api.murf.ai/v1/speech/stream-input
South Koreawss://kr.api.murf.ai/v1/speech/stream-input
UAEwss://me.api.murf.ai/v1/speech/stream-input
Japanwss://jp.api.murf.ai/v1/speech/stream-input
Australiawss://au.api.murf.ai/v1/speech/stream-input
EU (Central)wss://eu-central.api.murf.ai/v1/speech/stream-input
UKwss://uk.api.murf.ai/v1/speech/stream-input
South America (São Paulo)wss://sa-east.api.murf.ai/v1/speech/stream-input

The Global Router automatically picks the nearest region automatically.The concurrency limit is 5 for the US-East region and 2 for all other regions. To get higher concurrency, use the US-East endpoint directly or contact us to increase limits for regional endpoints.

Best Practices

Following are some best practices for using the WebSocket streaming API:

  • Send voice_config before any text. When using a named context, put the same context_id on both frames. Text that arrives in an unconfigured context is synthesized with the default voice and returns a NO_VOICE_CONFIG warning.
  • Branch on error_code and warning_code, never on the human-readable message. See Errors & Warnings.
  • Once connected, the session remains active as long as it is in use and will automatically close after 3 minutes of inactivity.
  • You can maintain up to 10X your streaming concurrency limit in WebSocket connections, as per your plan’s rate limits.
  • For the lowest latency, prefer Falcon 2 voices by setting model = falcon-2.

Next Steps

FAQs

WebSocket allows you to stream input text and receive audio over the same persistent connection, making it truly bidirectional. In contrast, HTTP streaming is one-way, you send the full text once and receive audio while it is being generated. WebSocket is better for real-time, interactive use cases where text arrives in parts.

The audio is streamed as a sequence of base64-encoded strings, with each message containing a chunk of the overall audio. With format=WAV, only the first chunk of a context carries a 44-byte header, and its length fields are placeholders. Request format=PCM to receive headerless little-endian 16-bit samples instead.

The WebSocket connection will automatically close after 3 minutes of inactivity.

You can control style, speed, pitch and pauses.

Add model = falcon-2 to your WebSocket connection query (or request parameters). Falcon 2 is optimized for ultra-low latency (~100 ms) and is ideal for interactive agents, live support, gaming, tutoring, and other real-time experiences where fast turn-taking matters. WebSocket streaming supports Falcon only.

The HTTP upgrade completes and the connection is then closed with WebSocket code 1008 (policy violation). It is not an HTTP 401, so handle the close code. See Errors & Warnings.