Skip to main content
Qwen-Omni-Realtime

Qwen-Omni client events

WebSocket client reference

Events sent from the client to the server over WebSocket.
For non-realtime usage, Qwen-Omni is available through the Chat API.

session.update

Send this event after connecting to update the session configuration. The service validates your parameters and returns the updated configuration (excluding MCP endpoint and credential fields for Qwen3.8-Omni-Flash-Realtime), or an error.
Example
{
  "event_id": "event_ToPZqeobitzUJnt3QqtWg",
  "type": "session.update",
  "session": {
  "modalities": ["text", "audio"],
  "voice": "Chelsie",
  "input_audio_format": "pcm",
  "output_audio_format": "pcm",
  "instructions": "You are an AI customer service agent for a five-star hotel. Please answer customer inquiries about room types, facilities, prices, and reservation policies accurately and in a friendly manner. Always respond with a professional and helpful attitude. Do not provide unconfirmed information or information beyond the scope of the hotel's services.",
  "turn_detection": {
      "type": "server_vad",
      "threshold": 0.5,
      "silence_duration_ms": 800
  },
  "enable_search": true,
  "search_options": {
      "enable_source": true
  },
  "tools": [
      {
      "type": "function",
      "function": {
          "name": "get_current_weather",
          "description": "Useful for querying the weather in a specific city.",
          "parameters": {
          "type": "object",
          "properties": {
              "location": {
              "type": "string",
              "description": "The city or district, such as Beijing, Hangzhou, or Yuhang District."
              }
          },
          "required": ["location"]
          }
      }
      }
  ],
  "seed": 1314,
  "max_tokens": 16384,
  "repetition_penalty": 1.05,
  "presence_penalty": 0.0,
  "top_k": 50,
  "top_p": 1.0,
  "temperature": 0.9
  }
}
string
body
required
Event type. Always session.update.
object
body
Session configuration.For Qwen3.8-Omni-Flash-Realtime, session is required when updating a session. The total input token limit is 196608, calculated using the same rules as Qwen3.5-Omni-Realtime.

Audio configuration

audio object (optional) Input and output audio configuration. Omitted fields retain their existing defaults. The format and sample rate options below apply to qwen3.5-omni-plus-realtime and qwen3.5-omni-flash-realtime. For multichannel input fields and constraints, see Multichannel audio input.

Multichannel audio input

The following multichannel audio configuration applies to Qwen3.8-Omni-Flash-Realtime over WebSocket.
FieldTypeRequired / defaultValues and constraints
typestringOptional; pcmMultichannel input must use pcm.
sample_rateintegerOptional; 16000Multichannel input must use 16000 Hz.
sample_formatstringOptional; s16leOnly s16le.
channelsintegerOptional; 1Only 1, 2, or 4.
packingstringOptional; interleavedOnly interleaved.
channel_layoutstringOptional; determined by channelsmono for 1 channel, raw_mic_array for 2, foa_ambix for 4. An explicit value must match channels.
Multichannel input requires PCM, 16000 Hz, s16le, and interleaved samples. Configure the format before sending the first audio segment; these fields cannot change after audio input starts. Omitted fields use their defaults. Supplied fields must have valid types and values; do not send null instead of omitting a field. Two-channel configuration:
{
  "type": "session.update",
  "session": {
    "audio": {
      "input": {
        "format": {
          "type": "pcm",
          "sample_rate": 16000,
          "sample_format": "s16le",
          "channels": 2,
          "packing": "interleaved",
          "channel_layout": "raw_mic_array"
        }
      }
    }
  }
}
Four-channel configuration:
{
  "type": "session.update",
  "session": {
    "audio": {
      "input": {
        "format": {
          "type": "pcm",
          "sample_rate": 16000,
          "sample_format": "s16le",
          "channels": 4,
          "packing": "interleaved",
          "channel_layout": "foa_ambix"
        }
      }
    }
  }
}
Compatible single-channel configuration:
{
  "type": "session.update",
  "session": {
    "audio": {
      "input": {
        "format": {
          "type": "pcm",
          "sample_rate": 16000
        }
      }
    }
  }
}
For 2-channel and 4-channel spatial audio, the input token count is twice that of ordinary audio. See Token calculation.

