Skip to main content
WebSocket-based bidirectional streaming speech recognition: send audio chunks in real time and continuously receive incremental and final transcription results. Supports server-side VAD (voice activity detection), suitable for real-time conversations, voice assistants, live captioning, and similar scenarios. Recommended model: 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

  • Authorization string required
    Authentication token in the format Bearer $STEPFUN_API_KEY.

Client Messages

Session update (session.update)

Update the session configuration, including audio format and recognition parameters.
  • event_id string required
    Event ID of the current message.
  • type string required
    Message type. Fixed as session.update.
  • session.audio.input.format object
    Audio format.
  • session.audio.input.transcription object
    Recognition configuration.
  • session.audio.input.turn_detection object
    Voice activity detection (VAD) configuration.
Additional notes:
  • Currently supports stepaudio-2.5-asr-stream.
  • If turn_detection.type=server_vad is not set, the server does not perform VAD automatically; in that case the client must actively send input_audio_buffer.commit.

Append audio (input_audio_buffer.append)

Send audio data for real-time recognition.
  • event_id string required
    Unique event identifier.
  • audio string required
    Base64-encoded audio data (WAV format).

Commit buffer (input_audio_buffer.commit)

Send this message only when server_vad is disabled, to ask the server to commit the audio buffer and trigger transcription.
  • event_id string required
    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 when server_vad is enabled; indicates the server detected the start of speech.

Speech stopped (input_audio_buffer.speech_stopped)

Returned only when server_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_id string
    Conversation item ID.
  • content_index int
    Content index.
  • text string
    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.
  • stash string
    The correctable trailing text (the last few characters, which may be rewritten later). Consider displaying it in a style distinct from text.
  • language string
    Detected language of the recognized text.
  • words list
    Per-word timing array; each element is { "word", "start", "end", "final" }. start / end are in seconds (float). final=false indicates the word is still in the stash region and its timing is a temporary estimate.

Transcription completed (conversation.item.input_audio_transcription.completed)

Returns the complete transcription result.
  • item_id string
    Conversation item ID.
  • content_index int
    Content index.
  • transcript string
    The complete transcription text.
  • language string
    Detected language of the transcription.
  • words list
    Per-word timing for the segment; same structure as in delta, with final always true.
  • reason string
    The reason the transcription was finalized, e.g. commit.
  • usage object
    Usage statistics.

Error (error)

Returns error information.
Error types: 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 prompt field or a different model.
  • High latency: reduce the audio chunk size.
For the full list of error codes, see Error Codes.