Skip to main content
qwen avatar

Qwen-Image-Edit API

qwen/qwen-image-edit

Edit an existing image from a text instruction — recolor, restyle, swap backgrounds, add or remove elements — with accurate, legible in-image text in English and Chinese.

edit
0.03 per megapixel of image

Model Input

Input

The edit instruction describing the change to apply to the input image. To edit text in the image, quote the exact replacement words.

The URL of the image to edit.

The size of the edited image. Leave unset to preserve the input image's dimensions, or use a preset string (e.g. 'landscape_16_9') or a custom {width, height} object.

Additional Settings

Customize your input with more control.

Min: 2 - Max: 50

The number of inference steps to perform. More steps can improve detail at the cost of speed.

Min: 0 - Max: 20

The CFG (Classifier Free Guidance) scale. Higher values increase adherence to the prompt.

The same seed and the same prompt given to the same version of the model will output the same image every time.

Safety checker can only be disabled on API call

The format of the edited image.

The negative prompt to use. Use it to address details that you don't want in the image.

Acceleration level for image editing. Options: 'none', 'regular', 'high'. Higher acceleration increases speed.

Min: 1 - Max: 4

The number of images to generate. Each generated image is billed.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Loading
Generated in 4.999 seconds
Logs (1 lines)

Model Example Requests

Examples

Example output 1

Qwen-Image-Edit API

Qwen-Image-Edit is a image-to-image AI model by qwen. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at $0.03 per megapixel.

POST https://queue.modelrunner.run/qwen/qwen-image-edit

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/qwen/qwen-image-edit \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Change the background to a sunny blue sky",
    "image_url": "https://media.modelrunner.ai/LnlaKNApm4j6wf6BxxcuZ.png",
    "image_size": "landscape_4_3",
    "num_images": 1,
    "acceleration": "regular",
    "output_format": "png",
    "guidance_scale": 4,
    "negative_prompt": " ",
    "num_inference_steps": 30,
    "enable_safety_checker": true,
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/qwen/qwen-image-edit/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/qwen/qwen-image-edit/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("qwen/qwen-image-edit", {
  input: {
    "prompt": "Change the background to a sunny blue sky",
    "image_url": "https://media.modelrunner.ai/LnlaKNApm4j6wf6BxxcuZ.png",
    "image_size": "landscape_4_3",
    "num_images": 1,
    "acceleration": "regular",
    "output_format": "png",
    "guidance_scale": 4,
    "negative_prompt": " ",
    "num_inference_steps": 30,
    "enable_safety_checker": true
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/qwen/qwen-image-edit",
    headers=headers,
    json={
      "prompt": "Change the background to a sunny blue sky",
      "image_url": "https://media.modelrunner.ai/LnlaKNApm4j6wf6BxxcuZ.png",
      "image_size": "landscape_4_3",
      "num_images": 1,
      "acceleration": "regular",
      "output_format": "png",
      "guidance_scale": 4,
      "negative_prompt": " ",
      "num_inference_steps": 30,
      "enable_safety_checker": true
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
promptstringyesThe edit instruction describing the change to apply to the input image. To edit text in the image, quote the exact replacement words.
image_urlstring (uri)yesThe URL of the image to edit.
image_sizeenumnoThe size of the edited image. Leave unset to preserve the input image's dimensions, or use a preset string (e.g. 'landscape_16_9') or a custom {width, height} object.
num_inference_stepsintegernoThe number of inference steps to perform. More steps can improve detail at the cost of speed. Default: 30.
guidance_scalenumbernoThe CFG (Classifier Free Guidance) scale. Higher values increase adherence to the prompt. Default: 4.
seedintegernoThe same seed and the same prompt given to the same version of the model will output the same image every time.
enable_safety_checkerbooleannoIf set to true, the safety checker will be enabled. Default: true.
output_formatenumnoThe format of the edited image. Default: "png".
negative_promptstringnoThe negative prompt to use. Use it to address details that you don't want in the image. Default: " ".
accelerationenumnoAcceleration level for image editing. Options: 'none', 'regular', 'high'. Higher acceleration increases speed. Default: "regular".
num_imagesintegernoThe number of images to generate. Each generated image is billed. Default: 1.

Machine-readable: OpenAPI schema · llms.txt

Use Qwen-Image-Edit from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Qwen-Image-Edit becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint qwen/qwen-image-edit.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run qwen/qwen-image-edit on ModelRunner to generate image”. MCP setup guide.

Model Details

Model Details

Qwen-Image-Edit takes a source image plus a plain-language instruction and returns an edited version of that image. Describe the change you want — recolor an object, swap the background, restyle the scene, add or remove an element, or rewrite text in the picture — and it applies the edit while preserving the rest of the image. Its standout strength carries over from the Qwen-Image family: it edits and renders accurate, legible text directly inside the image in both English and Chinese, so signage, labels, and captions stay correct after the edit.

## Best for - Instruction-based edits to a photo or graphic — change colors, materials, backgrounds, lighting, or style - Adding or removing objects, people, or elements from an existing image - Editing or correcting the actual text inside an image (signs, posters, packaging, menus), including Chinese - Restyling a scene (e.g. photo to illustration) while keeping the subject and layout recognizable

## Choose another model when - You want to generate a brand-new image from a text prompt with no source image — use the text-to-image Qwen-Image - You need pixel-precise local edits confined to a hand-drawn mask region — use a dedicated inpainting model - You want video or animation from your image — use an image-to-video model

## Tips - Write the instruction as a direct edit command ("change the car to red", "replace the background with a sunny sky"), and name only what should change so the rest stays intact - To edit words in the image, quote the exact replacement text in the prompt - Leave `image_size` unset to keep the input's original dimensions; set a preset (e.g. `landscape_4_3`) or a custom `{ width, height }` object to reframe the output - Use `num_images` (1-4) to get several edit variations in a single call

## Limitations - Heavy, multi-step instructions in one prompt may apply only part of the requested change - Very small text or dense, multi-line passages can still introduce glyph errors after editing

To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("qwen/qwen-image-edit", { input: { prompt: "change the background to a sunny blue sky", image_url: "https://media.modelrunner.ai/example-input.jpg", num_images: 1, }, }); ```