grok-imagine-image-2-0
Grok Imagine 2.0 on reAPI — two channels on one endpoint: text-to-image with 7 aspect ratios, or 14 ratios with 1k/2k output and image-to-image editing.
xAI's Grok Imagine 2.0 on reAPI, served by two channels with different
parameter surfaces — pick one with the model field:
grok-imagine-image-2-0 (text-to-image, 7 aspect ratios) or
grok-imagine-image-2.0-official (14 aspect ratios, 1k/2k output,
quality control, and image-to-image). Both return 1 to 12 images per
request, billed per delivered image. Async-first: submit returns a
task_id; poll until ready. See current pricing on the
model page.
Quick example
curl https://reapi.ai/api/v1/images/generations \
-H "Authorization: Bearer rk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2-0",
"prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space",
"n": 4,
"size": "3:2"
}'import requests
resp = requests.post(
"https://reapi.ai/api/v1/images/generations",
headers={
"Authorization": "Bearer rk_live_xxx",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-image-2-0",
"prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space",
"n": 4,
"size": "3:2",
},
timeout=30,
)
print(resp.json())const r = await fetch("https://reapi.ai/api/v1/images/generations", {
method: "POST",
headers: {
Authorization: "Bearer rk_live_xxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "grok-imagine-image-2-0",
prompt:
"An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space",
n: 4,
size: "3:2",
}),
});
console.log(await r.json());package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "grok-imagine-image-2-0",
"prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space",
"n": 4,
"size": "3:2",
})
req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer rk_live_xxx")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}The response carries a task_id. Poll
GET /api/v1/tasks/{task_id} until status is
completed, then read result.images[].url.
Channels
This model is served by two independent channels with different parameter
surfaces. Pick one with the model field:
model value | Framing | Image-to-image | Notes |
|---|---|---|---|
grok-imagine-image-2-0 | size, 7 ratios + 5 aliases | No | Standard channel, documented below. |
grok-imagine-image-2.0-official | aspect_ratio, 14 ratios | Yes | Official channel. |
They are not interchangeable: a size value is rejected by the official
channel and an aspect_ratio value is rejected by the standard one. The
resolution field exists on both but means different things.
Request body
Fields below apply to the standard channel (grok-imagine-image-2-0).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | yes | — | Must be grok-imagine-image-2-0. |
prompt | string | yes | — | Image description, used as written — there is no prompt-rewriting step. Up to 10000 characters. |
n | integer | no | 1 | Images to return, 1–12. Each delivered image is billed. |
size | string | no | vendor | Aspect ratio or pixel alias — see the table below. Values outside the list return a 400. |
resolution | string | no | vendor | Quality mode. quality is the only accepted value, and it is already the default. This is not a pixel tier — framing is size. |
size values
Seven aspect ratios:
| Value | Orientation | Typical use |
|---|---|---|
1:1 | Square | Product, avatar |
2:3 | Portrait | Poster, full-body |
3:2 | Landscape | Photo, wide scene |
3:4 | Portrait | E-commerce, people |
4:3 | Landscape | Display art |
9:16 | Vertical | Story / short-video cover |
16:9 | Wide | Banner, video cover |
Five pixel aliases are also accepted: 1024x1024 (1:1), 1024x1792 (2:3),
1792x1024 (3:2), 720x1280 (9:16), 1280x720 (16:9). Ratios not on this
list — 1:2, 2:1, 4:5, auto — return 400 INVALID_REQUEST.
Actual output pixels are chosen by the model and may differ from the alias
table — a 1:1 request commonly returns 1408x1408. Trust the returned image
rather than assuming a fixed pixel size from the ratio you sent.
The standard channel is text-to-image only. It rejects image_urls,
image, mask and every other reference field. For image-to-image on this
model, use the official channel below, which accepts
reference images. Region editing and background removal as demonstrated
inside the Grok apps are still not part of either API surface.
Official channel
Send "model": "grok-imagine-image-2.0-official" to use the vendor's own
parameter surface. It exposes wider framing control, a real pixel tier, a
quality setting, and image-to-image.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | yes | — | Must be grok-imagine-image-2.0-official. |
prompt | string | yes | — | Image description. Up to 10000 characters. |
n | integer | no | 1 | Images to return, 1–12. Each delivered image is billed. |
aspect_ratio | string | no | vendor | Output framing — 14 values, listed below. Does not change the rate. |
resolution | string | no | 1k | Pixel tier: 1k or 2k. A billing dimension. Note this is a real tier here, unlike the standard channel. |
quality | string | no | medium | low or medium. Also a billing dimension. |
image_urls | string[] | no | — | Public http(s) URLs of reference images, 1–10. Present ⇒ image-to-image. |
aspect_ratio 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, auto.
auto lets the model pick the framing that suits the prompt. Values outside
this list return 400 INVALID_REQUEST. Note the standard channel's size
values are not accepted here, and these values are not accepted there.
resolution and quality stack: each step up raises the rate by the same
increment, so 2k + medium is the most expensive combination and 1k +
low the cheapest. aspect_ratio and framing are free. See the
model page for the live
rate of each combination.
Text-to-image on the official channel
curl https://reapi.ai/api/v1/images/generations \
-H "Authorization: Bearer rk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2.0-official",
"prompt": "An editorial product poster for a ceramic pour-over kettle, bold headline type, soft studio light, generous negative space",
"n": 1,
"aspect_ratio": "16:9",
"resolution": "2k",
"quality": "medium"
}'The response is the same task_id envelope as the standard channel — poll
GET /api/v1/tasks/{task_id} and read
result.images[].url.
Image-to-image
Supplying image_urls switches the request to editing. Describe the change in
prompt; with several references, refer to them in order as <IMAGE_0>,
<IMAGE_1>, and so on.
curl https://reapi.ai/api/v1/images/generations \
-H "Authorization: Bearer rk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2.0-official",
"prompt": "Place the product from <IMAGE_0> on the marble surface in <IMAGE_1>, matching the window light",
"image_urls": [
"https://example.com/product.png",
"https://example.com/scene.jpg"
],
"aspect_ratio": "1:1",
"resolution": "2k"
}'Reference images must be public http(s) URLs — base64 and data: URIs are
rejected platform-wide. Each reference image is billed on top of the generated
image.
Response
Submission returns the standard async envelope:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
}
]
}Polled completion (GET /api/v1/tasks/{task_id}):
{
"code": 200,
"data": {
"status": "completed",
"result": {
"images": [
{ "url": "https://cdn.reapi.ai/..." },
{ "url": "https://cdn.reapi.ai/..." }
]
}
}
}result.images carries one entry per delivered image, so a request with
n: 4 returns four entries. Image URLs are valid for 24 hours from
completion — re-host the asset to your own storage if you need durable
access.
Pricing
Both channels bill per delivered image, multiplied by n, but they dimension
the rate differently:
- Standard — flat. Neither
sizenorresolutionchanges it, so a 16:9 image costs the same as a square one. - Official —
resolutionandqualityeach move the rate and stack, for four combinations across three price points (1k+mediumand2k+lowsettle at the same rate).aspect_ratioandndo not change the per-image rate. Reference images are billed on top.
A request with n: 12 costs twelve times a single image on either channel.
credits = ceil(per_image_usd × n × 1000)1 credit = $0.001. The rounding happens once on the aggregate, not per
image. See the model page
for the live rate.
Failed generations are refunded automatically — the reserved credits return to your balance when a task ends in failure.
Errors
grok-imagine-image-2-0 shares the platform-wide
error envelope. The validation surface is small:
promptmissing, empty, or whitespace-only →400 INVALID_REQUEST.promptlonger than 10000 characters →400 INVALID_REQUEST.noutside1–12→400 INVALID_REQUEST.sizeoutside the seven ratios and five pixel aliases →400 INVALID_REQUEST.resolutionset to anything other thanquality→400 INVALID_REQUEST.- Any reference media (
image_urls,image,mask) supplied →400 INVALID_REQUESTwith a text-to-image-only message.
On the official channel:
aspect_ratiooutside its 14 values →400 INVALID_REQUEST. The standard channel's pixel aliases (1024x1024etc.) are not valid here.resolutionset to anything other than1k/2k→400 INVALID_REQUEST. The standard channel'squalityvalue is rejected.qualityset to anything other thanlow/medium→400 INVALID_REQUEST.- More than 10 entries in
image_urls, or a non-http(s) URL →400 INVALID_REQUEST.
Tips
- The prompt is rendered as written, so lens, lighting and material language survives to the render. A thin prompt stays thin — there is no rewriting layer filling in composition for you.
- Ask for the shape you will ship. Generating 16:9 directly beats generating a square and cropping it, because the model composes for the frame.
- Batch exploration in one call. Twelve variations of one brief cost the same as twelve separate single-image requests but take one round trip.
Related
- imagen-4-0 — flat-rate text-to-image, one image per request
- seedream-5-0-lite — text-to-image plus image editing
- grok-imagine-1-0-video — the video sibling in the same family