Output voice

The following configuration applies to Qwen3.8-Omni-Flash-Realtime. session.audio.output.voice is an optional string for the output voice, which defaults to Tina. longanlingxin is newly supported. The optional compatibility field session.voice remains available; use session.audio.output.voice for new integrations. If both are supplied, session.audio.output.voice takes precedence. See voices.
{
  "type": "session.update",
  "session": {
    "audio": {
      "output": {
        "voice": "longanlingxin"
      }
    }
  }
}

Video configuration

The following configuration applies to Qwen3.8-Omni-Flash-Realtime. representation_compact is an optional string. The initial session default is none. none preserves the full fine-grained video representation; normal aggregates it to reduce computation for scenarios that do not require fine visual detail. For the same video input, normal uses one quarter of the tokens used by none. See Token calculation. Set this field before the first audio segment; it cannot change after audio input starts.
{
  "type": "session.update",
  "session": {
    "video": {
      "input": {
        "representation_compact": "normal"
      }
    }
  }
}

MCP tool configuration

The following configuration applies to Qwen3.8-Omni-Flash-Realtime. Required fields must be supplied when their containing object is present. IDs are opaque strings; do not rely on their lengths, prefixes, or generation rules. MCP connections, discovery, and calls are subject to service quotas and timeouts. An element with type="mcp" configures an MCP server. A session can contain both Function Calling and MCP tools. tools and enable_search are mutually exclusive, including MCP tools. For server and tool quotas, timeouts, and result size limits, see MCP call limits.
FieldTypeRequired / defaultConstraints
typestringRequiredmcp
server_labelstringRequiredUnique within the session; 1-64 characters; letters, digits, underscores, and hyphens only.
server_urlstringRequiredPublic HTTPS address on port 443; up to 4096 characters; MCP Streamable HTTP endpoint.
authorizationstringOptionalOutbound Authorization value; up to 8192 printable ASCII characters.
headersobjectOptionalUp to 16 string-to-string HTTP header pairs.
allowed_toolsarray of stringsOptional; all tools when omittedAn empty array exposes no tools. Each name is 1-64 characters, with letters, digits, underscores, periods, and hyphens only. Applied after discovery.
require_approvalstringOptional; alwaysalways or never.
server_url must not contain a username, password, or fragment. Its domain must resolve to public addresses. Header names must be 1-128 characters and use standard HTTP header-name characters. Header values must contain only printable ASCII and be at most 8192 characters. The following headers are prohibited:
Prefixes: mcp-, proxy-, x-forwarded-
Names: host, authorization, connection, content-length, transfer-encoding,
accept, content-type, forwarded, cookie, origin, upgrade, te, trailer
Every MCP configuration addition or update requires both server_label and server_url; supplying only a label does not reuse a configuration. Update MCP configuration only when there is no active Response. server_url, authorization, and headers are used only for the server-side connection and are not echoed in session.updated. Do not reconstruct sensitive connection settings from that event. Replace the placeholder endpoint and credential in this configuration fragment with your MCP server details before sending it over an established connection:
{
  "type": "session.update",
  "session": {
    "tools": [
      {
        "type": "mcp",
        "server_label": "amap",
        "server_url": "https://example.com/mcp",
        "authorization": "Bearer ***",
        "allowed_tools": ["maps_weather"],
        "require_approval": "always"
      }
    ]
  }
}

response.create

Tells the service to generate a model response. In VAD mode, responses are automatic and you do not need this event. The service responds with response.created, then item and content events (conversation.item.created, response.content_part.added), and finally response.done.
Example
{
  "type": "response.create",
  "event_id": "event_1718624400000"
}
string
body
required
Event type. Always response.create.

