$npx -y skills add cinience/alicloud-skills --skill aliyun-qwen-image-editUse when editing images with Alibaba Cloud Model Studio Qwen Image Edit models (qwen-image-edit, qwen-image-edit-plus, qwen-image-edit-max, qwen-image-2.0 series and snapshots). Use when modifying existing images (inpaint, replace, style transfer, local edits), preserving subject
| 1 | Category: provider |
| 2 | |
| 3 | # Model Studio Qwen Image Edit |
| 4 | |
| 5 | ## Validation |
| 6 | |
| 7 | ```bash |
| 8 | mkdir -p output/aliyun-qwen-image-edit |
| 9 | python -m py_compile skills/ai/image/aliyun-qwen-image-edit/scripts/prepare_edit_request.py && echo "py_compile_ok" > output/aliyun-qwen-image-edit/validate.txt |
| 10 | ``` |
| 11 | |
| 12 | Pass criteria: command exits 0 and `output/aliyun-qwen-image-edit/validate.txt` is generated. |
| 13 | |
| 14 | ## Output And Evidence |
| 15 | |
| 16 | - Save edit request payloads, result URLs, and model parameters under `output/aliyun-qwen-image-edit/`. |
| 17 | - Keep one sample request/response pair for reproducibility. |
| 18 | |
| 19 | Use Qwen Image Edit models for instruction-based image editing instead of text-to-image generation. |
| 20 | |
| 21 | ## Critical model names |
| 22 | |
| 23 | Use one of these exact model strings: |
| 24 | - `qwen-image-edit` |
| 25 | - `qwen-image-edit-plus` |
| 26 | - `qwen-image-edit-max` |
| 27 | - `qwen-image-2.0` |
| 28 | - `qwen-image-2.0-pro` |
| 29 | - `qwen-image-2.0-2026-03-03` |
| 30 | - `qwen-image-2.0-pro-2026-03-03` |
| 31 | - `qwen-image-edit-plus-2025-12-15` |
| 32 | - `qwen-image-edit-max-2026-01-16` |
| 33 | |
| 34 | ## Prerequisites |
| 35 | |
| 36 | - Install SDK in a virtual environment: |
| 37 | |
| 38 | ```bash |
| 39 | python3 -m venv .venv |
| 40 | . .venv/bin/activate |
| 41 | python -m pip install dashscope |
| 42 | ``` |
| 43 | - Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials`. |
| 44 | |
| 45 | ## Normalized interface (image.edit) |
| 46 | |
| 47 | ### Request |
| 48 | - `prompt` (string, required) |
| 49 | - `image` (string | bytes, required) source image URL/path/bytes |
| 50 | - `mask` (string | bytes, optional) inpaint region mask |
| 51 | - `size` (string, optional) e.g. `1024*1024` |
| 52 | - `seed` (int, optional) |
| 53 | |
| 54 | ### Response |
| 55 | - `image_url` (string) |
| 56 | - `seed` (int) |
| 57 | - `request_id` (string) |
| 58 | |
| 59 | ## Operational guidance |
| 60 | |
| 61 | - Keep prompts task-oriented: describe what to change and what to preserve. |
| 62 | - Use masks for deterministic local edits. |
| 63 | - Save output assets to object storage and persist only URLs. |
| 64 | - For subject consistency, provide explicit constraints in prompt. |
| 65 | |
| 66 | ## Local helper script |
| 67 | |
| 68 | Prepare a normalized request JSON and validate response schema: |
| 69 | |
| 70 | ```bash |
| 71 | .venv/bin/python skills/ai/image/aliyun-qwen-image-edit/scripts/prepare_edit_request.py \ |
| 72 | --prompt "Replace the sky with sunset, keep buildings unchanged" \ |
| 73 | --image "https://example.com/input.png" |
| 74 | ``` |
| 75 | |
| 76 | ## Output location |
| 77 | |
| 78 | - Default output: `output/aliyun-qwen-image-edit/images/` |
| 79 | - Override base dir with `OUTPUT_DIR`. |
| 80 | |
| 81 | ## Workflow |
| 82 | |
| 83 | 1) Confirm user intent, region, identifiers, and whether the operation is read-only or mutating. |
| 84 | 2) Run one minimal read-only query first to verify connectivity and permissions. |
| 85 | 3) Execute the target operation with explicit parameters and bounded scope. |
| 86 | 4) Verify results and save output/evidence files. |
| 87 | |
| 88 | ## References |
| 89 | |
| 90 | - `references/sources.md` |