Skip to main content
Real-time speech synthesis (Qwen-TTS-Realtime)

Server events

Server events for the Qwen-TTS-Realtime API.

Reference: Real-time speech synthesis.

error

Sent for both client-side and server-side errors.
event_idstringThe server-side event ID.typestringThe event type. This value is always error.errorobjectThe error details.

Properties

codestringThe error code.messagestringThe error message.
{
  "event_id": "event_QzAVZRVa9hKqM5VOaHunh",
  "type": "error",
  "error": {
    "code": "invalid_value",
    "message": "Session update error: session already started or finished or failed."
  }
}

session.created

Sent when a client connects. Includes the default session configuration.
event_idstringThe server-side event ID.typestringThe event type. This value is always session.created.sessionobjectThe session configuration.

Properties

idstringThe session ID.objectstringThe session service name.modestringThe interaction mode. Valid values are server_commit or commit.modelstringThe model in use.voicestringThe voice in use.response_formatstringThe audio format.sample_rateintegerThe audio sampling rate.
{
  "event_id": "event_xxx",
  "type": "session.created",
  "session": {
    "object": "realtime.session",
    "mode": "server_commit",
    "model": "qwen-tts-realtime",
    "voice": "Cherry",
    "response_format": "pcm",
    "sample_rate": 24000,
    "id": "sess_xxx"
  }
}

session.updated

Sent after the server successfully processes a session.update request. On error, an error event is sent instead.
event_idstringThe server-side event ID.typestringThe event type. This value is always session.updated.sessionobjectThe session configuration.

Properties

idstringThe session ID.objectstringThe session service name.modestringThe interaction mode. Valid values are server_commit or commit.modelstringThe model in use.voicestringThe voice in use.response_formatstringThe audio format.sample_rateintegerThe audio sampling rate.language_typestringThe language of the audio.
{
  "event_id": "event_xxx",
  "type": "session.updated",
  "session": {
    "id": "sess_xxx",
    "object": "realtime.session",
    "model": "qwen-tts-realtime",
    "voice": "Cherry",
    "language_type": "Chinese",
    "mode": "commit",
    "response_format": "pcm",
    "sample_rate": 24000
  }
}

input_text_buffer.committed

Sent after the server receives an input_text_buffer.commit event.
event_idstringThe server-side event ID.typestringThe event type. This value is always input_text_buffer.committed.item_idstringThe ID of the user message item to create.
{
  "event_id": "event_FC6MA88wS2oEeXkPvWsxX",
  "type": "input_text_buffer.committed",
  "item_id": ""
}

input_text_buffer.cleared

The server’s response event after the client sends the input_text_buffer.clear event.
event_idstringThe server-side event ID.typestringThe event type. This value is always input_text_buffer.cleared.
{
    "event_id": "event_1122",
    "type": "input_text_buffer.cleared"
}

response.created

The server sends this event after it receives an input_text_buffer.commit event from the client.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.created.responseobjectThe response details.

Properties

idstringThe response ID.objectstringThe object type. This value is always realtime.response.statusstringThe final status of the response. Valid values are:
  • completed
  • failed
  • in_progress
  • incomplete
voicestringThe voice in use.outputarrayThis field is empty for this event.
{
  "event_id": "event_IMnLqDvG6Ahhk7sWV2uOs",
  "type": "response.created",
  "response": {
    "id": "resp_USvBwHktHcz76r6GaIJUV",
    "object": "realtime.response",
    "conversation_id": "",
    "status": "in_progress",
    "voice": "Cherry",
    "output": []
  }
}

response.output_item.added

Sent when a new output item is ready.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.output_item.added.response_idstringThe ID of the response.output_indexintegerThe index of the response output item. This value is always 0.itemobjectThe output item details.

Properties

idstringThe output item ID.objectstringThis value is always realtime.item.statusstringThe status of the output item.contentarrayThe content of the message.
{
  "event_id": "event_INDGnGNulaXCrStd9ZM5X",
  "type": "response.output_item.added",
  "response_id": "resp_USvBwHktHcz76r6GaIJUV",
  "output_index": 0,
  "item": {
    "id": "item_FIrYGaNVK3rbIZqeY4QjM",
    "object": "realtime.item",
    "type": "message",
    "status": "in_progress",
    "role": "assistant",
    "content": []
  }
}

response.content_part.added

Sent when a new content part is ready.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.content_part.added.response_idstringThe ID of the response.item_idstringThe ID of the message item.output_indexintegerThe index of the response output item. This value is always 0.content_indexintegerThe index of the content part within the response output item. This value is always 0.partobjectThe completed content part.

Properties

typestringThe type of the content part.textstringThe text of the content part.
{
  "event_id": "event_DigZ95MWN36YYyyjcENoq",
  "type": "response.content_part.added",
  "response_id": "resp_USvBwHktHcz76r6GaIJUV",
  "item_id": "item_FIrYGaNVK3rbIZqeY4QjM",
  "output_index": 0,
  "content_index": 0,
  "part": {
    "type": "audio",
    "text": ""
  }
}

