Features
The image generation agent provides text-to-image, image-to-image, and scribble-to-image capabilities via HTTP. Currently, only pass-through links are supported.
This service is ideal for use cases such as generating wallpapers, creating scribble art, enhancing photos, and stylizing images.
A pass-through link sends a request directly to the image generation agent and returns the resulting image, bypassing nodes such as automatic speech recognition (ASR), intent recognition, and text-to-speech (TTS).
Integration
Prerequisites
Activate Alibaba Cloud Model Studio (Bailian) and obtain an API key.
The API key authenticates your access to Alibaba Cloud Model Studio (Bailian). For instructions, see Obtain an API Key.
Console configuration
- In the multi-modal development kit, create a multimodal interactive application. Select the All-in-one Edition (not the Vision Edition), disable Voice Interaction, and ensure Intent Recognition and Text Model remain enabled. For Text Model, select Multimodal Interaction Proprietary Model - High-speed Edition.
-
Disable Dialogue Context, Knowledge Base, Internet Search, and Long-term Memory.
Set Number of Context Rounds to
5. - Clear all settings for Skills and MCP Service. From the list of agents, keep only the Image Generation Agent.
-
Configure the Image Generation Agent, which supports three features: Scribble to Image, Image Assistant, and text-to-image.
- Scribble to Image: Generates images from hand-drawn scribbles or line art.
- Image Assistant: Generates new images from an uploaded image.
- Text-to-image: Generates images from text prompts.
- Each feature supports options such as Model Selection, Prompts, Intelligent Optimization of Positive Prompts, and Negative Prompts. You can add variables to prompts to dynamically pass different content. For Scribble to Image, the Model Selection option provides three choices: Image-to-Image Advanced Edition, Image-to-Image Balanced Edition, and Image-to-Image Lightweight Edition.
- After configuring the application, click the Publish button in the upper-right corner. You cannot test the application until it is published.
HTTP access
Request parameters
Parameter | Sub-parameter | Type | Required | Description |
model | string | Yes | The name of the Model Studio model. Set this value to | |
input | directive | string | Yes | The directive name. Set this to Request. |
app_id | string | Yes | Your application ID. You can find it on the "My Applications" page of the Multimodal Interaction Development Kit console. For more information, see Get an Application ID. | |
dialog_id | string | No | The dialog ID. If you omit this parameter, the server starts a new dialog and returns a dialog ID. The ID is a 36-character string, such as | |
text | string | Yes | The text to process. For this use case, if there is no text, set this parameter to an empty string ( | |
parameters | client_info | object | Yes | For parameter details, see the Parameters: |
images | list[] | No | The reference images. Required for image-to-image scenarios, but optional for text-to-image scenarios. For parameter details, see the Parameters: | |
biz_params | object | No | Configure this parameter as needed. For parameter details, see the Parameters: |
Parameters: parameters.client_info
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
user_id | string | Yes | The end user ID. Generate this ID based on your business rules. It enables customized features for different end users. Maximum length: 36 characters. | |
device | uuid | string | No | A globally unique ID for the client. Generate this ID and pass it to the SDK. Maximum length: 40 characters. An end user can have multiple devices, each with a different UUID but the same |
Parameters: parameters.images
Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | The type of the image. Valid values: |
value | string | Yes | The image content.
|
Parameters: parameters.biz_params
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
commands[i] | name | string | Yes | Indicates a direct pass-through to the agent. Set this value to |
exec_params | object | Yes | Specifies the agent. This value is fixed for this use case. See the Parameters: | |
user_defined_params | image_to_image | object | No | User-defined agent parameters. The |
Parameters: parameters.biz_params.commands.exec_params
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
exec_params | app_id | string | Yes | The agent to use. For this use case, set this to |
intent | string | Yes | Specifies the action for the agent. For this use case, set the value to | |
slots | list[] | Yes | The slot information required by the agent. |
Parameters: parameters.biz_params.commands.exec_params.slots
name | string | Yes | The name of the slot. |
norm_value | string | Yes | The value of the slot. |
function and size slots as shown in the following example.
function parameter specifies the image generation feature to use. Supported values:
textToImage: text-to-imageimageAssistant: Image AssistantsketchToImage: Sketch-to-image
size parameter specifies the resolution of the generated image. The supported resolution range depends on the selected feature and model. See the following table for supported resolutions.
Image generation mode | Model configuration | Supported resolutions |
text-to-image | Lightweight Edition | The image width and height must be between 200 and 2048 pixels. The aspect ratio must be between 1:4 and 4:1. For example, a resolution of 256×2048 is not allowed because its aspect ratio is 1:8. |
Balanced Edition | ||
Advanced Edition | Total pixels (width × height): Must be between 1,638,400 (1280×1280) and 2,073,600 (1440×1440). Image aspect ratio: Must be between 1:4 and 4:1. | |
Image Assistant/Sketch-to-image | Lightweight Edition | Image resolution: The width and height must both be between 512 and 4096 pixels. |
Balanced Edition | Total pixels (width × height): Must be between 262,144 (512×512) and 4,194,304 (2048×2048). | |
Advanced Edition | Total pixels (width × height): Must be between 589,824 (768×768) and 4,194,304 (2048×2048). |
Parameters: parameters.biz_params.user_defined_params.image_to_image.user_prompt_params
In the prompt area of the Sketch-to-image configuration panel, click the {x} Custom Variable button in the upper-right corner to add custom variables. ${style} is a default, built-in variable.
Parameter | Sub-parameter | Type | Required | Description |
|---|---|---|---|---|
user_prompt_params | positive | object | No | Custom variables for the prompt. |
negative | object | Yes | Custom variables for the negative prompt. |
Text-to-image request example
Text-to-image cURL request example
Image assistant request
Image assistant cURL request
Sketch-to-image request
Use the Image Assistant request example, changing the value of the function slot in parameters.biz_params.commands.exec_params.slots from imageAssistant to sketchToImage.
The RespondingContent event
Top-level parameter | Second-level parameter | Type | Required | Description |
|---|---|---|---|---|
output | event | string | Yes | Event name: RespondingContent |
dialog_id | string | Yes | A unique identifier for the dialog. | |
round_id | string | Yes | A unique identifier for the current round of interaction. | |
llm_request_id | string | Yes | The request ID for the call to the large language model (LLM). | |
text | string | Yes | The URL of the generated image. The value is | |
spoken | string | Yes | Content for Text-to-Speech (TTS) synthesis. Ignore this field if TTS is not enabled. In the examples in this guide, its value is the same as the | |
finished | bool | Yes | Indicates whether the output stream has finished. | |
finish_reason | string | No | The reason the output stream finished. Currently, only one value is supported:
| |
extra_info | object | No | Additional information. Currently, the following field is supported:
|
Parameters for output.extra_info.agent_info
Top-level parameter | Second-level parameter | Type | Required | Description |
|---|---|---|---|---|
round | string | Yes | The dialog round number. | |
device | device_id | string | Yes | Corresponds to the |
intent_infos | intent | string | Yes | The intent being executed. For the examples in this guide, the value is always "open_image_to_image". |
domain | string | Yes | The domain of the intent. For the examples in this guide, the value is always "image_to_image". |