Grok Imagine API: Python Guide and 3 Models Tested Side by Side
Three Grok image models, the same four prompts. Here is which to use.
On this page
- Short answer
- What is the Grok Imagine API?
- Which Grok Imagine model should you use?
- Test 1: poster text
- Test 2: a realistic photo
- Test 3: a product shot
- Test 4: counting objects
- How do you call it from Python?
- How much does the Grok Imagine API cost?
- What should you watch out for?
- Conclusion
- Common questions
- Is the Grok Imagine API free?
- Can Grok Imagine make videos through the API?
- Which image size do I get?
- What happens to grok-imagine-image-quality after November 2?
The Grok Imagine API is xAI's API for images and video, and it has three image models you can call today: grok-imagine-image, grok-imagine-image-quality and grok-imagine-image-2.0. We ran the same four prompts through all three on October 18, 2026, and Grok Imagine 2.0 won three of the four tests.
Below: which model to pick, a Python script that runs as is, what xAI charges per image, and what to watch for.
Short answer
- Use Grok Imagine 2.0 (
grok-imagine-image-2.0) by default. It gave the best poster typography, product shot and photo in our tests, and xAI lists it from $0.04 per image. - Keep the original
grok-imagine-imagefor cheap drafts: $0.02 per image at xAI, and it got our poster text right too. - Skip
grok-imagine-image-quality: xAI retires it on November 2, 2026, and it added a made-up address to our poster. - Every image came back in 7 to 18 seconds.

What is the Grok Imagine API?
It is xAI's image and video API, opened on January 28, 2026 (xAI). Image 2.0 followed on August 7, 2026, and xAI says it ranks second in the world for both image generation and editing (xAI).
| Model ID | What it is | xAI price, 1K |
|---|---|---|
grok-imagine-image | The original, cheapest | $0.02 |
grok-imagine-image-quality | Retires November 2 | $0.05 |
grok-imagine-image-2.0 | The current model | $0.04 |
All three are on OmniaKey: Grok Imagine, Grok Imagine Quality and Grok Imagine 2.0. OmniaKey sells API access to them, so we ran our tests through it; every price here is xAI's own.
Which Grok Imagine model should you use?
Grok Imagine 2.0, unless you only need cheap drafts. We gave each model the same four prompts once, with no size or aspect settings, and judged the images at full size.
Test 1: poster text
Prompt:
A minimalist poster for a neighborhood coffee shop opening. Large bold headline text "GRAND OPENING", smaller text below "Saturday 9 AM", a simple line drawing of a coffee cup, cream background, dark brown ink.
All three spelled both lines correctly (the poster above). Grok Imagine 2.0 had the most designed layout, with thin rules around the date. Quality added a line nobody asked for:

Verdict: 2.0 for the look, the original if you just need the words right. Avoid Quality for print: invented text is the last thing you want on a flyer.
Test 2: a realistic photo
Prompt:
A realistic photo of an elderly fisherman mending a blue net on a wooden dock at sunrise, soft golden light, gulls in the background, shallow depth of field.

- Grok Imagine: lovely golden light and a believable scene, with the whole dock in focus.
- Quality: right subject and setting, but the fisherman is small in the frame and the detail is softer.
- Grok Imagine 2.0: a close-up with a blurred background, the only one that clearly did "shallow depth of field".
Verdict: 2.0.
Test 3: a product shot
Prompt:
Studio product photo of a matte black wireless earbud case, lid open, both earbuds inside, on a pure white background, soft shadow, sharp focus, no text, no logo.

All three got every detail right: open lid, both earbuds, white background, no logo. The original left the case small in the frame, and Quality shot it at an angle. Grok Imagine 2.0 filled the frame with crisp detail, ready for a store listing.
Verdict: 2.0.
Test 4: counting objects
Prompt:
Top-down photo of a wooden table with exactly three red apples on the left and exactly two green pears on the right, nothing else on the table.

