API docs / Image models
Grok Imagine Image 2.0 (Text to image) API
Create an image from a text prompt with Grok Imagine Image 2.0.
- Model id
xai/grok-imagine-image/v2.0/text-to-image- Provider
- xAI
- Output
- Image
- Price
- From 21 credits per run, the same as on voor.ai. Options such as length or resolution can change it.
Request
POST https://voor.ai/v1/generations with "model": "xai/grok-imagine-image/v2.0/text-to-image". Poll GET /v1/tasks/{id} or receive the signed webhook. See the overview for keys, idempotency, webhooks and errors.
curl https://voor.ai/v1/generations \
-H "Authorization: Bearer $VOOR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "xai/grok-imagine-image/v2.0/text-to-image",
"input": {
"prompt": "A red fox standing in fresh snow at golden hour, soft light"
},
"callback_url": "https://example.com/webhooks/voor"
}'
# Then poll the task (or wait for the webhook):
curl https://voor.ai/v1/tasks/TASK_ID \
-H "Authorization: Bearer $VOOR_API_KEY"Input parameters
| Name | Type | Details |
|---|---|---|
promptrequired | string | Describe the image. Put any words that must appear in quotation marks. Up to 8000 characters |
reference_images | array of URLs | Up to 5 images. Each reference adds a small charge. Up to 5 files · Accepts image/* |
aspect_ratio | string | Thirteen ratios from 2:1 wide to 1:2 tall. Default: One of: 2:1, 20:9, 19.5:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:19.5, 9:20, 1:2 |
resolution | string | 1k is about one megapixel in total; 2k is about four megapixels and costs more. Default: One of: 1k, 2k |
quality | string | Low is much faster and cheaper; medium renders finer detail. Default: One of: low, medium |
output_format | string | The file format of the generated image. Default: One of: jpeg, png, webp |