Back to Models
Grok Imagine Image 2.0
xaixai/grok-imagine-image-2.0
Text-to-image generation at 1024Γ1024. Image editing and larger resolutions are not currently available through this route.
Context Length
--
Max Output
--
Image Priceper request
$0.0432/ image
Modalities
textβimage
Capabilities
Image Generation
Media Generation Capabilities
image_generation
- sizes
- 1024x1024
- qualities
- low
- max_outputs_per_request
- 4
- defaults
- size
- 1024x1024
- quality
- low
Pricing Breakdown
| Type | Rate |
|---|---|
| Image | $0.0432 / image |
Per generated image at 1024Γ1024. Low quality $0.04; other qualities are not currently available.
Supported Parameters
promptsizenquality
API Usage Examples
Use the global api.therouter.ai endpoint shown below for new integrations; the legacy China accelerated endpoint is retired.
Recommended: use the async API
Image generation typically takes 30β180s, beyond the edge sync timeout. The examples below use the ?async=true submit + poll pattern. Read the full async image generation & edit guide β
cURL
# 1) Submit job (returns 202 immediately with a polling URL).
# Image generation takes 30-180s β always use the async path in production.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/generations?async=true" -H "Content-Type: application/json" -H "Authorization: Bearer $THE_ROUTER_API_KEY" -d '{
"model": "xai/grok-imagine-image-2.0",
"prompt": "A cinematic product render with soft studio lighting"
}' | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"
# 2) Poll until terminal (succeeded / failed / cancelled / expired).
while :; do
R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB" -H "Authorization: Bearer $THE_ROUTER_API_KEY")
S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
echo "status: $S"
case "$S" in
succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
failed|cancelled|expired) echo "$R"; exit 1 ;;
esac
sleep 5
done