Edits (image edit)
Rewrite the whole image from an existing image + prompt. Good for background replacement, style transfer, content changes
All documentation/v1/midjourney/generations/edits{
"error": {
"code": 500,
"message": "Internal server error. Please try again later",
"type": "server_error"
}
}{
"error": {
"code": 502,
"message": "Bad gateway. The server is temporarily unavailable",
"type": "bad_gateway"
}
}Rewrites the whole image from an existing image + prompt. Good for background replacement, style transfer, and content changes.
| Item | Value |
|---|---|
| action | EDITS |
| Billing | midjourney@edits[-speed] |
| Required | prompt + image_urls |
Request examples
curl --request POST \
--url https://openrouterapi.ru/v1/midjourney/generations/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "replace the background with a modern kitchen, keep the product unchanged --ar 1:1",
"image_urls": [
"https://example.com/product.png"
],
"version": "8.1",
"speed": "fast"
}'Parameters
| Field | Type | Required | Notes |
|---|---|---|---|
prompt | string | Yes | Edit instruction |
nsfw_check | boolean | No | Defaults to false. Run content moderation before submitting a Midjourney task. • true: use omni-moderation-latest to review prompts and input images • false: skip moderation without adding moderation cost or latency |
image_urls | string[] | Yes | Image to edit; each ≤ 12 MiB |
speed | string | No | Default: relax; relax / fast / turbo |
metadata | object | No | Custom metadata |
Structured fields (optional)
Same as Imagine — set them in the body or in prompt (e.g. --ar 16:9). Body values take priority, are appended to the prompt, and override same-name flags written by hand.
| Field | Type | MJ equivalent | Notes |
|---|---|---|---|
size | string | --ar | e.g. "16:9", "1:1", "9:16" |
quality | string | --q | "0.25", "0.5", "1", "2" |
style | string | --style | Style presets depend on the version; for Raw mode in v8.2, use raw: true, not style: "raw" |
version | string | --v | Version. Main MJ versions append --v <version>; when used with niji: true and "7" / "6", it is normalized as a Niji version |
seed | int | --seed | Seed |
negative_prompt | string | --no | e.g. "ugly, blurry" |
stylize | int | --s | 0–1000 |
chaos | int | --c | 0–100 |
weird | int | --w | 0–3000 |
tile | bool | --tile | Tile mode |
niji | bool | --niji | Niji switch. Recommended: niji: true + version: "7" / "6" |
iw | float | --iw | 0–3, image weight |
cw | int | --cw | 0–100 |
sw | int | --sw | 0–1000 |
cref | string | --cref | Character ref URL |
sref | string | --sref | Style ref URL |
dref | string | --dref | Depth reference image URL |
dw | float | --dw | Depth weight (0–100) |
repeat | int | --repeat | 2–40 |
raw | bool | --raw | Raw mode (v5.1+); in v8.2, set to true, equivalent to --raw |
draft | bool | --draft | Draft mode (v7+) |
hd | bool | --hd | HD mode (v8.1 / v8.2 only; backend auto-injects --v 8.1 when version is unspecified) |
stop | int | --stop | Early stop (10–100; v5–6.1 / niji 5–6 only) |
extra | string | any --xxx | Escape hatch; appended to prompt verbatim |
Note
Raw mode in v8.2:
--style rawis not accepted. Use--v 8.2 --rawin the prompt, or"version": "8.2", "raw": truein the body. Remove any--style rawfrom the prompt andstyle: "raw"from the body; do not combine them with--raw/raw: true.
Request example
{
"prompt": "replace the background with a modern kitchen, keep the product unchanged --ar 1:1",
"image_urls": ["https://example.com/product.png"],
"version": "8.1",
"speed": "fast"
}Response
Submission returns a task_id; on SUCCESS the result includes edited image_urls (may be 1–4) plus grid_image_url.
Notes
- Difference from imagine image-guidance: edits "rewrites the whole image", while imagine + reference images "borrows the style".
- Missing
promptorimage_urlsreturns400; a single image over 12 MiB returns400.
Responses
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
}
]
}Found a problem in these docs? Email support@openrouterapi.ru.