xAI
Grok Imagine Image 2.0
grok-imagine-image-2.0/image-to-image
xAI's image generation and editing model, with strong instruction following and complex layout rendering, supports iterative image editing with reference images, and can output 1K/2K images in multiple aspect ratios
Try grok-imagine-image-2.0/image-to-image
Input
Showcases
View all showcasesOutput
imagePricing
grok-imagine-image-2.0/image-to-image per image
| Unit Price | $0.065 |
|---|
Positioning Overview
grok-imagine-image-2.0's image editing path: upload a reference image and give an editing instruction, and the model completes rewriting and iterative adjustments while preserving the original composition and key details. It is better suited to developers who need precise image edits based on complex text instructions, such as multi-round revisions of poster layouts, product images, and concept drafts. Called through the unified HiAPI.ai interface, you can get an edited result by inputting a reference image and a prompt.
Core Highlights
- Instruction-based editing that preserves the original image composition — The output follows the framing and layout of the reference image, and the model changes only the specified content according to the prompt, avoiding detail loss caused by redrawing the entire image.
- Clearer complex layouts and text typography — For materials containing text, columns, and complex layouts, rendering clarity is better, making it suitable for revising posters and covers.
- Multi-round iteration that gradually converges — By repeatedly submitting editing instructions on the same reference image, key visual details are preserved well, making it easy to gradually approach the target effect.
- Two quality and resolution tiers available — quality offers two tiers, low and medium, and resolution supports 1k and 2k, allowing compute to be allocated according to preview and final-output stages.
Capability Description
Instruction-based editing with a reference image: Takes a JPG, PNG, or WebP reference image plus an editing prompt as input and outputs a rewritten image; suitable for replacing elements, adjusting style, and local redrawing.
Fine-grained instruction following: It can reproduce multiple creative constraints in a prompt, with a high degree of fulfillment for long descriptions and multi-condition image-editing requests, reducing repeated retries.
Tier and resolution control: Choosing low for quality produces previews faster, while medium is the recommended default; resolution can be switched between 1k and 2k, balancing drafts and final outputs.
Framing output based on the reference image: During editing, the output follows the reference image's composition. Although the aspect_ratio parameter can be passed, it does not affect the result, so no additional adaptation for aspect ratio is needed during integration.
Applicable Scenarios
- Designers revising based on an existing layout — Upload a poster or cover draft and describe the modification points to get a new draft that preserves the layout structure, for quickly comparing multiple versions.
- Material rewriting and re-creation of product images — Use real product photos as references to rewrite backgrounds and atmosphere, producing final images that can be used directly for detail pages and advertising materials.
- Multi-round local adjustments to concept drafts — Submit editing instructions round by round on an initial draft and gradually correct details, for converging options during the concept visualization stage.
- Adaptation of social media and advertising materials — Generate different variations in batches based on the same reference image, producing multiple sets of vertical or square materials for channel placement testing.
Limitations and Selection Advice
A single request accepts only one reference image and cannot perform multi-image fusion; output quality has only two tiers, low and medium, with a maximum resolution of 2k, so ultra-high-definition or print-level needs require separate upscaling. During editing, the aspect ratio is fixed to the reference image and the framing cannot be changed in the request. The model is relatively new, and independent evaluations and long-term stability data are limited; for batch production with extremely high requirements for result consistency, it is recommended to validate with a small sample first.
Frequently asked questions
View all FAQs →-
What is Grok Image 2.0 Text to Image best for?
Generate product, editorial, landscape, and character visuals in low or medium quality at 1K/2K across square to ultrawide formats.
-
Does Grok Image 2.0 Text to Image accept reference images?
No. This route is text-to-image only.
-
Which output settings are supported?
The page exposes 1K, 2K and auto, 1:1, 16:9, 9:16, 4:3, 3:4, 2:1, 1:2; use the Playground contract for the final available set.
-
How is Grok Image 2.0 Text to Image billed?
Billing is per successful generated image. Resolution or quality differences, when present, are reflected by the live page price.
Create a generation task
https://api.hiapi.ai/v1/tasks Headers
AuthorizationstringRequiredAccount API key. Required on every request. Example: Bearer YOUR_HIAPI_API_KEY. Get your API key
Content-TypestringOptionalThe request body is always parsed as JSON; when sent, only application/json (optionally with charset) is accepted — any other value returns 415. Example: application/json.
Idempotency-KeystringOptionalIdempotency key, up to 255 bytes. Retries with the same key from the same account create the task only once; replays return the original taskId.
On network timeouts or client retries, the same key creates the task only once — no double charges (scope: the API key's account). Use a business-unique identifier as the key (e.g. "order-42"); replays return the original taskId, and keys expire 24 hours after the first request. See the Unified Async API overview for the full scenario matrix.
Body
modelstringRequiredCurrent fixed value: grok-imagine-image-2.0/image-to-image
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for grok-imagine-image-2.0/image-to-image and route default — see the parameter table below.
imagestringRequiredThe reference image to be edited, given as a publicly accessible JPG, JPEG, PNG, or WebP image URL.
promptstringRequiredminLength 1The editing instruction for the reference image, describing in text the desired modification effect.
qualitystringOptionalDefault: "medium"Generation quality, provided as a string; the default is medium (recommended); low produces faster generation.
lowmediumresolutionstringOptionalDefault: "1k"The resolution of the output image, provided as a string; the default is 1k.
1k2kaspect_ratiostringOptionalDefault: "1:1"The output aspect ratio, provided as a string; the default is 1:1. In editing scenarios this parameter is accepted but has no effect; the output follows the composition of the reference image.
1:116:99:164:33:43:22:32:1Show all (6)
1:219.5:99:19.520:99:20autocallbackobjectOptional
Terminal-state notification config. When omitted, no callback is delivered — poll the task yourself. See the callback note below.
Provide callback.url when creating a task and HiAPI POSTs to your service once the task reaches a terminal state — no polling needed. The callback payload mirrors the task detail structure; signature verification, delivery retries and idempotency are documented on the Unified Async API overview page.
urlstringRequiredRequired when callback is present. A POST is sent to this URL once the task reaches a terminal state; must be a valid http(s) URL.
whenstringOptionalDefault: "final"Only final is supported today — notified on both success and fail.
finalstoragestringOptionalDefault: "temp"Artifact storage tier: temp (default, retained about 7 days) or persistent (long-term, billed by size). Insufficient balance or exceeding the storage cap silently downgrades to temp; the effective tier is shown in the task detail response.
temppersistentRequest examples
# Submit an async task; returns a taskId immediately (no waiting for generation)
curl -X POST "https://api.hiapi.ai/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2.0/image-to-image",
"input": {
"image": "…",
"prompt": "…",
"quality": "medium",
"resolution": "1k",
"aspect_ratio": "1:1"
}
}' const res = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "grok-imagine-image-2.0/image-to-image",
input: {
"image": "…",
"prompt": "…",
"quality": "medium",
"resolution": "1k",
"aspect_ratio": "1:1"
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "grok-imagine-image-2.0/image-to-image",
"input": {
"image": "…",
"prompt": "…",
"quality": "medium",
"resolution": "1k",
"aspect_ratio": "1:1"
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} Get task detail
https://api.hiapi.ai/v1/tasks/:id Response fields
taskIdstringRequiredTask ID, always prefixed with tk-hiapi-.
modelstringRequiredResolved full model name. Tasks submitted with the route parameter return base@route (e.g. gpt-image-2/text-to-image@ext); otherwise identical to the name passed at creation.
routestringOptionalPresent only when the task was submitted with an explicit route parameter; echoes the submitted value.
statusstringRequiredTask status.
queued Queued, not started yet.
handling Being processed.
archiving Processing finished, artifacts being prepared.
success Terminal: completed, artifacts available (output returned).
fail Terminal: failed (error returned).
After submission, check status: success and fail are terminal, everything else is non-terminal. Poll every 1–3 seconds until terminal. On success, download artifacts from output[].url and transfer them before expireAt; pass storage: "persistent" at creation time when long-term retention is needed.
creatednumberRequiredTask creation time (Unix seconds).
completednumberRequiredUnix seconds when the task reached a terminal state; fixed to 0 while not terminal.
outputarrayOptional
Present only when status == success. Artifact list — always an array; a single task may return multiple types at once (e.g. video + first_frame).
Array [ object ]
Array items
urlstringRequiredArtifact URL, directly downloadable.
typestringRequiredCurrent possible values: video, image, audio, first_frame, last_frame, thumbnail; more may be added later.
expireAtnumberRequiredUnix seconds until which the artifact remains accessible; download or transfer before it expires.
errorobjectOptional
Present only when status == fail.
codestringRequiredBusiness error code.
messagestringRequiredError description.
Response examples
Success
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} Processing (non-terminal)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} Failed
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
} Articles
View all articles →Related Models
View all models →Same Type
-
Grok Imagine xAI $0.011 /second -
Recraft Crisp Upscale Recraft $0.004 /image -
Nano Banana Pro Google $0.057 /image -
FASHN Tryon v1.6 FASHN $0.107 /image -
Nano Banana Google $0.021 /image -
Recraft V4.1 Recraft $0.010 /image -
Ideogram V4.5 Ideogram $0.011 /image -
Seedream 5.0 ByteDance $0.025 /image -
Qwen Image 2.0 Alibaba $0.042 /image -
Grok Imagine Quality xAI $0.070 /image -
FLUX.1 Schnell Black Forest Labs $0.005 /image -
FLUX.2 Klein 9B Black Forest Labs $0.0086 /image







