xai/grok-imagine-image-quality, served by Comfy Router from xAI.
Quick start
Create a key in your Comfy workspace and export it asCOMFY_API_KEY. The Python and TypeScript snippets use the Comfy SDKs (pip install comfy-sdk, npm install @comfyorg/sdk); the cURL snippet is the same call over raw HTTP.
Model ID: xai/grok-imagine-image-quality
Endpoint: POST https://api.comfy.org/v2/models/xai/grok-imagine-image-quality
- Wait for the result
- Queue and collect later
Schema
Input
string
default:"\"auto\""
Aspect ratio of the generated image. Defaults to auto for automatically selecting the best ratio for the prompt.Possible values:
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, autostring
default:"\"grok-imagine-image\""
Model to be used. Supported: grok-imagine-image (default), grok-imagine-image-pro, grok-imagine-image-quality, grok-imagine-image-2.0. Deprecated -beta ids are aliased to their GA model.
integer
default:"1"
Number of images to be generatedRange:
1 to 10string
required
Prompt for image generation
string
Quality of the output image. For grok-imagine-image-2.0 this selects the price tier (low/medium; medium is the default); other models currently ignore it.Possible values:
low, medium, highstring
default:"\"1k\""
Resolution of the generated image. Defaults to 1k.Possible values:
1k, 2kstring
default:"\"url\""
Response format to return the image in. Can be url or b64_json. Comfy coerces this to
url on the outbound request — on the Comfy Router dispatch (POST /v2/models/xai/{model}) and on this /proxy/ route too — because image results are served as re-hosted URLs either way. The field is accepted and ignored rather than rejected; send it or omit it, the answer is the same.Possible values: url, b64_jsonstring
Size of the image (not supported)
string
Style of the image (not supported)
string
A unique identifier representing your end-user, which can help xAI to monitor and detect abuse
GET /v2/models/xai/grok-imagine-image-quality/openapi.json, the same document it validates a call against before the request reaches the provider.
Output
string
If the request was blocked by input moderation, contains the block reason
object[]
A list of generated image objects
string
A base64-encoded string representation of the generated image in jpeg encoding (if response_format is b64_json)
string
The MIME type of the generated image (e.g. image/png, image/jpeg, image/webp).
string
A url to the generated image (if response_format is url)
object
Usage information for the image generation request
integer
Accurate cost of this request in USD ticks (10,000,000,000 ticks = 1 USD)
Examples
Input
Output
Before you ship
The SDKs create anIdempotency-Key and reuse it for automatic retries. For manual retries, reuse the original key. Router can hold the connection for up to 10 minutes.
When a request fails, Router sends an X-Comfy-Error-Type response header explaining why. A 422 means Router rejected the input before calling the provider, and a 413 means the request body was larger than Router accepts. Download generated assets promptly because result URLs can expire.
Any size limit named in a field description above is the provider’s own bound on that field, quoted from the provider’s specification. Router applies a separate cap to the whole request body, which base64-encoded media counts against: see request body size.
Headers
Authentication, idempotency, request IDs, error buckets, retry pacing, spend limits.
Using the Router API
Model discovery, validation errors, retries, and billing.
Limitations
What Router does not do today, and what to use instead.