stepaudio-2.5-asr-stream.
To submit audio once over HTTP + SSE and receive streaming recognition results, see Speech Recognition (Streaming Output).
Endpoint
Connect via WebSocket:wss://api.stepfun.ai/v1/realtime/asr/stream
Authentication
Authorizationstringrequired
Authentication token in the formatBearer $STEPFUN_API_KEY.
Client Messages
Session update (session.update)
Update the session configuration, including audio format and recognition parameters.-
event_idstringrequired
Event ID of the current message. -
typestringrequired
Message type. Fixed assession.update. -
session.audio.input.formatobject
Audio format. -
session.audio.input.transcriptionobject
Recognition configuration. -
session.audio.input.turn_detectionobject
Voice activity detection (VAD) configuration.
- Currently supports
stepaudio-2.5-asr-stream. - If
turn_detection.type=server_vadis not set, the server does not perform VAD automatically; in that case the client must actively sendinput_audio_buffer.commit.
Append audio (input_audio_buffer.append)
Send audio data for real-time recognition.event_idstringrequired
Unique event identifier.audiostringrequired
Base64-encoded audio data (WAV format).
Commit buffer (input_audio_buffer.commit)
Send this message only whenserver_vad is disabled, to ask the server to commit the audio buffer and trigger transcription.
event_idstringrequired
Unique event identifier.
Server Messages
Session created (session.created)
Confirms the session was created successfully.Session updated (session.updated)
Confirms the session configuration was updated successfully.Speech started (input_audio_buffer.speech_started)
Returned only whenserver_vad is enabled; indicates the server detected the start of speech.
Speech stopped (input_audio_buffer.speech_stopped)
Returned only whenserver_vad is enabled; indicates the server detected the end of speech.
Buffer committed (input_audio_buffer.committed)
Confirms the audio buffer was committed.Conversation item created (conversation.item.created)
A new conversation item (transcription result) has been created.Transcription delta (conversation.item.input_audio_transcription.delta)
Returns incremental transcription results (streaming output).item_idstring
Conversation item ID.content_indexint
Content index.textstring
The cumulative full text up to now (including corrections to earlier text). The client should replace the displayed text as a whole rather than appending to it.stashstring
The correctable trailing text (the last few characters, which may be rewritten later). Consider displaying it in a style distinct fromtext.languagestring
Detected language of the recognized text.wordslist
Per-word timing array; each element is{ "word", "start", "end", "final" }.start/endare in seconds (float).final=falseindicates the word is still in thestashregion and its timing is a temporary estimate.
Transcription completed (conversation.item.input_audio_transcription.completed)
Returns the complete transcription result.item_idstring
Conversation item ID.content_indexint
Content index.transcriptstring
The complete transcription text.languagestring
Detected language of the transcription.wordslist
Per-word timing for the segment; same structure as indelta, withfinalalwaystrue.reasonstring
The reason the transcription was finalized, e.g.commit.usageobject
Usage statistics.
Error (error)
Returns error information.
Error codes:
Troubleshooting
- Connection failed: check that the service is reachable and that the endpoint and authentication are correct.
- No recognition result: verify the audio format, codec, and quality.
- Low recognition accuracy: try using the
promptfield or a different model. - High latency: reduce the audio chunk size.