{ "model_id": "xai/grok-imagine-image-quality", "provider_id": "xai", "name": "Grok Imagine Image Quality", "description": "xAI'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.", "task": "Text-to-Image", "tags": [ "Image Generation", "Image Editing", "Multimodal", "Text Rendering", "High Quality" ], "context_length": null, "max_output_tokens": null, "schema_version": "1.0.0", "pricing": { "Per image": 0.05, "Per input image": 0.01 }, "examples": [ { "name": "Simple Generation", "description": "Basic text-to-image with just a prompt", "input": { "prompt": "A golden retriever puppy playing in autumn leaves" }, "output": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/simple-generation.jpeg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/simple-generation.jpeg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'xai/grok-imagine-image-quality',\n { prompt: 'A golden retriever puppy playing in autumn leaves' },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"xai/grok-imagine-image-quality\",\n \"input\": {\n \"prompt\": \"A golden retriever puppy playing in autumn leaves\"\n }\n}'" } ] }, { "name": "High Quality Portrait", "description": "High-quality portrait-orientation render at 2K resolution", "input": { "prompt": "A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures", "aspect_ratio": "3:4", "quality": "high", "resolution": "2k" }, "output": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/high-quality-portrait.png" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/high-quality-portrait.png" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'xai/grok-imagine-image-quality',\n {\n prompt:\n 'A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures',\n aspect_ratio: '3:4',\n quality: 'high',\n resolution: '2k',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"xai/grok-imagine-image-quality\",\n \"input\": {\n \"prompt\": \"A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures\",\n \"aspect_ratio\": \"3:4\",\n \"quality\": \"high\",\n \"resolution\": \"2k\"\n }\n}'" } ] }, { "name": "Cinematic Widescreen", "description": "Widescreen cinematic composition", "input": { "prompt": "A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting", "aspect_ratio": "16:9", "quality": "high", "resolution": "2k" }, "output": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/cinematic-widescreen.png" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/cinematic-widescreen.png" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'xai/grok-imagine-image-quality',\n {\n prompt:\n 'A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting',\n aspect_ratio: '16:9',\n quality: 'high',\n resolution: '2k',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"xai/grok-imagine-image-quality\",\n \"input\": {\n \"prompt\": \"A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting\",\n \"aspect_ratio\": \"16:9\",\n \"quality\": \"high\",\n \"resolution\": \"2k\"\n }\n}'" } ] }, { "name": "Medium Quality Landscape", "description": "Balanced quality landscape render", "input": { "prompt": "A panoramic view of the northern lights over a snowy mountain range, vivid greens and purples dancing across the sky", "aspect_ratio": "16:9", "quality": "medium", "resolution": "1k" }, "output": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/medium-quality-landscape.jpeg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/medium-quality-landscape.jpeg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'xai/grok-imagine-image-quality',\n {\n prompt:\n 'A panoramic view of the northern lights over a snowy mountain range, vivid greens and purples dancing across the sky',\n aspect_ratio: '16:9',\n quality: 'medium',\n resolution: '1k',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"xai/grok-imagine-image-quality\",\n \"input\": {\n \"prompt\": \"A panoramic view of the northern lights over a snowy mountain range, vivid greens and purples dancing across the sky\",\n \"aspect_ratio\": \"16:9\",\n \"quality\": \"medium\",\n \"resolution\": \"1k\"\n }\n}'" } ] }, { "name": "Square Low Quality Draft", "description": "Fast, rough draft for iteration", "input": { "prompt": "A quiet Japanese garden in morning mist with a stone lantern and koi pond", "aspect_ratio": "1:1", "quality": "low", "resolution": "1k" }, "output": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/square-low-quality-draft.jpeg" }, "raw_response": { "state": "Completed", "result": { "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-quality/square-low-quality-draft.jpeg" }, "gatewayMetadata": { "keySource": "Unified" } }, "code_snippets": [ { "label": "typescript", "language": "typescript", "code": "const response = await env.AI.run(\n 'xai/grok-imagine-image-quality',\n {\n prompt: 'A quiet Japanese garden in morning mist with a stone lantern and koi pond',\n aspect_ratio: '1:1',\n quality: 'low',\n resolution: '1k',\n },\n)\nconsole.log(response)" }, { "label": "curl", "language": "bash", "code": "curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n --header \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"xai/grok-imagine-image-quality\",\n \"input\": {\n \"prompt\": \"A quiet Japanese garden in morning mist with a stone lantern and koi pond\",\n \"aspect_ratio\": \"1:1\",\n \"quality\": \"low\",\n \"resolution\": \"1k\"\n }\n}'" } ] } ], "default_example": null, "code_snippets": [], "supports_async": false, "zdr": true, "zdr_comment": null, "external_info": "https://docs.x.ai/developers/models/grok-imagine-image-quality", "terms": "https://x.ai/legal/terms-of-service", "cover_image_url": "https://pub-26f1392c1b674324be6786695bd72257.r2.dev/xai/grok-imagine-image-quality.png", "metadata": { "Aspect Ratios": "1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 1:2, 2:1, auto (and more)", "Max Images per Request": "10", "Resolutions": "1k, 2k", "Text Rendering": "Yes" }, "request_formats": null, "providers": null, "provider_details": [ { "id": "xai", "pricing": { "output_image_count": 0.05, "input_image_count": 0.01 } } ], "banner": null, "created_at": "2026-05-22 17:54:08", "schema": { "input": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string" }, "n": { "type": "integer", "minimum": 1, "maximum": 10 }, "aspect_ratio": { "type": "string", "enum": [ "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", "auto" ] }, "quality": { "type": "string", "enum": [ "low", "medium", "high" ] }, "resolution": { "type": "string", "enum": [ "1k", "2k" ] }, "response_format": { "type": "string", "enum": [ "url", "b64_json" ] }, "user": { "type": "string" }, "image": { "type": "object", "properties": { "url": { "type": "string" }, "type": { "type": "string" } }, "required": [ "url" ], "additionalProperties": false }, "images": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "type": { "type": "string" } }, "required": [ "url" ], "additionalProperties": false } }, "mask": { "type": "object", "properties": { "url": { "type": "string" } }, "required": [ "url" ], "additionalProperties": false } }, "required": [ "prompt" ], "additionalProperties": false }, "output": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "image": { "type": "string", "description": "Generated image. Either a base64 data URI (`data:image/png;base64,...`) or an `https://` URL, depending on the upstream `response_format` (defaults to base64)." } }, "required": [ "image" ], "additionalProperties": false } } }