Generating Images with xAI’s grok-imagine-image API
xAI’s image generation endpoint (/v1/images/generations) lets developers turn text prompts into images using the grok-imagine-image family (including grok-imagine-image-2.0). Rather than forcing developers into rigid pixel-dimension presets, the API centers on aspect ratios, output formats (url vs. b64_json), batch counts, and—on grok-imagine-image-2.0—explicit resolution and quality controls.
Core Endpoint and Request Parameters
Requests go to [https://api.x.ai/v1/images/generations](https://api.x.ai/v1/images/generations) via authenticated JSON (Authorization: Bearer $XAI_API_KEY) or through OpenAI-compatible and xAI SDKs.
| Parameter | Type / Values | Default | Notes |
|---|---|---|---|
prompt |
string |
Required | Text description of the scene, subject, lighting, and composition. |
model |
string |
— |
Comments |
Leave a Reply