Grok Imagine Image Quality
Text-to-Image • xAI • ProxiedxAI's higher-fidelity text-to-image model optimized for sharper details, more accurate compositions, and stronger text rendering. Supports image editing via reference images and masks. Trades speed for quality compared to grok-imagine-image. Default output at 2k resolution.
| Model Info | |
|---|---|
| Terms and License | link ↗ |
| More information | link ↗ |
| Pricing | View pricing in the Cloudflare dashboard ↗ |
Usage
const response = await env.AI.run( 'xai/grok-imagine-image-quality', { prompt: 'A golden retriever puppy playing in autumn leaves' },)console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "model": "xai/grok-imagine-image-quality", "input": { "prompt": "A golden retriever puppy playing in autumn leaves" }}'
{ "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/simple-generation.jpeg" }, "gatewayMetadata": { "keySource": "Unified" }}Examples
High Quality Portrait — High-quality portrait-orientation render at 2K resolution
const response = await env.AI.run( 'xai/grok-imagine-image-quality', { aspect_ratio: '3:4', prompt: 'A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures', quality: 'high', resolution: '2k', },)console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "model": "xai/grok-imagine-image-quality", "input": { "aspect_ratio": "3:4", "prompt": "A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures", "quality": "high", "resolution": "2k" }}'
{ "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/high-quality-portrait.png" }, "gatewayMetadata": { "keySource": "Unified" }}Cinematic Widescreen — Widescreen cinematic composition
const response = await env.AI.run( 'xai/grok-imagine-image-quality', { aspect_ratio: '16:9', prompt: 'A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting', quality: 'high', resolution: '2k', },)console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "model": "xai/grok-imagine-image-quality", "input": { "aspect_ratio": "16:9", "prompt": "A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting", "quality": "high", "resolution": "2k" }}'
{ "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/cinematic-widescreen.png" }, "gatewayMetadata": { "keySource": "Unified" }}Medium Quality Landscape — Balanced quality landscape render
const response = await env.AI.run( 'xai/grok-imagine-image-quality', { aspect_ratio: '16:9', prompt: 'A panoramic view of the northern lights over a snowy mountain range, vivid greens and purples dancing across the sky', quality: 'medium', resolution: '1k', },)console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "model": "xai/grok-imagine-image-quality", "input": { "aspect_ratio": "16:9", "prompt": "A panoramic view of the northern lights over a snowy mountain range, vivid greens and purples dancing across the sky", "quality": "medium", "resolution": "1k" }}'
{ "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/medium-quality-landscape.jpeg" }, "gatewayMetadata": { "keySource": "Unified" }}Square Low Quality Draft — Fast, rough draft for iteration
const response = await env.AI.run( 'xai/grok-imagine-image-quality', { aspect_ratio: '1:1', prompt: 'A quiet Japanese garden in morning mist with a stone lantern and koi pond', quality: 'low', resolution: '1k', },)console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "model": "xai/grok-imagine-image-quality", "input": { "aspect_ratio": "1:1", "prompt": "A quiet Japanese garden in morning mist with a stone lantern and koi pond", "quality": "low", "resolution": "1k" }}'
{ "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/square-low-quality-draft.jpeg" }, "gatewayMetadata": { "keySource": "Unified" }}Parameters
stringenum: 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, autoobjectarraymaxItems: 10objectintegermaximum: 10minimum: 1stringrequiredstringenum: low, medium, highstringenum: 1k, 2kstringenum: url, b64_jsonstringstringGenerated image. Either a base64 data URI (`data:image/png;base64,...`) or an `https://` URL, depending on the upstream `response_format` (defaults to base64).