Skip to main content
POST
Model name compatibility note: This endpoint also accepts the alias grok-imagine-1.5-ext, which is equivalent to grok-imagine-1.5-apimart. The two are interchangeable and produce identical results.

Authorizations

string
required
All APIs require Bearer Token authenticationGet API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:

Body

string
default:"grok-imagine-1.5-apimart"
required
Image generation model nameSupported models:
  • grok-imagine-1.5-apimart - Grok image generation and editing (compatible alias grok-imagine-1.5-ext)
Example: "grok-imagine-1.5-ext"
boolean
default:"false"
Whether to run content moderation before submitting the image task.
  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
string
required
Text description for image generation or editing, supports multiple languages
string[]
Reference image URL list. Omit for text-to-image; include for image editing.
  • This model supports 1–5 reference images
  • Only publicly accessible absolute http:// or https:// URLs are accepted
  • Upload local images with POST /v1/uploads/images, then use the returned url
string
default:"1:1"
Output image sizeSupported formats:
  • 1:1 - Square (default)
  • 16:9 - Landscape widescreen
  • 9:16 - Portrait tall
  • 3:2 - Landscape
  • 2:3 - Portrait
integer
default:1
Number of images to generateRange: 1-10 (minimum 1, maximum 10)⚠️ Note: Must be a plain number (e.g. 1), do not add quotes, otherwise an error will occur

Response

integer
Response status code
array
Response data array

Use Cases

Case 1: Text-to-Image

Case 2: Text-to-Image (size & count)

Case 3: Image Editing (background)

Case 4: Image Editing (style)

Official Models

grok-imagine-image and grok-imagine-image-quality use the same asynchronous task flow as other image models. A successful submission returns a task ID; poll Get Task Status until the task completes or fails.
Do not send quality for either model. Omit image_urls for text-to-image; one image performs single-image editing; multiple images provide multi-image references.

Request parameters

Supported aspect_ratio values: 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, and auto.

Task submission response

202
Use data.id or data.poll_url to query the task until its status becomes completed or failed.