alicloud-ai-image-qwen-imageGenerate images with Model Studio DashScope SDK using Qwen Image generation models (qwen-image-max, qwen-image-plus-2026-01-09). Use when implementing or documenting image.generate requests/responses, mapping prompt/negative_prompt/size/seed/reference_image, or integrating image generation into the video-agent pipeline.
Install via ClawdBot CLI:
clawdbot install cinience/alicloud-ai-image-qwen-imageCategory: provider
Build consistent image generation behavior for the video-agent pipeline by standardizing image.generate inputs/outputs and using DashScope SDK (Python) with the exact model name.
python3 -m venv .venv
. .venv/bin/activate
python -m pip install dashscope
DASHSCOPE_API_KEY in your environment, or add dashscope_api_key to ~/.alibabacloud/credentials (env takes precedence).Use one of these exact model strings:
qwen-image-maxqwen-image-plus-2026-01-09prompt (string, required)negative_prompt (string, optional)size (string, required) e.g. 10241024, 7681024style (string, optional)seed (int, optional)reference_image (string | bytes, optional)image_url (string)width (int)height (int)seed (int)Minimal normalized request body:
{
"prompt": "a cinematic portrait of a cyclist at dusk, soft rim light, shallow depth of field",
"negative_prompt": "blurry, low quality, watermark",
"size": "1024*1024",
"seed": 1234
}
Preview workflow (download then open):
curl -L -o output/ai-image-qwen-image/images/preview.png "<IMAGE_URL_FROM_RESPONSE>" && open output/ai-image-qwen-image/images/preview.png
Local helper script (JSON request -> image file):
python skills/ai/image/alicloud-ai-image-qwen-image/scripts/generate_image.py \\
--request '{"prompt":"a studio product photo of headphones","size":"1024*1024"}' \\
--output output/ai-image-qwen-image/images/headphones.png \\
--print-response
| Field | Required | Notes |
|------|----------|-------|
| prompt | yes | Describe a scene, not just keywords. |
| negative_prompt | no | Best-effort, may be ignored by backend. |
| size | yes | WxH format, e.g. 10241024, 7681024. |
| style | no | Optional stylistic hint. |
| seed | no | Use for reproducibility when supported. |
| reference_image | no | URL/file/bytes, SDK-specific mapping. |
Use the DashScope SDK and map the normalized request into the SDK call.
Note: For qwen-image-max, the DashScope SDK currently succeeds via ImageGeneration (messages-based) rather than ImageSynthesis.
If the SDK version you are using expects a different field name for reference images, adapt the input mapping accordingly.
import os
from dashscope.aigc.image_generation import ImageGeneration
# Prefer env var for auth: export DASHSCOPE_API_KEY=...
# Or use ~/.alibabacloud/credentials with dashscope_api_key under [default].
def generate_image(req: dict) -> dict:
messages = [
{
"role": "user",
"content": [{"text": req["prompt"]}],
}
]
if req.get("reference_image"):
# Some SDK versions accept {"image": <url|file|bytes>} in messages content.
messages[0]["content"].insert(0, {"image": req["reference_image"]})
response = ImageGeneration.call(
model=req.get("model", "qwen-image-max"),
messages=messages,
size=req.get("size", "1024*1024"),
api_key=os.getenv("DASHSCOPE_API_KEY"),
# Pass through optional parameters if supported by the backend.
negative_prompt=req.get("negative_prompt"),
style=req.get("style"),
seed=req.get("seed"),
)
# Response is a generation-style envelope; extract the first image URL.
content = response.output["choices"][0]["message"]["content"]
image_url = None
for item in content:
if isinstance(item, dict) and item.get("image"):
image_url = item["image"]
break
return {
"image_url": image_url,
"width": response.usage.get("width"),
"height": response.usage.get("height"),
"seed": req.get("seed"),
}
| Error | Likely cause | Action |
|------|--------------|--------|
| 401/403 | Missing or invalid DASHSCOPE_API_KEY | Check env var or ~/.alibabacloud/credentials, and access policy. |
| 400 | Unsupported size or bad request shape | Use common WxH and validate fields. |
| 429 | Rate limit or quota | Retry with backoff, or reduce concurrency. |
| 5xx | Transient backend errors | Retry with backoff once or twice. |
output/ai-image-qwen-image/images/OUTPUT_DIR.(prompt, negative_prompt, size, seed, reference_image hash) to avoid duplicate costs.negative_prompt, style, or seed; treat them as best-effort inputs.WxH format (e.g. 10241024, 7681024).references/api_reference.md for a more detailed DashScope SDK mapping and response parsing tips.references/prompt-guide.md for prompt patterns and examples.skills/ai/image/alicloud-ai-image-qwen-image-edit/.references/sources.mdGenerated Mar 1, 2026
Generate high-quality product images for online stores, such as headphones or electronics, to create consistent, appealing visuals without physical photoshoots. This reduces production costs and speeds up catalog updates, especially for new or customizable items.
Produce cinematic or branded images for advertising campaigns, like portraits or scenes, to quickly iterate on creative concepts and tailor visuals to specific audiences. This enhances campaign agility and reduces reliance on stock photography.
Generate reference images for storyboarding and scene planning in video production pipelines, helping visualize shots before filming. This streamlines pre-production workflows and improves alignment among creative teams.
Create custom illustrations or diagrams for textbooks, online courses, or training materials to visually explain complex concepts. This supports engaging learning experiences and reduces manual design effort.
Generate realistic images of building interiors or exteriors based on prompts, aiding in design presentations and client approvals. This accelerates the design process and enhances visualization without 3D modeling.
Integrate this skill into a SaaS platform offering AI-powered image generation as a service, charging users per image or via subscription tiers. This model leverages cloud scalability to serve multiple clients while managing API costs efficiently.
Use the skill to provide on-demand image generation services for clients in marketing or e-commerce, bundling it with creative consulting. This reduces manual design work and allows rapid delivery of custom visuals for campaigns.
Package this skill as a reusable component in a marketplace for developers building AI applications, earning revenue through licensing or commission on usage. This targets tech teams needing quick integration of image generation into their pipelines.
đŹ Integration Tip
Ensure the DASHSCOPE_API_KEY is set in environment variables for authentication, and cache image results to avoid duplicate API calls and reduce costs.
Generate/edit images with Nano Banana Pro (Gemini 3 Pro Image). Use for image create/modify requests incl. edits. Supports text-to-image + image-to-image; 1K/2K/4K; use --input-image.
Capture frames or clips from RTSP/ONVIF cameras.
Batch-generate images via OpenAI Images API. Random prompt sampler + `index.html` gallery.
Generate images using the internal Google Antigravity API (Gemini 3 Pro Image). High quality, native generation without browser automation.
使ç¨ĺ 罎 image_generate.py čćŹçćĺžç, ĺĺ¤ć¸ ć°ĺ ˇä˝ç `prompt`ă
AI image generation powered by CellCog. Create images, edit photos, consistent characters, product photography, reference-based images, sets of images, style transfer. Professional image creation with AI.