Qwen-Image-Max
Copy success!
Overview
The Max series of qwen’s image generation model excels across a wide range of generation tasks. Compared with the Plus series, it significantly reduces the “AI-like” feel in generated images, enhancing their realism. It delivers more lifelike material textures for human subjects, finer and more detailed natural textures, and more visually appealing text rendering.
Input
Text
Output
Image
Features
Prefix Completion
Enable Partial Mode when calling the Qwen API to make the model continue strictly from your provided prefix text.View docsFunction Calling
Use function calling to connect large language models with external tools and systems.View docsCache
Context Cache stores shared prefixes for long-context requests to reduce repeated computation, improve latency, and lower cost.View docsStructured Outputs
Structured Outputs help ensure the model returns a JSON string in the expected format.View docsPricing
- Image Generation$0.075Per image
Rate Limits
- TPMTokens Per Minute1M
- RPMRequests Per Minute2
API Reference
Call APICopy success!
1234567891011121314151617181920212223242526272829303132333435363738
import json
import os
import dashscope
from dashscope import MultiModalConversation
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
messages = [
{
"role": "user",
"content": [
{"text": "An elegant and solemn couplet hangs in a hall. The room features tranquil, classic Chinese decor. On the table are several blue and white porcelain items. The left scroll of the couplet reads, "Righteousness is the root of innate knowledge. Humans and machines share the same path and excel in innovative thinking (Chinese: 义本生知人机同道善思新)". The right scroll reads, "Connecting to the cloud imparts wisdom. The cosmos reveals its patterns and inspires lofty ambitions (Chinese: 通云赋智乾坤启数高志远)". The horizontal scroll reads, "Wisdom enlightens Tongyi (Chinese: 智启通义)". The calligraphy is flowing. A Chinese-style painting of Yueyang Tower hangs in the middle."}
]
}
]
# If the environment variable is not set, replace it with your Model Studio API key: api_key="sk-xxx"
api_key = os.getenv("DASHSCOPE_API_KEY")
response = MultiModalConversation.call(
api_key=api_key,
model="qwen-image-max",
messages=messages,
result_format='message',
stream=False,
watermark=False,
prompt_extend=True,
negative_prompt='',
size='1328*1328'
)
if response.status_code == 200:
print(json.dumps(response, ensure_ascii=False))
else:
print(f"HTTP status code: {response.status_code}")
print(f"Error code: {response.code}")
print(f"Error message: {response.message}")
print("For more information, see the documentation: https://www.alibabacloud.com/help/en/model-studio/error-code")