User Guide
Image Generation Model

Grok Imagine Image Generation

Call xAI image models through the unified image API; the current project returns a synchronous `ImageResponse` and does not support the legacy task_id polling documentation.

  • Route: POST /v1/images/generations
  • On success, returns ImageResponse synchronously

Request Example

curl --request POST \
  --url https://api.magickapi.com/v1/images/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-imagine-image",
    "prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
    "n": 1,
    "response_format": "url"
  }'

Successful Response Example

{
  "created": 1712345678,
  "data": [
    {
      "url": "https://example.com/grok-image.png",
      "b64_json": "",
      "revised_prompt": ""
    }
  ]
}

Current Limitations

The xAI image requests in the current project only guarantee these fields:

  • model
  • prompt
  • n
  • response_format

The following usages from the old documentation are no longer retained:

  • grok-imagine-1.0-apimart
  • Top-level size
  • Top-level quality
  • Top-level style
  • Asynchronous task_id

Last updated on

On this page