Skip to content
Models

Grok Imagine 2.0 API: xAI's Image Model by Code

The Grok Imagine 2.0 API: xAI's characterful image model on one key, batches, aspect ratios, turning a still into a clip, code and per-image billing.

Updated 4 min read

Grok Imagine 2.0 is xAI's image model, and the Grok Imagine 2.0 API on Frameport turns one prompt into up to 4 images at $0.088 each, charged only for the images that succeed. Its pictures come out with a look of their own, more styled than documentary, which makes it handy for trying many takes on an idea before you settle on one.

It is the still-image half of the Grok Imagine family; the Grok Imagine API guide covers the video model. This page covers the image model: its options, a first request, exploring in volume, turning a still into the opening frame of a clip, prices and limits, and moderation.

Grok Imagine 2.0 at a glance

MakerxAI
Model idgrok-imagine-2-0
InputA prompt of up to 2,400 characters; no pictures
Aspect ratios1:1, 3:4, 4:3, 9:16 and 16:9
Images per requestUp to 4
Price$0.088 per image
EndpointPOST /v1/images/generations
Video siblingGrok Imagine, clips of 1 to 15 seconds

It fits concept boards, thumbnails, sticker and avatar ideas, cover sketches: work where personality counts for more than precision and most takes end up discarded. When the frame is the final deliverable, or a picture you own must be kept or edited, switch to a model that reads pictures, such as Nano Banana Pro, which accepts up to 6 of them and changes them on instruction.

A first Grok Imagine 2.0 API request

The request answers 202 at once with an id; read the generation until it has settled. Here, four takes of one poster idea in 3:4, with the signed link of each finished image printed at the end:

# 1. Submit four takes
curl https://frameport.ai/v1/images/generations \
  -H "Authorization: Bearer $FRAMEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-2-0",
    "prompt": "Retro travel poster of a cable car climbing over a pine valley at sunset, bold flat colors, paper grain",
    "n": 4,
    "aspect_ratio": "3:4"
  }'

# 2. Read it with the id it returned until "status" is "succeeded" or "failed"
curl https://frameport.ai/v1/images/generations/$GENERATION_ID \
  -H "Authorization: Bearer $FRAMEPORT_API_KEY"
202 Accepted
{
  "id": "gen_4kQ8vT2nLm9Xr7Wd1sYcPa",
  "object": "generation",
  "type": "image",
  "model": "grok-imagine-2-0",
  "status": "queued",
  "input": {
    "prompt": "Retro travel poster of a cable car climbing over a pine valley at sunset, bold flat colors, paper grain",
    "n": 4,
    "aspect_ratio": "3:4",
    "reference_images": 0
  },
  "reserved_usd": 0.352,
  "cost_usd": null,
  "outputs": [
    { "id": "file_8Hc2RkQw5ZpT1mVb7nXe3L", "status": "queued" },
    { "id": "file_3Vb8KqW2nTx7Lc5Rm1YdPs", "status": "queued" },
    { "id": "file_2Tn7XcQ9vLm4Ra8Ws1KbZd", "status": "queued" },
    { "id": "file_5Wq1ZtR8xNc3Hv6Lp9KmTa", "status": "queued" }
  ],
  "error": null,
  "created_at": "2026-11-28T10:00:00.000Z",
  "completed_at": null
}

Without aspect_ratio the image is square, and without n you get one. The images reference lists every field; a webhook can deliver the settled generation to your server instead.

Exploring an idea in volume

Grok Imagine 2.0 earns its place early in a project, when the question is which direction to take. Keep the idea fixed, vary the style, and compare the results side by side. This script sends three directions with four takes each:

One idea, three directions, four takes each
import os
import time
import requests

API = "https://frameport.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['FRAMEPORT_API_KEY']}"}
idea = "a cable car climbing over a pine valley at sunset"
styles = ["retro travel poster, bold flat colors", "moody oil painting, heavy brush strokes", "clay diorama, soft studio light"]

started = []
for style in styles:
    gen = requests.post(f"{API}/images/generations", headers=headers, json={
        "model": "grok-imagine-2-0", "prompt": f"{idea}, {style}", "n": 4, "aspect_ratio": "3:4",
    }).json()
    if gen.get("error"):
        print(style, "refused:", gen["error"]["message"])
        continue
    started.append(gen["id"])