All three put exactly three apples on the left and two pears on the right, with nothing else on the table. The original showed the pears standing upright rather than from above, and 2.0's pears came out more yellow than green.
Verdict: a tie on counting; Quality had the cleanest top-down shot.
| Test | Winner | Why |
|---|---|---|
| Poster text | 2.0 | Right text, best layout |
| Realistic photo | 2.0 | Real depth of field |
| Product shot | 2.0 | Most detail |
| Counting | Tie | All counted right |
How do you call it from Python?
Three steps: create the job, check it until it is done, then download the image. Put your key in an environment variable and run:
import os
import time
import uuid
import requests
API = "https://api.omniakey.com/v1/media/tasks"
HEADERS = {"Authorization": f"Bearer {os.environ['OMNIAKEY_API_KEY']}"}
# 1. Create the job. Reuse the same Idempotency-Key only when retrying this exact request.
job = requests.post(
API,
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={
"model": "grok-imagine-image-2.0",
"type": "image",
"operation": "generate",
"input": {"prompt": "A flat illustration of a red bicycle leaning on a yellow wall, morning light"},
},
timeout=30,
)
job.raise_for_status()
task = job.json()
print("task:", task["id"], task["status"])
# 2. Poll on status until the job finishes.
while task["status"] in ("queued", "processing"):
time.sleep(2)
task = requests.get(f"{API}/{task['id']}", headers=HEADERS, timeout=30).json()
if task["status"] != "succeeded":
raise SystemExit(f"job ended {task['status']}: {task.get('error')}")
# 3. Download the image now: the signed URL is short-lived.
asset = task["assets"][0]
with open("bicycle.jpg", "wb") as f:
f.write(requests.get(asset["url"], timeout=60).content)
print("saved bicycle.jpg", asset["mime_type"], asset["byte_size"], "bytes")
When we ran it on October 18, 2026, it printed this and saved a 1248 × 832 JPEG 16 seconds after it started:
task: task_LBCu6Lr8hyD4RH25JfiOixJHPHi3Cd0o queued
saved bicycle.jpg image/jpeg 267732 bytes
To try another model, change only the model value.
How much does the Grok Imagine API cost?
xAI charges per image, and the price depends on the model, the resolution and, for 2.0, the quality level. These are xAI's own rates from its pricing page, checked October 18, 2026:
| Model | 1K | 2K |
|---|---|---|
grok-imagine-image | $0.02 | $0.02 |
| Quality | $0.05 | $0.07 |
| 2.0, low quality | $0.04 | $0.06 |
| 2.0, medium quality | $0.06 | $0.08 |
2.0 uses low quality for new images unless you ask otherwise, so a 1K image costs $0.04 at xAI. On xAI's own API, a request that breaks its usage guidelines is still charged. Through OmniaKey you pay a flat price per image (see the model pages for current rates), and a job that fails is refunded.
What should you watch out for?
- No edits through OmniaKey. xAI's own API lets 2.0 edit images with up to five reference images, but through OmniaKey, Grok only generates new images. For edits, use a model that supports them, such as Nano Banana 2.1.
- The model picks the shape. With no aspect setting, Grok chose portrait for our poster and landscape for scenes, all around one megapixel (832 × 1248 to 1280 × 720).
- Quality goes away on November 2. After that, xAI serves requests for
grok-imagine-image-qualitywith 2.0 at low quality, so move now. - Retry once on a 400. One of our 14 jobs failed with a 400 and was refunded; the identical retry worked.
Conclusion
For most work, call grok-imagine-image-2.0: it won three of our four tests and costs $0.04 per 1K image at xAI. Use the original model when you need many cheap drafts, and move off Quality before November 2.
Common questions
Is the Grok Imagine API free?
No. xAI lists a per-image price for every Grok image model, starting at $0.02 for the original model.
Can Grok Imagine make videos through the API?
Yes. xAI prices its video models per second, for example $0.08 per second at 480p for Grok Imagine Video 1.5. On OmniaKey, see Grok Imagine Video 1.5.
Which image size do I get?
Around one megapixel by default. xAI's guide lists 1K as the default and 2K as an option, and the model picks the aspect ratio unless you set one.
What happens to grok-imagine-image-quality after November 2?
xAI keeps answering it, but with Grok Imagine 2.0 at low quality and the 2.0 price. The original grok-imagine-image is not affected.
Related articles
GPT-Image 2.5 vs GPT-Image 2
All three routes cost $0.068 per call; the 2.5 ids still add no working quality tier. Requests must use an explicit WIDTHxHEIGHT because the 1K/2K/4K tokens are rejected upstream.
Seedream 5.0 Pro vs GPT Image 2: Same-Prompt Test and Price
Six jobs, the same prompts, three models: what each made and what it cost.
nano banana 2.1 vs pro
Six jobs, the same prompts, three models: what each made and which to pick.
