xAIText to imageAvailable now
grok-imagine-image-2.0
grok-imagine-image-2.0 is a text to image tool from xAI that runs in the background and returns images. Pay as you go from $0.052 per image, with one API key.
Try itfrom $0.052 / image
Pricing
quality / resolution: otherwise / 1k (default) $0.052, otherwise / 1.5k $0.065, otherwise / 2k $0.078, medium / 1k (default) $0.078, medium / 1.5k $0.091, medium / 2k $0.104 per image. Billed on n, default 1.
Limits
- Runs
- In the background
- Returns
- image
- Longest queue wait
- 3600s
- Run deadline
- 1800s
- Largest inline input
- 1024 KB
- Largest input file
- 500 MB
- Largest output
- 4768 MB
- Outputs per run
- 16
Input
| Field | Kind | Default | Description |
|---|---|---|---|
prompt required | text | — | Prompt for image generation. |
n | number (whole) 1 to 10 | 1 | Number of images to be generated |
quality | one of low, medium, auto | — | Quality of the generated image (grok-imagine-image-2.0). `auto` uses `low`. |
resolution | one of 1k, 2k, 1.5k | — | Resolution of the generated image. Defaults to `1k`. Only supported by grok-imagine models. |
aspect_ratio | one of 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, 21:9, 5:2, auto | — | Aspect ratio of the generated image. Can be `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`, `21:9`, `5:2`, or `auto`. Defaults to `auto` for automatically selecting the best ratio for the prompt. Only supported by grok-imagine models. |
Same request in code
curl https://api.spiral.ai/v1/runs \
-H "Authorization: Bearer $SPIRAL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"provider": "xai",
"model": "grok-imagine-image-2.0",
"input": {
"prompt": "<prompt>"
}
}'