for gen_id in started:
    gen = requests.get(f"{API}/generations/{gen_id}", headers=headers).json()
    while gen["status"] in ("queued", "running"):
        time.sleep(3)
        gen = requests.get(f"{API}/generations/{gen_id}", headers=headers).json()
    links = [output["url"] for output in gen["outputs"] if output["status"] == "succeeded"]
    print(gen["input"]["prompt"], "→", len(links), "images, charged", gen["cost_usd"])

Three requests of four images hold $1.056 in all, and any image that fails is refunded on its own. A few habits help:

  • State the idea in one line, then let a style phrase do the steering. "Clay diorama", "ink wash", "pixel art" or "risograph print" each change the result more than extra adjectives.
  • Change one thing per round, so you can tell what each word did.
  • Keep the ids of the takes you like. Image requests have no seed, so every run is a fresh take; a file_… id is how you get back to a picture, and how you pass it to the next step.

Grok Imagine image to video

Grok Imagine 2.0 makes stills; its sibling Grok Imagine makes clips and takes one picture as the first frame. Your image output's id is accepted as that picture, so a still can be animated without a download:

POST /v1/videos/generations
{
  "model": "grok-imagine",
  "prompt": "The cable car glides across the valley as the sun sinks, a gentle sway, clouds drifting past",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "3:4",
  "reference_images": ["file_8Hc2RkQw5ZpT1mVb7nXe3L"]
}

Send one picture only, keep aspect_ratio matched to the still, and let the prompt describe what moves: the frame already sets the subject and the style. The clip costs its seconds at the chosen resolution, $0.825 for five seconds at 720p, plus a fixed fee for the picture that the model page lists and a quote shows in its breakdown. The video model takes no last frame and no reference pictures; Grok Imagine vs Seedance 2.5 says when a longer take is worth a switch. The videos reference explains frames; for every model that can start from a picture, see image to video API.

Grok Imagine 2.0 price and limits

ImagesPrice
1$0.088
4$0.352
12$1.056
1,000$88.00

Shape and prompt length leave the price untouched. A request holds the cost of all its images, then charges each as it succeeds. On limits, every workspace shares 60 requests that start work per minute and 20 generations running at once across all its keys; past either, the API answers 429 with a Retry-After header (rate limits). Pricing explains the balance.

Is Grok Imagine image moderated?

Yes. On Frameport, Grok Imagine 2.0 keeps xAI's content policy. A prompt it declines at submit answers 400 content_policy with nothing held; an image refused after it started fails, and its share of the hold comes back. Your workspace's content filter is a separate layer, on by default, that reads the prompt before the request leaves; turning it off does not change what the maker's model accepts. The image models that render without a filter once it is off are our own engines: see which AI image models are uncensored.

Prices for images and clips sit together in Grok Imagine API pricing.

FAQ

How many images can Grok Imagine 2.0 make per request?

Up to 4, set with n. To make more, send more requests: a workspace may start 60 a minute and keep 20 running at the same time.

Can Grok Imagine 2.0 edit a picture I upload?

No. Pictures are not an input on this model, so it cannot keep or change one. For edits by instruction, use Nano Banana Pro, with up to 6 pictures, or Frameport Image 1, with up to 10.

What is the difference between Grok Imagine and Grok Imagine 2.0?

Grok Imagine, grok-imagine, is xAI's video model, billed per second, with clips of 1 to 15 seconds. Grok Imagine 2.0, grok-imagine-2-0, is the image model, billed per image at $0.088. One key calls both.

Is there a free Grok Imagine 2.0 API?

Signing up, creating a key and requesting quotes cost nothing, and images that fail are refunded. Each delivered image comes out of a prepaid balance, topped up from $10. Try Grok Imagine 2.0 online before you write code.

Do I need an xAI account?

No. A Frameport key, starting with fp_live_, calls Grok Imagine 2.0 and every other model of the catalog from one balance.

Pricing5 min read

Grok Imagine API Pricing: Video and Image

Grok Imagine API pricing: video per second at each resolution, the start image fee, Grok Imagine 2.0 images per picture, and paying only for what succeeds.

Start building.

Your API key is free. Top up from $10 when you are ready.