Qwen-Image-Plus
Copy success!
Try AIAdd to Compare
Overview
The first image generation foundation model in the Qwen series that achieves significant advances in complex text rendering and precise image editing. Experiments show strong general capabilities in both image generation and editing, with exceptional performance in text rendering, especially for Chinese.
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.035Per image
Rate Limits
- Concurrency2concurrent
- Async Queue Limit500tasks
- RPMRequests Per Minute120
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",
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")