response.cancel

Cancels an ongoing response. Returns an error if no response is in progress.
Example
{
  "event_id": "event_B4o9RHSTWobB5OQdEHLTo",
  "type": "response.cancel"
}
string
body
required
Event type. Always response.cancel.

input_audio_buffer.append

Appends audio bytes to the input buffer.
Example
{
  "event_id": "event_B4o9RHSTWobB5OQdEHLTo",
  "type": "input_audio_buffer.append",
  "audio": "UklGR..."
}
string
body
required
Event type. Always input_audio_buffer.append.
string
body
required
The Base64-encoded audio data.

input_audio_buffer.commit

Submits the input audio buffer as a user message. Returns an error if the buffer is empty.
  • VAD mode: Automatic. You do not need this event.
  • Manual mode: Required to create a user message.
Submitting the buffer does not trigger a model response. The service responds with input_audio_buffer.committed.
If you have sent an input_image_buffer.append event, input_audio_buffer.commit submits the image buffer along with the audio buffer.
Example
{
  "event_id": "event_B4o9RHSTWobB5OQdEHLTo",
  "type": "input_audio_buffer.commit"
}
string
body
required
Event type. Always input_audio_buffer.commit.

input_audio_buffer.clear

Clears the audio buffer. The service responds with input_audio_buffer.cleared.
Example
{
  "event_id": "event_xxx",
  "type": "input_audio_buffer.clear"
}
string
body
required
Event type. Always input_audio_buffer.clear.

input_image_buffer.append

Adds image data to the image buffer from local files or video streams. Limits:
  • Format: JPG or JPEG. Recommended: 480p or 720p. Maximum: 1080p.
  • Size: ≤256 KB after Base64 encoding (recommend raw image below 190 KB).
  • Encoding: Base64.
  • Frequency: 1 image per second.
  • Prerequisite: Send at least one input_audio_buffer.append event first.
The image buffer is submitted with the audio buffer through the input_audio_buffer.commit event.
Example
{
  "event_id": "event_xxx",
  "type": "input_image_buffer.append",
  "image": "xxx"
}
string
body
required
Event type. Always input_image_buffer.append.
string
body
required
The Base64-encoded image data.

conversation.item.create

Returns the execution result of a tool function to the server. After the model triggers a tool call, execute the tool function locally, send the result back using this event, then send a response.create event to trigger the model to generate the final response.
This section describes function_call_output items. For Qwen3.8-Omni-Flash-Realtime MCP approval replies, see mcp_approval_response.
Example
{
  "event_id": "event_55099cddb51b4f208cb95d1a994eef80",
  "type": "conversation.item.create",
  "item": {
    "id": "item_2a80d7682b4e473c9c2154da135041e9",
    "type": "function_call_output",
    "call_id": "call_62c24725afdb4c2680ac54",
    "output": "The weather in Beijing today is changing from haze to clear, with a temperature of 4/-4°C and a light breeze."
  }
}
string
body
required
Event type. Always conversation.item.create.
object
body
required
The conversation item to create.

MCP approval response (Qwen3.8-Omni-Flash-Realtime)

When require_approval is always or omitted, the server may send mcp_approval_request. Reply with the existing conversation.item.create event.
FieldTypeRequiredMeaning
event_idstringNoClient-generated tracing ID.
typestringYesconversation.item.create
itemobjectYesApproval response.
item.typestringYesmcp_approval_response
item.approval_request_idstringYesExact item.id of an unhandled mcp_approval_request.
item.approvebooleanYestrue allows execution; false rejects it and the call enters failed.
{
  "event_id": "event_client_xxx",
  "type": "conversation.item.create",
  "item": {
    "type": "mcp_approval_response",
    "approval_request_id": "opaque_approval_id",
    "approve": true
  }
}
For Qwen3.8-Omni-Flash-Realtime, session.updated does not echo MCP endpoint or credential fields; see the Qwen3.8 client events.
Qwen-Omni client events - QwenCloud