Skip to main content
POST
Grok Imagine Series
The xAI Grok Imagine image line currently offers six model IDs. All of them are submitted through the unified task endpoint POST /v1/tasks and all of them settle at a fixed price per successfully generated image — switching tiers only changes model. On the official route, grok-imagine-image, grok-imagine-image-quality and grok-imagine-image-2.0 support reference-image editing and resolution selection, and charge separately for each reference image. The economy models grok-imagine-image-2.0-rev, grok-imagine-1.5-rev and grok-imagine-1.5-edit-rev take fewer parameters, output at a fixed tier, and cost less. For video, see Grok Imagine Video Series.

Quick start

A successful submission returns a task_id. Retrieve the result with GET /v1/tasks/{task_id}, wait inline with Prefer: wait, or configure a webhook.

Request parameters

string
required
One of six IDs; see Available models.
string
default:"generate"
  • generate — generate from text
  • edit — rewrite from reference images; image_urls is required
Single-image editing and multi-reference blending both use edit; the only difference is how many entries image_urls carries. grok-imagine-image-2.0-rev and grok-imagine-1.5-rev support generate only.
string
required
Image description or editing instruction, in English or Chinese.
integer
default:"1"
Number of images to return. grok-imagine-image, grok-imagine-image-quality, grok-imagine-image-2.0, grok-imagine-1.5-rev and grok-imagine-1.5-edit-rev accept 1–10; grok-imagine-image returns one image under edit. grok-imagine-image-2.0-rev accepts 1–12.
string
default:"auto"
Frame ratio; the accepted set differs by model, see Available models. grok-imagine-image, grok-imagine-image-quality and grok-imagine-image-2.0 default to auto, letting the model choose the framing; grok-imagine-image-2.0-rev defaults to 1:1. grok-imagine-1.5-edit-rev does not accept this parameter.
string
default:"1k"
Output resolution, 1k or 2k. Only grok-imagine-image, grok-imagine-image-quality and grok-imagine-image-2.0 accept it; the other three models output at a fixed tier.
string
Quality tier, low or medium. Only grok-imagine-image-2.0 accepts it, and only under action: "generate" — do not send it with reference images. Without it, pricing follows the resolution tier.
string[]
Reference image URLs, publicly reachable. Required for edit: grok-imagine-image takes 1–5, grok-imagine-image-quality and grok-imagine-image-2.0 take 1–3, grok-imagine-1.5-edit-rev takes 1–5. grok-imagine-1.5-rev also accepts reference images under generate, up to 5; grok-imagine-image-2.0-rev does not accept them.Array order is preserved for multi-reference requests, so the prompt can refer to the first image, the second image, and so on.
See Submit Task for callback_url, callback_events, Prefer: wait, Idempotency-Key and the maximum-cost header. seed and mask_url are not supported. Any other parameter returns 400 and is not billed.

Limits

Pricing

All six models settle at a fixed price per successfully generated image. generate and edit cost the same, and neither aspect ratio nor prompt length affects the price. The billing dimensions differ by model: With reference images, a call to grok-imagine-image or grok-imagine-image-quality costs (resolution tier price + per-reference-image price × number of reference images) × number of output images; on grok-imagine-image-2.0 the reference-image fee is not repeated per output, so a call costs resolution tier price × number of output images + per-reference-image price × number of reference images. A resolution outside the tiers a model supports settles at its fallback price, equal to the 1k tier. 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. 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

Completed task
result.images carries the generated images, with one entry per image when n is greater than 1. Image links expire, so store them once retrieved. Full field reference: Query Task Status.

Available models

Aspect ratio sets:
  • 14 (grok-imagine-image, grok-imagine-image-quality, grok-imagine-image-2.0): auto, 1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1
  • 7 (grok-imagine-image-2.0-rev): 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9
  • 5 (grok-imagine-1.5-rev): 1:1, 16:9, 9:16, 3:2, 2:3