Image Generation
Midjourney
An image model whose results can be upscaled, varied, expanded and repainted
POST
Midjourney
Midjourney is known for highly aesthetic, artistic output, renders 2K images by default, and covers anime styles through its
A successful submission returns a
See Submit Task for
niji versions. There is a single model ID, midjourney, and action decides what a call does: imagine turns a prompt into a grid of four images, and every other action continues from the result of a previous task. All actions are submitted through the unified POST /v1/tasks endpoint.
Quick start
The number of images is whatever
result.images contains once the task completes.
Every action except imagine takes a ref_task_id — the task_id of the previous task. See Examples for how the chain fits together.
task_id. Retrieve the result with GET /v1/tasks/{task_id}, wait inline with Prefer: wait, or configure a webhook.
Request parameters
string
required
Must be
midjourney.string
default:"imagine"
What the call does; see the table above for the values.
string
The prompt. Required for
imagine and edit; optional for modal, remix-strong and remix-subtle, which fall back to the source task’s prompt when it is empty. Native Midjourney flags can be written into the prompt (for example --ar 16:9); a structured parameter of the same name wins.string
Output aspect ratio:
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 or 9:21.string[]
Reference image URLs. On
imagine they make the generation image-guided; on edit they are required and hold the image being rewritten.integer
Random seed.
imagine only.string
Elements to exclude.
imagine only.string
default:"relax"
Generation speed tier:
relax, fast or turbo. It directly changes the price and applies to every action.string
Midjourney model version:
v5.1, v5.2, v6.1, v7, v8.1, v8.2, niji6 or niji7. Chained actions inherit the version of their source task.string
The
task_id of the source task, meaning the previous step. Required for every action except imagine.integer
Which image of the source grid to act on,
1–4 (top-left, top-right, bottom-left, bottom-right). Required for upscale, variation, high-variation, low-variation, zoom, pan, inpaint, edit, remix-strong and remix-subtle.string
Names the button on the source task directly; it wins over
index when both are present. Available on upscale, variation, high-variation, low-variation, reroll, zoom, pan and inpaint.number
zoom only. Zoom-out factor: below 2 zooms out 1.5×, 2 and above zooms out 2×.string
pan only. Direction to extend the image: left, right, up or down.string
modal only. URL of the mask image: transparent areas are repainted, white areas are kept. Required to repaint a region; without it the task is treated as an outpaint.object
Custom metadata object, passed upstream as given.
string
imagine only. Style switch (--style), for example raw.integer
imagine only. Stylization strength (--s), 0–1000.integer
imagine only. How different the four results are from each other (--c), 0–100.integer
imagine only. Weirdness (--w), 0–3000.boolean
imagine only. Produces a seamlessly tileable pattern (--tile).number
imagine only. Image weight (--iw), 0–3. Higher values stay closer to image_urls.string
imagine only. Character reference image URL (--cref).integer
imagine only. How closely the character reference is followed (--cw), 0–100. Used with cref.string
imagine only. Style reference image URL (--sref).integer
imagine only. How closely the style reference is followed (--sw), 0–1000. Used with sref.string
imagine only. Depth reference image URL (--dref).number
imagine only. How closely the depth reference is followed (--dw), 0–100. Used with dref.boolean
imagine only. Raw style (--raw), available from v5.1.boolean
imagine only. Draft mode (--draft), available from v7.boolean
imagine only. HD output (--hd), v8.1 and v8.2 only.integer
imagine only. Stop early (--stop), 10–100, on v5.1, v5.2, v6.1 and niji6 only.string
imagine only. Native Midjourney flags appended to the end of the prompt as given.callback_url, callback_events, Prefer: wait, Idempotency-Key, and the maximum-cost header.
This model does not support n, resolution or quality. Any other parameter returns 400 and is not billed.
Limits
Pricing
Billed at a fixed price per call across two dimensions: the action and thespeed tier. Every action has its own price, and relax, fast and turbo price differently within one action. An imagine call returns four images and is billed once, not per image.
Rates are in price_config on GET /v1/models and in the console’s Model Market. What a single call actually cost is the cost field on the task response — an integer quota at 500,000 quota = 1 USD, not dollars.
version, aspect ratio and prompt length have no effect on the price, and reference images add no fee, so the cost of a call is known before it is sent. An action with no price key of its own settles at the fallback price.
You are only billed for a successfully generated image. Failed and cancelled tasks, and tasks that return no usable image, are refunded in full.
Response
result.images returns the images in grid order, which is the order index refers to: imagine returns four entries, upscale returns one. url is an array and expires_at is when the image link expires. See Query Task Status for the full field reference.
Examples
Chained actions are linked byref_task_id, which carries the task_id of your own previous task — not an image URL, and not an upstream ID.
1
Generate a grid
Call
imagine and keep the task_id from the response. This step returns four entries in result.images.2
Pick one and continue
Pass that
task_id as ref_task_id and choose the image with index. upscale gives a single image; variation gives a new grid of four.3
Keep going on the single image
The task ID from
upscale becomes the ref_task_id of the next step: zoom to expand, pan to extend sideways, or inpaint plus modal to repaint a region. The chain can continue as long as you need.