For model capabilities, supported voices, audio format, and a runnable quick-start, see StepAudio 2.5 Realtime. An open-source reference client is available at Step-Realtime-Console.
Protocol
WebSocket.Endpoint
wss://api.stepfun.ai/v1/realtime?model=stepaudio-2.5-realtime.
Authentication
Authorizationstringrequired
Authentication token in the formatBearer $STEPFUN_API_KEY.
Request Parameters
modelstringrequired
The model to use. Currently supportsstepaudio-2.5-realtime.
Voices
Set the voice withsession.update before the model produces audio. The following system voices are available:
You can also use a cloned voice: clone it via the Voice cloning API with the
stepaudio-2.5-tts model, then pass the returned voice ID as voice.
Only the voice IDs above (or a valid cloned voice ID) are accepted; other values are rejected with a
400 error. A session’s voice cannot be changed once the model has produced audio.How it works
After the WebSocket connection is established, the client sends Client Events and receives Server Events to drive the interaction.Common fields
The following fields are common to Client and Server Events:Client Events
Create / update session (session.update)
Send this event to create or update the session’s default configuration. The client may send it at any time to update the session; any field may be updated at any time exceptvoice. The server responds with a session.updated event.
-
modalitiesarray<string>
The set of modalities the model may use. Fixed to["text", "audio"]. -
instructionsstring
Default system instructions (i.e. the system message) prepended before the model call. Use this to guide the model’s content and format (e.g. “be very concise”, “be friendly”) and its audio behavior (e.g. “speak quickly”, “inject emotion into your voice”). The model is not guaranteed to follow the instructions, but they provide guidance on the desired behavior. -
voicestring
The voice used for generation. See Voices for the available system voices and how to use a cloned voice. The voice cannot be changed once the model has produced audio. -
turn_detectionobjectoptional
Server VAD configuration. Disabled by default. -
input_audio_formatstring
Input audio format. Currently supportspcm16. -
output_audio_formatstring
Output audio format. Currently supportspcm16. -
toolsobject arrayoptional
The list of functions available for tool calling.
Append audio (input_audio_buffer.append)
Append audio bytes to the input audio buffer. The server does not acknowledge this event. In Server VAD mode it triggers model inference.audiostring
Base64-encoded audio bytes, in the format specified byinput_audio_formatin the session configuration.
Commit audio (input_audio_buffer.commit)
Commit the user’s input audio buffer for inference, creating a new user message item in the conversation. The server responds with aninput_audio_buffer.committed event. If the input audio buffer is empty, this event produces an error.
Sample
Clear audio (input_audio_buffer.clear)
Clear the user’s input audio buffer. The server responds with aninput_audio_buffer.cleared event.
Sample
Create conversation item (conversation.item.create)
Add a new item to the conversation context, including messages, function calls, and function-call responses. Use it to populate conversation history or to add new items mid-session, but it cannot populate Assistant audio messages. On success the server responds withconversation.item.created; otherwise it sends an error event.
previous_item_idstring
The ID of the previous item.itemobject
The message item; see the message parameters.
Delete conversation item (conversation.item.delete)
Send this event to remove an item from the conversation history. The server responds withconversation.item.deleted. If the item does not exist, the server responds with an error.
item_idstring
The ID of the item to delete.
Create response (response.create)
Instructs the server to create a Response, i.e. trigger model inference. SampleCancel response (response.cancel)
Cancel an in-progress response. The server returns aresponse.cancelled event, or an error if there is no response to cancel.
Server Events
Error (error)
Returned when an error occurs during server processing. This may be a client or server problem; the session continues.typestring
Error type (e.g.invalid_request_error,server_error).codestring
Error code, if any.messagestring
Human-readable error message.event_idstring
Theevent_idof the client event that caused the error, if applicable.
Session created (session.created)
Returned when the session is created, automatically emitted as the first server event when a new connection is established. Contains the default session configuration.modalitiesarray<string>
The set of modalities the model may use. Fixed to["text", "audio"].instructionsstring
Default system instructions prepended before the model call.voicestring
The voice used for generation.input_audio_formatstring
Input audio format. Currently supportspcm16.output_audio_formatstring
Output audio format. Currently supportspcm16.volume_rationumber
Output volume ratio. Default1.
Session updated (session.updated)
Returned when the session is updated. SampleSpeech started (input_audio_buffer.speech_started)
Notifies that valid speech input has started; typically used for interruption scenarios. Emitted only when Server VAD is enabled.audio_start_msinteger
The start time of the speech within the audio.item_idstring
The item ID.
Speech stopped (input_audio_buffer.speech_stopped)
Notifies that valid speech input has ended. Emitted only when Server VAD is enabled.audio_end_msinteger
The end time of the speech within the audio.item_idstring
The item ID.
Response audio delta (response.audio.delta)
Returned as the model generates audio.response_idstring
The response ID.item_idstring
The item ID.output_indexint
The index of the output item in the response.deltastring
A Base64-encoded audio delta, in theoutput_audio_formatset when the session was created.
Response audio done (response.audio.done)
Returned when the model’s audio is complete. Also emitted when a response is interrupted, incomplete, or cancelled.response_idstring
The response ID.item_idstring
The item ID.
Audio transcript delta (response.audio_transcript.delta)
Streams the text transcript of the model’s audio output.response_idstring
The response ID.item_idstring
The item ID.output_indexint
The index of the output item in the response.deltastring
The transcript delta.
Audio transcript done (response.audio_transcript.done)
Returned when the transcript of the model’s audio output finishes streaming. Also emitted when a response is interrupted, incomplete, or cancelled.response_idstring
The response ID.item_idstring
The item ID.output_indexint
The index of the output item in the response.transcriptstring
The complete transcript of the audio.
Thinking delta (response.thinking.delta)
Streams the model’s reasoning process as it is generated.response_idstring
The response ID.item_idstring
The item ID.output_indexint
The index of the output item in the response.content_indexint
The index of the content part in the item’s content array.deltastring
The reasoning delta.
Thinking done (response.thinking.done)
Returned when the model’s reasoning process finishes.response_idstring
The response ID.item_idstring
The item ID.output_indexint
The index of the output item in the response.content_indexint
The index of the content part in the item’s content array.thinkingstring
The complete reasoning text.
Response text delta (response.text.delta)
Returned as the model generates text output.response_idstring
The response ID.item_idstring
The response item ID.output_indexint
The index of the output item in the response.content_indexint
The index of the content part containing the text.deltastring
The generated text delta.
Response text done (response.text.done)
Returned when the model’s text output is complete. Also emitted when a response is interrupted, incomplete, or cancelled.response_idstring
The response ID.item_idstring
The response item ID.output_indexint
The index of the output item in the response.content_indexint
The index of the content part containing the text.textstring
The complete generated text.
Conversation item created (conversation.item.created)
Returned when a conversation item is created.idstring
The unique ID of the message. Optional; the server generates one if the client does not provide it.typestring
The item type, usuallymessage.rolestring
The role of the sender (user,assistant,system); applies to message items only.statusstring
The item status (completed,incomplete).contentarray
The message content; applies to message items.
Conversation item deleted (conversation.item.deleted)
Returned when the client deletes a conversation item withconversation.item.delete. Used to keep the server’s conversation history in sync with the client.
item_idstring
The conversation item ID.
Input audio transcription completed (conversation.item.input_audio_transcription.completed)
The output of the automatic speech recognition (ASR) of the user’s input audio. Transcription starts when the client commits the buffer, or when the buffer is committed in Server VAD mode. It runs asynchronously with response creation, so this event may arrive before or after the response events.item_idstring
The conversation item ID.content_indexint
The index of the audio content part.transcriptstring
The complete transcript of the audio.
Audio buffer committed (input_audio_buffer.committed)
Returned when the client commits the input audio buffer.previous_item_idstring
The previous item ID in the conversation.item_idstring
The conversation item ID.
Audio buffer cleared (input_audio_buffer.cleared)
Returned when the client clears the input audio buffer withinput_audio_buffer.clear.
Response output item added (response.output_item.added)
Returned when a new item is created during response generation.-
output_indexint
The index of the output item in the response. -
itemobject
The output item.
Response output item done (response.output_item.done)
Returned when an item is completed. Also emitted when the response isinterrupted, incomplete, or cancelled.
output_indexint
The index of the output item in the response.itemobject
The output item (same structure as inresponse.output_item.added).
Response content part added (response.content_part.added)
Returned when a new content part is added to an assistant message item during response generation.-
response_idstring
The response ID. -
item_idstring
The corresponding item ID. -
content_indexint
The index of the content part in the item’s content array. -
output_indexint
The index of the output item in the response. -
partobject
Response content part done (response.content_part.done)
Returned when a content part is completed. Also emitted when the corresponding response isinterrupted, incomplete, or cancelled.
response_idstring
The response ID.item_idstring
The corresponding item ID.content_indexint
The index of the content part in the item’s content array.output_indexint
The index of the output item in the response.partobject
Same structure as inresponse.content_part.added.
Response created (response.created)
Returned when a new Response is created. This is the first event of response creation, with an initial status ofin_progress.
idstring
The unique ID of the response.objectstring
The object type,realtime.response.statusstring
The response status (in_progress,completed,cancelled,failed,incomplete).outputlist
The list of output items generated by the response.
Response done (response.done)
Returned when the Response finishes streaming. Always emitted, regardless of the final status. The Response object includes all output items but omits the raw audio data.idstring
The unique ID of the response.objectstring
The object type,realtime.response.statusstring
The final status (completed,cancelled,failed,incomplete).outputlist
The list of output items generated by the response.