Grok Imagine Image Generation
xAI Grok Imagine image models with text-to-image and image-to-image support, returning OpenAI-compatible output. grok-imagine-image-2.0 adds resolution × quality pricing.
Endpoint
POST $URL/v1/images/generationsSupported Models
| Model | Positioning | Resolution | Quality |
|---|---|---|---|
grok-imagine-image | Standard, text/image-to-image | 1k / 2k | — |
grok-imagine-image-quality | High-quality tier | 1k / 2k | — |
grok-imagine-image-2.0 | Latest, quality control | 1k / 2k | low / medium / auto |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | One of the models above |
prompt | string | Yes | Image description |
n | integer | No | Number of images 1–10, default 1 |
resolution | string | No | 1k (default) / 2k |
quality | string | No | low / medium / auto, only on grok-imagine-image-2.0; auto lets the service choose (currently billed as low) |
aspect_ratio | string | No | 1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 21:9 etc., default auto |
image | string | object | No | Image-to-image: reference image URL / base64; use images array for multiple references |
response_format | string | No | url (default, temporary links) / b64_json |
Request Example
bash
curl $URL/v1/images/generations \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2.0",
"prompt": "A cat wearing sunglasses walking down a neon street",
"n": 1,
"resolution": "2k",
"quality": "medium"
}'Pricing
Billed per output image (resolution × quality); reference images are billed per input image (aligned with xAI official prices):
| Model | 1K | 2K | Input image |
|---|---|---|---|
grok-imagine-image | $0.02 / image | $0.02 / image | $0.002 / image |
grok-imagine-image-quality | $0.05 / image | $0.07 / image | $0.01 / image |
grok-imagine-image-2.0 | Low $0.04 / Medium $0.06 | Low $0.06 / Medium $0.08 | $0.01 / image |
Example: one grok-imagine-image-2.0 2K·Medium image = $0.08; n=4 is billed as 4 output images.
Notes
- Result URLs are temporary — download promptly (or request
response_format: "b64_json"); qualitydefaults toauto, chosen server-side (currently low for generation);- Group multipliers apply on top of the base prices above.
