Qwen Image Edit API Documentation
Playground
Try it on WaveSpeedAI!Qwen-Image-Edit is a 20B MMDiT image-to-image model offering precise bilingual (Chinese & English) text edits while preserving style. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
Features
A next-gen image editing model built on Qwen-Image 20B MMDiT. Qwen-Image-Edit delivers precise bilingual text editing (Chinese & English), supports both semantic and appearance-level edits, and preserves the original style — making it one of the most capable image editing models available.
Why It Looks Great
- Dual-mode editing: Supports both appearance-level edits (add/remove/modify elements while keeping other regions pixel-accurate) and semantic-level edits (IP creation, rotation, style transfer with global coherence).
- Precise text editing (CN/EN): Edit on-image text directly — add, delete, or replace while retaining the original font, size, kerning, and style.
- Style preservation: Maintains palette, lighting, brushwork, and overall look even under substantial edits.
- 20B parameter power: Built on the robust Qwen-Image foundation for superior understanding and generation.
- State-of-the-art performance: Achieves SOTA results across multiple public image editing benchmarks.
- Prompt Enhancer: Built-in tool to refine your editing instructions automatically.
Parameters
| Parameter | Required | Description |
|---|---|---|
| prompt | Yes | Text instruction describing the edit you want to make. |
| image | Yes | Source image to edit (upload or public URL). |
| size | No | Custom output dimensions with width and height controls. |
| width | No | Output width in pixels (e.g., 256). |
| height | No | Output height in pixels (e.g., 256). |
| seed | No | Random seed for reproducibility. Use -1 for random. |
| output_format | No | Output file format: jpeg or png. Default: jpeg. |
| enable_base64_output | No | API only: Returns base64 string instead of URL. |
| enable_sync_mode | No | API only: Waits for result and returns it directly in response. |
How to Use
- Write your edit instruction — describe what you want to change in the image.
- Use Prompt Enhancer (optional) — click to refine your editing instruction.
- Upload your image — drag and drop or paste a public URL.
- Set dimensions (optional) — adjust width and height for the output size.
- Set seed (optional) — use -1 for random, or a specific number to reproduce results.
- Choose output format — select jpeg or png.
- Run — click the button to apply the edit.
- Download — preview and save your edited image.
Pricing
Flat rate per edit.
| Output | Cost |
|---|---|
| Per image | $0.02 |
Best Use Cases
- Text Replacement — Change text on signs, labels, clothing, or any surface in images (supports Chinese & English).
- Element Modification — Add, remove, or swap objects while preserving untouched areas pixel-perfectly.
- Style Transfer — Apply new artistic styles while maintaining semantic content.
- IP Creation — Generate character variations and creative adaptations.
- Object Manipulation — Rotate, reposition, or transform objects within scenes.
- Product Customization — Create variations of product images with different details or branding.
Example Prompts
- “Change the background to daytime”
- “Replace the text on the sign to say ‘Welcome’”
- “Remove the person on the left side of the image”
- “Change the dress color from red to blue”
- “Add sunglasses to the person”
Editing Modes Explained
| Mode | Description | Use When |
|---|---|---|
| Appearance Editing | Modifies specific elements while keeping all other regions pixel-accurate and unchanged | Adding/removing objects, color changes, localized edits |
| Semantic Editing | Allows global pixel updates while maintaining semantic intent and consistency | Style transfer, pose changes, IP creation, rotation |
Pro Tips for Best Results
- Be specific about what to change and what the result should be.
- For text editing, the model preserves original typography — just specify the new text content.
- Reference elements clearly: “the text on the shirt”, “the background”, “the person’s hair”.
- For appearance edits, unchanged areas remain pixel-perfect — focus only on what needs editing.
- Use Chinese prompts for editing Chinese text in images for best accuracy.
- The model understands context — describe the intent, not just the mechanical change.
Notes
- If using a URL for the image, ensure it is publicly accessible. A preview thumbnail confirms successful loading.
- The enable_base64_output and enable_sync_mode options are only available through the API.
- Complex edits may require more specific prompts for accurate results.
- For multiple edits to the same image, consider processing sequentially for better control.
Authentication
For authentication details, please refer to the Authentication Guide.
API Endpoints
Submit Task & Query Result
set -euo pipefail
export WAVESPEED_API_KEY="your-api-key"
REQUEST_BODY=$(cat <<'JSON'
{
"prompt": "A cinematic ocean wave at sunrise, highly detailed",
"image": "https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg",
"output_format": "jpeg"
}
JSON
)
# 1. Submit the prediction once. Never retry this request automatically:
# a retry after an unclear failure can create a second, billed task.
CHECK='The task may already exist. Check History or the predictions list before submitting again.'
if ! SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--connect-timeout 10 --max-time 60 \
-X POST "https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image/edit" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d "${REQUEST_BODY}"); then
printf 'Submit failed. %s\n' "${CHECK}" >&2
exit 1
fi
TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
printf 'Submission response did not contain a prediction id. %s\n' "${CHECK}" >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"
# 2. Poll until the prediction reaches a final status.
BODY_FILE=$(mktemp)
trap 'rm -f "${BODY_FILE}"' EXIT
while true; do
# Transient errors (429, 5xx) are retried, honoring Retry-After.
HTTP_CODE=$(curl --silent --show-error --fail-with-body \
--connect-timeout 10 --max-time 60 --retry 5 --retry-delay 2 \
--output "${BODY_FILE}" --write-out '%{http_code}' \
"${RESULT_URL}" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" || true)
case "${HTTP_CODE}" in
2??) ;;
000|429|5??) # dropped connection or temporary error: keep polling
printf 'Task %s: HTTP %s, polling again in 10s\n' "${PREDICTION_ID}" "${HTTP_CODE}" >&2
sleep 10; continue ;;
*) printf 'Task %s: HTTP %s\n' "${PREDICTION_ID}" "${HTTP_CODE}" >&2
cat "${BODY_FILE}" >&2; exit 1 ;;
esac
RESULT=$(jq 'if type == "object" and has("data") then .data else . end' "${BODY_FILE}")
STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')
case "${STATUS}" in
completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted)
printf 'Task %s ended with status %s\n' "${PREDICTION_ID}" "${STATUS}" >&2
printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneRetry temporary errors only while polling, never the submit request. Errors, retries and timeouts
Parameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| prompt | string | Yes | - | The positive prompt for the generation. | |
| image | string | Yes | - | The image to generate an image from. | |
| size | string | No | - | 256 ~ 1536 | Advanced option. The size of the generated media in pixels (width*height). |
| seed | integer | No | - | - | The random seed to use for the generation. -1 means a random seed will be used. |
| output_format | string | No | jpeg | jpeg, png, webp | The format of the output image. |
Every model also accepts the global request options enable_sync_mode and enable_base64_output; see their pages for details.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Output values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Task status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses. |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction |
| data.model | string | Model ID used for the prediction |
| data.outputs | array<string | object> | Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model. |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Status: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses |
| data.created_at | string | ISO timestamp of when the request was created |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |