Skip to content
English

Grok Imagine Quality Image 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/image-to-image
Type Image generation (image-to-image)
Endpoint POST /v1/tasks
Pricing See HiAPI Pricing

Grok Imagine quality-tier image editing (xAI official quality model): stronger subject consistency and detail preservation with up to 3 references, 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

High-consistency editing

Stronger subject consistency and detail preservation — heavy style transformations keep composition.

image_urlsprompt
Multi-reference blending

Up to 3 references cited by order — composites and subject transfer.

image_urlsprompt
Auto aspect

Defaults to the first input image ratio — change content, keep framing.

aspect_ratio
Standard-tier sibling model

For volume edits, switch to grok-imagine/image-to-image — fast and cheap, price independent of reference count.

prompt

Request parameters

model string required

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

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

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

prompt string required

Editing instruction describing the desired output.

aspect_ratio enum optional

Aspect ratio of the generated image. 'auto' follows the first input image.

default auto enum: auto2:120:919.5:916:94:33:21:12:33:4 +4
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
image_urls string[] required

Input reference images (1-3). Public URLs; jpeg/png/webp (SVG not supported).

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

Ink-wash koi dragon (1k)

Tested style transformation on the quality tier — repainted as ink wash while keeping composition.

Request body
{
  "model": "grok-imagine-quality/image-to-image",
  "input": {
    "prompt": "Repaint this scene as a traditional Chinese ink wash painting with bold brush strokes, rice paper texture and red seal stamp accent, keep the dragon composition",
    "image_urls": [
      "https://static.hiapi.ai/gallery/2026/07/3bb709d2480111a5.jpg"
    ],
    "resolution": "1k"
  }
}

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 many references?

1-3, cited by order in the prompt.

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

Both belong to the xAI Grok Imagine family: grok-imagine/image-to-image is fast and cheap for volume; grok-imagine-quality is the standalone xAI official quality model series with stronger subject consistency and detail preservation for hero output.

How is it billed?

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

Next steps