GPT-6 Sol & Claude Opus 5.5 are liveGPT-6 Sol at half the price of 5.6 Sol

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.

Kiki, OmniaKey COO5 min read
On this page

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-image for 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.
The same coffee-shop poster prompt in three Grok models: all three spell GRAND OPENING and Saturday 9 AM correctly; the Quality model adds an extra line of text at the bottom
Same prompt, three models. All three spelled the text right; Quality added a line we did not ask for.

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 IDWhat it isxAI price, 1K
grok-imagine-imageThe original, cheapest$0.02
grok-imagine-image-qualityRetires November 2$0.05
grok-imagine-image-2.0The 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:

Close-up of the bottom of the Quality poster: an invented line reading NEIGHBORHOOD COFFEE and a made-up street address, 1427 MAPLE ST
Quality's extra line: a shop name and a street address that were not in the prompt.

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.

Three fishermen mending blue nets on docks at sunrise: the original Grok Imagine in warm golden light, Quality with a smaller figure, and Grok Imagine 2.0 as a close-up with a blurred background
Grok Imagine 2.0 came closest to a real photo with 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.

Three black earbud cases with the lid open on white: small in the frame in the original model, angled in Quality, and large and detailed in Grok Imagine 2.0
All three followed the brief; 2.0 filled the frame with the most detail.

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.

Three tables, each with three red apples on the left and two pears on the right: the original model shows the pears standing upright, Quality shows a clean top-down view, and 2.0 shows yellow-green pears
All three counted right. Quality gave the cleanest top-down view.

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.

TestWinnerWhy
Poster text2.0Right text, best layout
Realistic photo2.0Real depth of field
Product shot2.0Most detail
CountingTieAll 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:

python
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:

text
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:

Model1K2K
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-quality with 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.

Grok ImagineGrok Imagine 2.0xAIimage generation APIPython

Related articles

Recent posts