This document describes how to use the WebSocket protocol to send voice requests directly to the Image Generation Agent for text-to-image generation.
Key concepts
Direct passthrough: Sends a voice request directly to an agent, bypassing intent recognition.

Use cases
This feature is suitable for scenarios that require text-to-image generation, such as AI-powered printers or educational devices.
Prerequisites
You must first read Start a session to understand the overall WebSocket protocol for real-time multimodal interaction.
Activate Model Studio and get an API key
Refer to Get an API key. The API key authenticates requests to Model Studio.
Console configuration
-
In the Multimodal Development Kit console, create a multimodal interaction application. Select the All-in-one edition (not the Vision edition), enable speech recognition, and disable speech synthesis.

-
Keep intent recognition and the text model enabled.

-
Disable follow-up responses, knowledge base, web search, and long-term memory.

-
Clear all skills and MCP services. Keep only the Image Generation Agent.

- Configure the Image Generation Agent. Currently, direct voice passthrough to the Image Generation Agent only supports the text-to-image mode. The sketch-to-image and image assistant modes are not supported.
-
Each function provides options for model selection, prompts, smart positive prompt optimization, and negative prompts. You can add variables to your prompts to dynamically pass in different content.


- After you complete the configuration, click Publish in the upper-right corner. You must publish the application before you can test it.
WebSocket protocol integration
Start a session
Refer to the instructions in Start a session. You must apply the following configurations in the session start message.
Enable streaming text responses
- Set the
parameters.downstream.intermediate_textfield todialog. - Set the
parameters.downstream.incremental_responsefield totrue.
Set direct passthrough agent and parameters
Use the parameters.biz_params.commands[] field to set the direct passthrough agent.
Use the parameters.biz_params.user_defined_params field to set the parameters to pass through to the agent.
Parent parameter | Parameter | Sub-parameter | Type | Description |
commands[] | ||||
name | String | Set to the fixed value | ||
exec_params | Object | |||
app_id | String | The ID of the agent to which the request is passed directly. For this procedure, set this to | ||
intent | String | For this procedure, set this to | ||
slots | Array | The slot information required by the agent. | ||
user_defined_params | Object | Parameters to pass through to the agent. | ||
image_to_image | Object | Specifies the parameters passed to the Image Generation Agent. | ||
user_prompt_params | Object | Used to pass custom variables defined in the prompt for the Image Generation Agent. |
parameters.biz_params.commands.exec_params.slots parameter
name | string | Yes | The name of the slot. |
norm_value | string | Yes | The value of the slot. |
function and size slots.
function parameter specifies the image generation feature. Three values are supported, but this document only covers text-to-image.
textToImage: text-to-imageimageAssistant: image assistantsketchToImage: sketch-to-image
size parameter specifies the resolution of the generated image. The supported resolution depends on the selected mode and model. The following table lists the supported resolution ranges.
Image generation mode | Model configuration | Supported resolution |
text-to-image | Lightweight | The image width and height must be in the range of [200, 2048], with an aspect ratio between [1:4, 4:1]. For example, 256x2048 is not allowed because its aspect ratio is 1:8. |
Balanced | ||
Advanced | The total number of pixels (width × height) must be between 1,638,400 (1280×1280) and 2,073,600 (1440×1440). Image aspect ratio: [1:4, 4:1] |
parameters.biz_params.user_defined_params.image_to_image.user_prompt_params parameter
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
user_prompt_params | positive | object | Yes | Custom variables for the positive prompt. Required for this procedure. |
negative | object | No | Custom variables for the negative prompt. |
Session start message
Conversation states
When using direct voice passthrough to the Image Generation Agent, the conversation state cycle changes from listening→thinking→responding→listening to listening→thinking→listening. Because this mode does not perform speech synthesis (TTS), the responding state is skipped.
Response event
To parse the image generation response, listen for the RespondingContent event. If image generation takes a long time (for example, due to a high resolution), the service first sends one or more heartbeats before returning the final URL of the generated image.
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
output | event | string | Yes | Event name: RespondingContent |
dialog_id | string | Yes | The dialog ID. | |
round_id | string | Yes | The ID of the current interaction round. | |
llm_request_id | string | Yes | The request ID for the LLM call. | |
text | string | Yes | The URL of the generated image. While the image is being generated, the value is | |
spoken | string | Yes | The content for speech synthesis. You can ignore this field if speech synthesis is disabled. In this implementation, the content is the same as the | |
finished | bool | Yes | Indicates whether the output is complete. | |
finish_reason | string | No | The reason the output finished. Currently, the only value is:
| |
extra_info | object | No | Other extended information. Currently supports:
|
output.extra_info.agent_info parameter
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
round | string | Yes | The conversation round. | |
device | device_id | string | Yes | The |
intent_infos | intent | string | Yes | The intent being executed. In this scenario, the value is |
domain | string | Yes | The agent being used. In this scenario, the value is |