Skip to content
English

Grok Imagine Quality Text to Image API

POST /v1/tasks

All models are called through the Unified Async API POST /v1/tasks endpoint; only the input fields differ (see input parameters below).

Model summary

Model name grok-imagine-quality/text-to-image
Type Image generation (text-to-image)
Endpoint POST /v1/tasks
Pricing See HiAPI Pricing

Grok Imagine quality-tier text-to-image (xAI official quality model): hero-grade detail, materials, and lighting with 13 aspect ratios, priced per image in 1k/2k resolution tiers.

Production guidance

Production guidance
  • For production, pass callback.url at the top level of the request body so HiAPI can notify your service when the task reaches a terminal state.
  • GET /v1/tasks/:id is better for local debugging, low-volume jobs, or fallback reconciliation if a callback is missed.
  • Use callback.when=final. Both success and fail are terminal states, so your service should deduplicate by taskId.

Best suited for

Hero-grade output

Richer detail, materials, and lighting — built for hero shots, poster visuals, and commercial assets.

prompt
13 aspect ratios

From 2:1/20:9 ultra-wide to 9:20 extra-tall, covering every social format.

aspect_ratio
1k/2k tiered pricing

Priced by resolution tier: validate prompts at 1k, switch to 2k for final output.

resolution
Standard-tier sibling model

For volume and ideation, switch to grok-imagine/text-to-image — fast and cheap with flat 1k/2k pricing.

prompt

Request parameters

model string required

Fixed value grok-imagine-quality/text-to-image.

example grok-imagine-quality/text-to-image
input object required

Business parameters. Put Grok Imagine Quality Text to Image-specific configuration here.

prompt string required

Text description of the image to generate.

aspect_ratio enum optional

Aspect ratio of the generated image.

default 1:1 enum: 2:120:919.5:916:94:33:21:12:33:49:16 +3
resolution enum optional

Output image resolution. 1k and 2k are billed as separate tiers.

default 1k enum: 1k2k
output_format enum optional

Output image format.

default jpeg enum: jpegpngwebp
callback object optional

Optional callback configuration. When set, HiAPI notifies your service when the task reaches a terminal state.

url string required

Required when callback is set; HTTPS URL that receives terminal task notifications.

example https://your-domain.com/hiapi/callback
when enum optional

Callback trigger timing. Use final.

default final enum: final

Example requests

Volcano at night (2k)

Tested on the quality tier with full parameters at 16:9.

Request body
{
  "model": "grok-imagine-quality/text-to-image",
  "input": {
    "prompt": "a volcano erupting at night, lava rivers branching under a starry sky, cinematic composition, dramatic directional lighting, rich cohesive color grade, ultra-detailed, premium commercial finish, subtle film grain, shallow depth of field, high dynamic range",
    "aspect_ratio": "16:9",
    "resolution": "2k",
    "output_format": "jpeg"
  }
}
Koi dragon in clouds (2k)

Tested on the quality tier at the 2k tier.

Request body
{
  "model": "grok-imagine-quality/text-to-image",
  "input": {
    "prompt": "A majestic koi dragon swimming through sunlit clouds above misty mountain peaks, scales shimmering gold and vermilion",
    "aspect_ratio": "16:9",
    "resolution": "2k"
  }
}

Getting the result

  1. The response returns a taskId immediately without waiting for generation to finish.
  2. In production, prefer waiting for callback.url to receive the terminal notification. For local debugging, poll GET /v1/tasks/:id.
  3. When status=success, download the generated image from output[].url.
  4. When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.

FAQ

How does it relate to the standard grok-imagine models?

Both belong to the xAI Grok Imagine family: grok-imagine/text-to-image is fast and cheap for volume; grok-imagine-quality is the standalone xAI official quality model series with richer detail, materials, and lighting for hero output.

How is it billed?

Per image, tiered by resolution: 1k and 2k are priced differently. See the HiAPI pricing page for live rates. View live pricing

Is 4k available?

The quality series currently offers 1k and 2k tiers only — no 4k.

Does it take reference images?

Use grok-imagine-quality/image-to-image for reference-based edits.

Next steps