wss://openapi.myvocal.ai/asr/realtime. Set the required api-key and model_id in the query string. Keep the full connection URL out of logs. This example uses the realtime V2 model:wss://openapi.myvocal.ai/asr/realtime?api-key=YOUR_API_KEY&model_id=echo_v2_realtime&audio_format=pcm_16000&commit_mode=manual| Setting | Where to send it | Usage |
|---|---|---|
audio_format | Connection URL | Use pcm_16000 for the sample. Set sample_rate to 16000 in each audio message. |
commit_mode | Connection URL | manual is the default. Use vad for silence-based segmentation or turn_prediction for turn detection (V2 only). |
language, word_timestamps | Connection URL | Use language=en for English audio. Set word_timestamps=true to receive word timings. |
multilingual_mode, speaker_diarization | Connection URL | V2 only. Enable mixed-language transcription or speaker labels with true. |
keyterms | Connection URL | Repeat the query field for each term, up to 50 terms. |
previous_text, hotwords_library | First audio message only | Supply optional preceding text or, on V2, an array of up to 10,000 terms (1–50 characters per term). |
session_started, send JSON text messages. Encode the raw PCM bytes as Base64, without a WAV header. Replace the placeholder below with audio bytes encoded as Base64.{"message_type":"input_audio_chunk","audio_base_64":"BASE64_PCM_BYTES","sample_rate":16000,"commit":false}commit to true on the last audio message of the segment. With automatic segmentation, keep streaming chunks with commit=false.| Received event | How to use it |
|---|---|
session_started | Start sending audio. |
partial_transcript | Display the current text; it can change. |
committed_transcript | Save the final text for the segment. |
committed_transcript_with_timestamps | Read words[].start and words[].end in seconds. |
diarized_transcript | With V2 speaker labeling enabled, use segment_index and words[].speaker_id. |
{"message_type":"committed_transcript","text":"The order contains 42 boxes."}message_type and error before handling the WebSocket close.wss://openapi.myvocal.ai/asr/realtime. Use model_id to choose realtime V1 (echo_v1_realtime) or V2 (echo_v2_realtime) when connecting.| What you want to do | Where to send it | How to configure it | Applies to |
|---|---|---|---|
| Submit when the user releases the record button | Connection URL | commit_mode=manual (default) | V1、V2 |
| Submit the current segment manually | Audio message | Send commit=true on the segment’s final chunk. | V1、V2 |
| Use silence to detect segment boundaries | Connection URL | commit_mode=vad | V1、V2 |
| Detect when the speaker has finished a turn | Connection URL | commit_mode=turn_prediction | V2 only |
| Keep each language in bilingual captions | Connection URL | multilingual_mode=true. Default: false. | V2 only |
| Identify speakers in a call | Connection URL | speaker_diarization=true. Default: false. | V2 only |
| Get word timings | Connection URL | word_timestamps=true | V1、V2 |
| Read the detected language | Connection URL | Set include_language_detection=true and read language information from the final event with timestamps. | V1、V2 |
| Provide a short list of terms | Connection URL | Repeat keyterms once per term. | V1、V2 |
| Supply a store directory or product catalog | First audio message | String array in hotwords_library | V2 only |
| Continue from preceding text | First audio message | previous_text | V1、V2 |
wss://openapi.myvocal.ai/asr/realtime?api-key=YOUR_API_KEY&model_id=echo_v2_realtime&audio_format=pcm_16000&commit_mode=manualapi-key and model_id are required. Set commit_mode to choose when a segment is submitted. See the connection parameter reference for all fields.echo_v2_medical here returns HTTP 400 during the handshake. For medical recordings use File transcription.session_started and send audio in JSON text messages. Encode mono signed 16-bit little-endian PCM as Base64 in audio_base_64. If reading a WAV file, remove its header.audio_format values are pcm_8000, pcm_16000, pcm_22050, pcm_24000 and pcm_44100. Match sample_rate in each message, for example 16000 Hz for pcm_16000.| Field | Type | Description |
|---|---|---|
message_type | string | Fixed value: input_audio_chunk |
audio_base_64 | string | Base64-encoded PCM audio without a WAV header |
sample_rate | integer | Match the connection’s audio format, for example 16000. |
commit | boolean | Set to true to submit the segment in manual mode. |
previous_text | Optional string | Preceding text, allowed only in the first audio message of the session |
hotwords_library | Optional string array | Realtime V2 only. Supply store names, product models or other terms in the first audio message. Up to 10,000 entries, each 1–50 characters. |
BASE64_PCM_BYTES with Base64-encoded audio:{
"message_type": "input_audio_chunk",
"audio_base_64": "BASE64_PCM_BYTES",
"sample_rate": 16000,
"commit": false
}previous_text only to the first audio message. Omit it from subsequent frames and the URL query.commit_mode=manualcommit_mode selects manual submission. Send commit=true on the last chunk and keep receiving until the final transcript.commit_mode=vadvad_threshold, vad_silence_threshold_secs (seconds), min_speech_duration_ms (milliseconds) or min_silence_duration_ms (milliseconds) in the connection URL.commit_mode=turn_prediction (realtime V2 only)commit=false continuously. The server decides when each segment is complete.model_id=echo_v2_realtime, audio_format=pcm_16000 and commit_mode=turn_prediction. Use multilingual_mode=true to retain Chinese and English speech in their original languages, speaker_diarization=true to distinguish speakers and word_timestamps=true for word timings.keyterms in the connection URL for up to 50 terms. For larger catalogs, send hotwords_library as an array in the first input_audio_chunk after session_started. Use up to 10,000 entries of 1–50 characters each. The first frame may also contain previous_text. Later frames carry audio, sample rate and the commit flag. In automatic modes, continue sending commit=false.message_type. Word timings and speaker results for a segment can arrive in either order.| Event | Fields to read | When to handle it |
|---|---|---|
session_started | config | Start sending audio when the session is ready. |
partial_transcript | text | Update live captions. Partial text can change. |
committed_transcript | text and segment_index when present | Save each segment’s final transcript once. |
committed_transcript_with_timestamps | words[].text/start/end | Read when word timings are enabled. Timings are in seconds. This event may omit the segment index. |
diarized_transcript | segment_index、words[].speaker_id | With realtime V2 speaker diarization, match by segment index. Zero is a valid index. |
{"message_type":"session_started","config":{"include_timestamps":true}}{"message_type":"partial_transcript","text":"Hello"}{"message_type":"committed_transcript","text":"Hello world.","segment_index":0}{"message_type":"committed_transcript_with_timestamps","text":"Hello world.","words":[{"text":"Hello","start":0.14,"end":0.4}]}{"message_type":"diarized_transcript","segment_index":0,"words":[{"text":"Hello","speaker_id":"speaker_0"}]}include_language_detection=true, read the language from the final event with timestamps. Use enhanced events to enrich the final text saved for the same segment.| Event | Fields to read | When to handle it |
|---|---|---|
input_error | message_type、error | Correct the audio message according to the error. For example, the vocabulary must be in the first frame. |
invalid_request | message_type、error | Correct the request according to the error. Realtime V2 accepts up to 50 connection-level terms. |
auth_error | message_type | Check the enterprise ASR API key. |
quota_exceeded_error | message_type | Check the account quota. |
error | message_type and the reason returned by the server | Handle the indicated connection or server error. |
hotwords_library was sent after the first audio frame.{"message_type":"input_error","error":"hotwords_library is only allowed in the first input_audio_chunk"}| Location | Parameter | Type | Required | Description |
|---|---|---|---|---|
| Query | api-key | string | Yes | Enterprise ASR API key. |
| Query | model_id | string | Yes | Required. Use echo_v2_realtime or echo_v1_realtime. Allowed values: echo_v2_realtime, echo_v1_realtime. |
| Query | audio_format | string | No | Mono signed 16-bit little-endian PCM. Match sample_rate to the format, such as 16000 for pcm_16000. Allowed values: pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_44100. |
| Query | commit_mode | string | No | Both realtime models support manual (default) and vad. Only echo_v2_realtime supports turn_prediction. Allowed values: manual, vad, turn_prediction. |
| Query | word_timestamps | boolean | No | Set to true to receive start and end times for each word. |
| Query | language | string | No | Language code. Omit for automatic language detection. |
| Query | vad_threshold | string | No | Voice activity detection threshold. Higher values require stronger evidence of speech. Example value: 0.4. |
| Query | vad_silence_threshold_secs | string | No | Seconds of silence used to end a segment in vad mode. Example value: 1.5 seconds. |
| Query | min_speech_duration_ms | integer | No | Minimum speech duration in milliseconds. Example value: 250 milliseconds. |
| Query | min_silence_duration_ms | integer | No | Minimum silence duration in milliseconds. Example value: 2500 milliseconds. |
| Query | include_language_detection | boolean | No | Read language information from committed_transcript_with_timestamps when enabled. |
| Query | keyterms | string | No | Repeat this query parameter for each term. Up to 50 terms on echo_v2_realtime. Terms guide recognition and do not guarantee a spelling. |
| Query | multilingual_mode | boolean | No | Realtime V2 only. Set to true to transcribe mixed-language speech in the original languages. Default: false. |
| Query | speaker_diarization | boolean | No | Realtime V2 only. Set to true to receive speaker labels. Default: false. |