xAI · Image API
Grok Imagine 2.0
grok-imagine-2.0-extFast text-to-image generation with multi-image output and seven supported aspect ratios.
POST
/v1/images/generationsOutput count1–12
Reference imagesNot supported
Resolution tiersquality
Generation
Generate with Grok Imagine 2.0
Use ImgRouter's unified request contract and this model ID. The example uses recommended defaults from the route's current parameter guide.
curl https://api.imgrouter.com/v1/images/generations \
-H "Authorization: Bearer $IMGROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: grok-imagine-2.0-ext-generate-001" \
-d '{
"model": "grok-imagine-2.0-ext",
"prompt": "Editorial product photograph, precise materials, soft studio light",
"size": "16:9",
"resolution": "quality",
"n": 1
}'Request body
modelstring · requiredUse grok-imagine-2.0-ext.promptstring · requiredGeneration or editing instruction between 1 and 5,000 characters.sizestringSupported values: 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9.resolutionstringSupported values: quality.ninteger · 1–12Number of output images. Defaults to 1 and cannot exceed 12.Controls
Supported options
Route notes
Text-to-image route; reference images are not accepted.
Use resolution "quality" or omit resolution. This route does not use 1K/2K/4K tiers.
Image URLs are temporary, so copy completed assets to durable storage.
Response
Read the completed output
Successful requests return completed image URLs and a request ID. Store the assets you need permanently; routed output URLs may expire.
{
"id": "req_01K4…",
"object": "image.generation",
"created": 1787424152,
"data": [
{ "url": "https://static.imgrouter.com/images/req_01K4.webp" }
],
"usage": { "images": 1 }
}Use GET /v1/requests/{request_id} for reconciliation and GET /v1/balance for the authenticated key's current Credit position.