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"
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 at most 1 reference image
  • Supports public https:// URLs or data:image/...;base64,...
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)