Imagine (text-to-image)
Midjourney text-to-image / image-guided generation. The default entry /v1/midjourney/generations and the explicit /imagine entry behave the same
All documentation/v1/midjourney/generations{
"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"
}
}Default text-to-image / image-guided endpoint, equivalent to imagine. The explicit /v1/midjourney/generations/imagine endpoint behaves the same way.
| Item | Value |
|---|---|
| action | IMAGINE |
| Billing | midjourney@imagine[-version][-speed] |
| Required | prompt |
| Optional | image_urls, prompt fields, speed, metadata |
Request examples
curl --request POST \
--url https://openrouterapi.ru/v1/midjourney/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "a beautiful sunset over mountains",
"size": "16:9",
"version": "6.1",
"speed": "fast"
}'Request body
| Field | Type | Required | Notes |
|---|---|---|---|
prompt | string | Yes | Prompt; native MJ flags allowed (e.g. --ar 16:9 --v 6.1) |
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 |
speed | string | No | relax (default) / fast / turbo |
image_urls | string[] | No | Image URLs or base64 for image-guided generation |
metadata | object | No | Custom metadata saved with the task for business-side tracking |
Structured fields (optional)
You can set these in the JSON body or in prompt (e.g. --ar 16:9). Body values override prompt.
| 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.
Examples
All flags in prompt
{
"prompt": "a beautiful sunset over mountains --ar 16:9 --v 8.2 --raw --s 750"
}Structured body (recommended)
{
"prompt": "a beautiful sunset over mountains",
"size": "16:9",
"version": "8.2",
"raw": true,
"stylize": 750
}Main versions and Niji versions
{
"prompt": "anime girl in a moonlit garden",
"niji": true,
"version": "7",
"size": "9:16"
}Verified online versions:
8.2,8.1,7,6.1,5.2,5.1,niji 7, andniji 6. Use body fieldversionfor main MJ versions. For Niji, useniji: true+version: "7"/"6"; the billing version is normalized toniji7/niji6.
Mixed (body wins)
{
"prompt": "a beautiful sunset --ar 1:1",
"size": "16:9"
}Final prompt:
a beautiful sunset --ar 16:9(sizein body overrides--ar 1:1in prompt.)
Image-guided
{
"prompt": "turn this product into a luxury studio photo",
"image_urls": ["https://example.com/product.png"],
"size": "1:1",
"iw": 1.2
}Fast mode
{
"prompt": "a cute cat",
"speed": "fast"
}
speed=relaxor omittedspeeddoes not add a billing speed suffix.fast/turboare applied through the corresponding speed modes and match the corresponding billing keys.
Response
{
"code": 200,
"data": [{
"status": "submitted",
"task_id": "task_01JWXXXXXXXXXXXX"
}]
}After submission, poll the result via Get task.
Responses
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
}
]
}Models using this endpoint
Found a problem in these docs? Email support@openrouterapi.ru.