Skip to content
xAIimage

Grok Imagine 2.0 API

xAI's image model: quick, characterful renders with a distinct look, for exploring ideas in volume.

Pricing

per image
ItemPrice
One image, any aspect ratio$0.088
  • Charged once, and only when the image succeeds. A failed job costs $0.00: its hold is released in full.
  • The exact price is known before the run: the Studio shows it before you click Generate, and the API returns it as reserved_usd when it accepts the job.
  • A request makes 1 to 4 images, each charged at this price.

Estimate

Per request
1 × $0.088$0.088

Charged once per image, only on success.

Request

POST https://frameport.ai/v1/images/generations

# 1. Submit: the price is held on your balance (reserved_usd)
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": "A tiny bakery on a hillside street, isometric illustration, warm window light, early evening",
    "n": 1,
    "aspect_ratio": "16:9"
  }'

# 2. Poll with the id it returns, until "succeeded" or "failed"
curl https://frameport.ai/v1/images/generations/$GENERATION_ID \
  -H "Authorization: Bearer $FRAMEPORT_API_KEY"

# 3. Download outputs[0].url once it has succeeded (a signed link, no key needed)
curl -L "$OUTPUT_URL" -o out.png

Set FRAMEPORT_API_KEY to your key. Full reference in the image docs.

Options

Tasks
  • Text to image
Aspect ratios
  • 1:1
  • 3:4
  • 4:3
  • 9:16
  • 16:9
Images per request
1 to 4
Reference pictures
None
Prompt
Up to 2,400 characters
Output
Image files, signed links valid about an hour
Billing unit
Per image
Model id
grok-imagine-2-0

Grok Imagine 2.0 API parameters

FieldValuesNotes
model"grok-imagine-2-0"Required.
prompttext, up to 2,400 charactersRequired: the subject, the setting, the light and the style.
n1 to 41 when left out. Each image is charged.
aspect_ratio1:1, 3:4, 4:3, 9:16, 16:91:1 when left out. The same price at every ratio.

Grok Imagine 2.0 request bodies, one per mode

Send each body to POST https://frameport.ai/v1/images/generations with Authorization: Bearer $FRAMEPORT_API_KEY, then poll GET /v1/images/generations/{id}. Pictures are https URLs or base64 data URIs. Each card shows the price that body holds.

Text to image · $0.088
{
  "model": "grok-imagine-2-0",
  "prompt": "A tiny bakery on a hillside street, isometric illustration, warm window light, early evening",
  "n": 1,
  "aspect_ratio": "16:9"
}

What Grok Imagine 2.0 is good at

  • Volume: explore many prompt directions quickly.
  • Concepts and thumbnails before committing to a flagship render.
  • Stylized, characterful images rather than clinical photorealism.

When another model fits better

How to prompt Grok Imagine 2.0

  1. 01Short, punchy prompts work well: describe the idea, not a full brief.
  2. 02Name the style if you want one; it moves easily between looks.
  3. 03Run several takes and keep the one that reads best.

Sample prompt

“A tiny bakery on a hillside street, isometric illustration, warm window light, early evening”

About the Grok Imagine 2.0 API

How much does the Grok Imagine 2.0 API cost?

Grok Imagine 2.0 costs $0.088 per image. A request makes 1 to 4 images and each one is charged, once, only when it succeeds.

How do I call Grok Imagine 2.0 from code?

Send POST /v1/images/generations with "model": "grok-imagine-2-0" and a prompt, your API key as a Bearer token. The answer is a generation with an id: poll GET /v1/images/generations/{id} until its status is succeeded, then download each outputs[].url.

What happens if a Grok Imagine 2.0 generation fails?

Nothing is charged. The price is held on your balance when the job starts and released in full if it fails: cost_usd stays at 0.

Can Grok Imagine 2.0 edit a picture?

No, it renders from the prompt alone. For edits from reference pictures, use Frameport Image 1 (fp-image-1).

Which aspect ratios does Grok Imagine 2.0 support?

1:1, 3:4, 4:3, 9:16 and 16:9, at the same price.

Do I need a subscription?

No. You top up a prepaid balance in dollars, from $10, and it never expires. Every model runs on the same balance and the same API key.

Compare with similar models

For agents: this page in Markdown at /models/grok-imagine-2-0.md, every model in /models.json, and the site in /llms.txt.

Call Grok Imagine 2.0 with one key.

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