response.audio.delta

Sent when the model generates new audio data incrementally.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.audio.delta.response_idstringThe ID of the response.item_idstringThe ID of the message item.output_indexintegerThe index of the response output item. This value is always 0.content_indexintegerThe index of the content part within the response output item. This value is always 0.deltastringAudio data generated incrementally by the model. The data is Base64-encoded.
{
  "event_id": "event_B1osWMZBtrEQbiIwW0qHQ",
  "type": "response.audio.delta",
  "response_id": "resp_B1osWTzBb8hO0WsELHgVP",
  "item_id": "item_B1osWH81fXDoyim1T5fsF",
  "output_index": 0,
  "content_index": 0,
  "delta": "base64 audio"
}

response.content_part.done

Sent when a content part is complete.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.content_part.done.response_idstringThe ID of the response.item_idstringThe ID of the message item.output_indexintegerThe index of the response output item. This value is always 0.content_indexintegerThe index of the content part within the response output item. This value is always 0.partobjectThe completed content part.

Properties

typestringThe type of the content part.textstringThe text of the content part.
{
  "event_id": "event_Vo2YUjlYQJ4colH8nVzkU",
  "type": "response.content_part.done",
  "response_id": "resp_USvBwHktHcz76r6GaIJUV",
  "item_id": "item_FIrYGaNVK3rbIZqeY4QjM",
  "output_index": 0,
  "content_index": 0,
  "part": {
    "type": "audio",
    "text": ""
  }
}

response.output_item.done

Sent when an output item is complete.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.output_item.done.response_idstringThe ID of the response.output_indexintegerThe index of the response output item. This value is always 0.itemobjectThe output item details.

Properties

idstringThe output item ID.objectstringThis value is always realtime.item.statusstringThe status of the output item.contentarrayThe content of the message.
{
  "event_id": "event_LO6SJRKIQ9NBayyYB8a1A",
  "type": "response.output_item.done",
  "response_id": "resp_USvBwHktHcz76r6GaIJUV",
  "output_index": 0,
  "item": {
    "id": "item_FIrYGaNVK3rbIZqeY4QjM",
    "object": "realtime.item",
    "type": "message",
    "status": "completed",
    "role": "assistant",
    "content": [
      {
        "type": "audio",
        "text": ""
      }
    ]
  }
}

response.audio.done

Sent when the model finishes generating audio data.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.audio.done.response_idstringThe ID of the response.item_idstringThe ID of the message item.output_indexintegerThe index of the response output item. This value is always 0.content_indexintegerThe index of the content part within the response output item. This value is always 0.
{
  "event_id": "event_LZaOHPzXYMUXGBcVkBmKX",
  "type": "response.audio.done",
  "response_id": "resp_USvBwHktHcz76r6GaIJUV",
  "item_id": "item_FIrYGaNVK3rbIZqeY4QjM",
  "output_index": 0,
  "content_index": 0
}

response.done

Sent when response generation is complete. The response object contains all output items but excludes the already-sent raw audio data.
event_idstringThe server-side event ID.typestringThe event type. This value is always response.done.response_idstringThe ID of the response.responseobjectThe response details.

Properties

idstringThe response ID.objectstringThe object type. This value is always realtime.response.outputarrayResponse output.usageobjectBilling information for this speech synthesis request.

Properties

charactersintegerThe number of characters billed for Qwen3-TTS Realtime.total_tokensintegerTotal token count for input and output (synthesized audio).input_tokensintegerToken count for input content.output_tokensintegerToken count for output content.input_tokens_detailsintegerDetailed token count for input content.input_tokens_details.text_tokensintegerToken count for input text content.output_tokens_detailsintegerDetailed token count for output content.output_tokens_details.text_tokensintegerToken count for output text content.output_tokens_details.audio_tokensintegerToken count for output audio content.Audio-to-token conversion rule: 1 second = 50 tokens. Audio under 1 second counts as 50 tokens.
{
    "event_id": "event_Aemy83XqHFFDDSeJIDn6N",
    "type": "response.done",
    "response": {
        "id": "resp_LFeR42yXZ9SxUAeXjmyTz",
        "object": "realtime.response",
        "conversation_id": "",
        "status": "completed",
        "modalities": [
            "text",
            "audio"
        ],
        "voice": "Cherry",
        "output": [
            {
                "id": "item_Ae1lv2XmRljRSG96L8Zm1",
                "object": "realtime.item",
                "type": "message",
                "status": "completed",
                "role": "assistant",
                "content": [
                    {
                        "type": "audio",
                        "transcript": ""
                    }
                ]
            }
        ],
        "usage": {
            "characters": 25
        }
    }
}

session.finished

Sent when all responses have been generated.
event_idstringThe server-side event ID.typestringThe event type. This value is always session.finished.
{
  "event_id": "event_2239",
  "type": "session.finished"
}
Text Generation
Image Generation
  • FAQ
Video Generation
Audio
Realtime API
Text Embedding
Model Production