# Qwen Image Edit Max (qwen-image-edit-max) Vendor: Alibaba Model ID: `qwen-image-edit-max` Base URL: `https://api.mulerouter.ai` Type: Inference API (async task-based) ## Description Premium image editing model with enhanced quality - supports multi-image input/output, text modification, and advanced editing ## Variant: Create Generation Task Endpoint: `POST /vendors/alibaba/v1/qwen-image-edit-max/generation` ### Input Schema The API accepts the following input parameters: - **`n`** (`integer`, _optional_): Number of images to generate (1-6). - Default: `1` - Range: `1` to `6` - **`seed`** (`integer`, _optional_): Random seed for reproducibility [0, 2147483647]. Using the same seed helps ensure consistency of generated content. Note: Results are not guaranteed to be identical for every call even with the same seed. - Range: `0` to `2147483647` - **`size`** (`string`, _optional_): Output image resolution in format "width\*height". Width and height must be in range [512, 2048] pixels. Default: Maintains aspect ratio similar to input image with resolution close to 1024\*1024. - **`images`** (`list`, _required_): Array of input image URLs or Base64-encoded images. Supports 1-3 images. For multi-image input, the order defines their sequence. The aspect ratio of the output image is determined by the last image. Image requirements: - Formats: JPG, JPEG, PNG, BMP, TIFF, WEBP, GIF (first frame only) - Resolution: Width and height should be between 384 and 3072 pixels - Size: No larger than 10 MB - Items: min: 1, max: 3 - **`prompt`** (`string`, _required_): Image editing instruction (max 800 characters). Describes the elements and visual features you want in the generated image. When editing multiple images, use "Image 1", "Image 2", "Image 3" to refer to corresponding images. Supports both Chinese and English. - Max length: 800 - **`prompt_extend`** (`boolean`, _optional_): Enable intelligent prompt rewriting. When enabled, a large language model optimizes the positive prompt. Significantly improves results for simple or less descriptive prompts. - Default: `true` - **`safety_filter`** (`boolean | null`, _optional_): Enable content safety filter. Defaults to true. Set to false to disable content safety inspection. - Default: `true` - **`negative_prompt`** (`string | null`, _optional_): Negative prompt describing unwanted content (max 500 characters). Used to constrain the image generation. Example: low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions. - Max length: 500 **Required Parameters Example**: ```json { "images": [], "prompt": "" } ``` **Full Example**: ```json { "n": 1, "seed": 0, "size": "", "images": [], "prompt": "", "prompt_extend": true, "safety_filter": true, "negative_prompt": null } ``` ## Variant: /vendors/alibaba/v1/qwen-image-edit-max/generation/{task_id} Endpoint: `POST /vendors/alibaba/v1/qwen-image-edit-max/generation/{task_id}` ## Usage (Async Task API) This model uses an async task-based workflow with two API calls: 1. **Submit a task** — `POST /v1/inference/qwen-image-edit-max` to create a generation task 2. **Poll for result** — `GET /v1/inference/qwen-image-edit-max/{task_id}` to check status and retrieve the result ### Step 1: Submit a Task #### cURL ```bash curl -X POST https://api.mulerouter.ai/vendors/alibaba/v1/qwen-image-edit-max/generation \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "prompt": "Your prompt here" }' ``` #### Python ```python import requests API_KEY = "" ENDPOINT = "https://api.mulerouter.ai/vendors/alibaba/v1/qwen-image-edit-max/generation" response = requests.post( ENDPOINT, headers={ "Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}" }, json={ "prompt": "Your prompt here" } ) result = response.json() task_id = result["task_info"]["id"] print(f"Task created: {task_id}") ``` #### Node.js / TypeScript ```typescript const API_KEY = ""; const ENDPOINT = "https://api.mulerouter.ai/vendors/alibaba/v1/qwen-image-edit-max/generation"; const response = await fetch(ENDPOINT, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ prompt: "Your prompt here" }) }); const result = await response.json(); const taskId = result.task_info.id; console.log("Task created:", taskId); ``` #### Submit Response (202) ```json { "task_info": { "id": "8e1e315e-b50d-4334-a231-be7d19a372f4", "status": "processing", "created_at": "2026-01-01T00:00:00.000Z" } } ``` ### Step 2: Poll for Result Use the task ID from Step 1 to poll the status endpoint until the task is completed. Endpoint: `GET /v1/inference/qwen-image-edit-max/{task_id}` #### cURL ```bash curl -X GET https://api.mulerouter.ai/vendors/alibaba/v1/qwen-image-edit-max/generation/ \ -H "Authorization: Bearer " ``` #### Python ```python import time status_url = f"https://api.mulerouter.ai/vendors/alibaba/v1/qwen-image-edit-max/generation/{task_id}" while True: status = requests.get(status_url, headers={ "Authorization": f"Bearer {API_KEY}" }).json() task_status = status["task_info"]["status"] if task_status in ("completed", "succeeded"): print("Result:", status) break elif task_status == "failed": print("Task failed:", status) break time.sleep(5) ``` #### Node.js / TypeScript ```typescript const statusUrl = `https://api.mulerouter.ai/vendors/alibaba/v1/qwen-image-edit-max/generation/${taskId}`; while (true) { const statusRes = await fetch(statusUrl, { headers: { "Authorization": `Bearer ${API_KEY}` } }); const status = await statusRes.json(); const taskStatus = status.task_info.status; if (taskStatus === "completed" || taskStatus === "succeeded") { console.log("Result:", status); break; } else if (taskStatus === "failed") { console.log("Task failed:", status); break; } await new Promise(r => setTimeout(r, 5000)); } ``` ## Additional Resources ### Documentation - [Model Playground](https://www.mulerouter.ai/models/qwen-image-edit-max) - [API Documentation](https://mulerouter.ai/docs/api-reference/endpoint/alibaba/qwen-image-edit-max/generation) ### MuleRouter Platform - [Platform Documentation](https://www.mulerouter.ai/docs) - [API Keys Management](https://www.mulerouter.ai/app/api-keys)