Aliyun Image Generation
Create images using the Alibaba Cloud Model Studio / DashScope image format. Use the official model, input.messages, and parameters request structure; the platform only provides a unified endpoint, authentication, model routing, and billing.
Supported Models
This endpoint is only for Alibaba Cloud Model Studio / DashScope image generation or editing models, and it only routes to Aliyun channels configured on the platform. The examples follow these official model families:
| Model / Family | Use case | Notes |
|---|---|---|
qwen-image-2.0-pro, qwen-image-2.0 | Qwen text-to-image | Pass prompts in messages[].content[].text |
qwen-image-max, qwen-image-plus, qwen-image | Qwen text-to-image | Pass prompts in messages[].content[].text |
wan2.6-image | Wanxiang image generation and editing | Use text and optional image items in messages[].content[] |
For non-Aliyun image models, such as OpenAI, Volcengine Seedream, or Gemini models, use the matching image endpoint instead of this one.
Try It
/aliyun/v1/images/generationshttps://api-platform.ope.aiAuthentication
Uses Bearer Token authentication.
- Header:
Authorization: Bearer <token> - Example:
Authorization: Bearer sk-xxxxxx
Request body (application/json)
| Field | Type | Required | Description | Default / Range |
|---|---|---|---|---|
model | string | Yes | Alibaba Cloud Model Studio / DashScope image model ID. The platform may map it through channel configuration | Examples: qwen-image-2.0-pro, qwen-image, wan2.6-image |
input | object | Yes | Image generation input | - |
parameters | object | No | Generation parameters | - |
input
| Field | Type | Required | Description |
|---|---|---|---|
messages | array<object> | Yes | Request content array. The official Aliyun docs currently describe single-turn input |
messages
| Field | Type | Required | Description |
|---|---|---|---|
role | string | Yes | Fixed to user |
content | array<object> | Yes | Message content array |
content
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Positive prompt. Qwen-Image text-to-image and Wan2.6 Image both use one text item in content in the official docs |
image | string | No | Wan2.6 Image reference image. Supports public image URLs or Base64 image strings |
parameters
| Field | Type | Required | Description | Default / Range |
|---|---|---|---|---|
size | string | No | Output size. Use Aliyun's official width*height format, such as 2048*2048 or 1280*1280; Wan2.6 Image also supports 1K and 2K | Official model default |
n | integer | No | Number of output images | Official model limit |
negative_prompt | string | No | Negative prompt | - |
prompt_extend | boolean | No | Whether to enable prompt rewriting | Official model default |
watermark | boolean | No | Whether to add a watermark | Official model default |
seed | integer | No | Qwen-Image random seed | 0 to 2147483647 |
enable_interleave | boolean | No | Wan2.6 Image interleaved text-image output mode | false |
max_images | integer | No | Maximum generated images in Wan2.6 Image interleaved mode | Official model limit |
stream | boolean | No | Required with streaming output for Wan2.6 Image interleaved synchronous calls | Follow the official model docs |
Request examples
The domain below is an example:
https://api-platform.ope.ai.
- cURL
- JavaScript
- Python
- Reference image
curl -X POST "https://api-platform.ope.ai/aliyun/v1/images/generations" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-2.0-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "A white mechanical cat sitting beside a minimal desk, cinematic lighting, high detail."
}
]
}
]
},
"parameters": {
"size": "2048*2048",
"n": 1,
"prompt_extend": true,
"watermark": false
}
}'
const apiKey = process.env.OPEAI_API_KEY;
const res = await fetch("https://api-platform.ope.ai/aliyun/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "qwen-image-2.0-pro",
input: {
messages: [
{
role: "user",
content: [
{
text: "A white mechanical cat sitting beside a minimal desk, cinematic lighting, high detail.",
},
],
},
],
},
parameters: {
size: "2048*2048",
n: 1,
prompt_extend: true,
watermark: false,
},
}),
});
console.log(await res.json());
import os
import requests
resp = requests.post(
"https://api-platform.ope.ai/aliyun/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ.get('OPEAI_API_KEY')}",
"Content-Type": "application/json",
},
json={
"model": "qwen-image-2.0-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "A white mechanical cat sitting beside a minimal desk, cinematic lighting, high detail.",
},
],
},
],
},
"parameters": {
"size": "2048*2048",
"n": 1,
"prompt_extend": True,
"watermark": False,
},
},
timeout=120,
)
print(resp.json())
{
"model": "wan2.6-image",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Use this product image as reference and generate a clean ecommerce hero image."
},
{
"type": "image",
"image": "https://example.com/reference.png"
}
]
}
]
},
"parameters": {
"size": "1K",
"prompt_extend": true,
"enable_interleave": false,
"n": 1
}
}
Response examples
The platform passes through the Aliyun upstream response body. Successful responses typically include output.choices[]; the platform uses the generated image count from the upstream response for billing.
- Success
- Error
{
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result.example.com/generated-image.png"
}
]
}
}
]
},
"usage": {
"image_count": 1,
"width": 2048,
"height": 2048
},
"request_id": "8f0b9c7a-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
{
"error": {
"message": "only aliyun channel is supported on /aliyun/v1/images/generations",
"type": "invalid_request_error",
"code": "invalid_request"
}
}
Notes
- This endpoint only supports Alibaba Cloud Model Studio / DashScope image models and only routes to Aliyun channels. If the model cannot match an Aliyun channel, the platform returns an error.
- Request fields, value ranges, image input limits, and response shape should follow the official Aliyun documentation for the selected model.