Start creating

Leap API

Grok Imagine 2.0 APIxAI's model, through Leap

xAI's second Grok Imagine, with a 2K option and a cheaper draft quality. One Leap key and one balance run it and every other model, priced per call in dollars.

First $5 top-up, no card fee.

  • One key for every model
  • Every call quoted first
  • A failed call costs nothing
curl https://api.tryleap.ai/v1/generations \  -H "x-api-key: $LEAP_API_KEY" \  -H "content-type: application/json" \  -H "prefer: wait=60" \  -d '{    "model": "xai/grok-imagine-image-2.0",    "input": {      "prompt": "A silk scarf in the wind on a ferry deck",      "aspect_ratio": "1:1",      "settings": {        "resolution": "1k",        "quality": "standard"      }    }  }' # Video often outlasts the wait and answers "queued" or "running".# Put its "id" in GENERATION_ID and read it again until it is done:# curl https://api.tryleap.ai/v1/generations/$GENERATION_ID -H "x-api-key: $LEAP_API_KEY"

Set LEAP_API_KEY and send it. With prefer: wait=60 the answer holds the result when the call finishes within a minute; a longer one is read again by its ID.

Model ID
xai/grok-imagine-image-2.0
Price per call
$0.054 to $0.11
This call
A 1K image costs $0.081.
First top-up
A first top-up of $5, with no fee, covers 61 calls like it.

What it makes

Made with Grok Imagine 2.0

Real Grok Imagine 2.0 runs on Leap. Each one passed Leap's media quality check before it was shown.

  • The first frame of Dawn run, Iten

    “Sports documentary photograph on a 200mm telephoto lens from low on the road, dawn. A red laterite dirt road between tea bushes and maize fields at 2,400 metres in Iten, Kenya, mist lying in the valley behind. A 16-year-old Kalenjin girl, very slim and long-legged, close-cropped hair, a faded maroon tracksuit top tied around her waist over a white vest, worn cheap trainers, runs straight at the lens leading a pack of six older male runners in mismatched training gear, her face set and calm, mouth slightly open, breath visible in the cold air. Low sun behind them backlights the red dust kicked up by their feet. Telephoto compression stacks the runners close together, shallow focus on her. Palette: red earth, mist blue, maroon. Real skin, sweat, dust on legs, slight motion blur on the feet. No race numbers. No readable text, no logos.”

  • The first frame of Northbound, shot 1

    “Extreme wide shot, 40mm anamorphic, blue hour. A single white Mongolian ger alone on a vast frozen steppe in Khentii province, smoke rising from its stovepipe, a few horses with frost on their manes standing nearby, low snowy hills. High in the darkening sky a thin streak of electric violet light crosses silently, trailing sparks. No readable text, no logos. Shot on 35mm anamorphic, ice fog, fine grain. Palette: ice white, felt brown, deel red and one electric violet. Cold overcast or blue-hour light.”

  • Auntie's pepper sauce, the generated first frame

    “Vertical selfie video frame from a front phone camera, slight wide-angle distortion, real phone-camera look. A Nigerian-British woman of 34, plus-size and round-faced, dark skin with a few dark spots on her cheeks, short natural hair in a tapered cut, gold hoop earrings, a faded oversized grey sweatshirt, stands in a small, slightly messy kitchen in a South London flat in the morning. She holds up to the camera a small glass jar of homemade red pepper sauce with a plain white handwritten label that says OJO, eyebrows raised, mouth open mid-sentence, playful and sceptical. Behind her: a teal kettle, a dish rack full of mugs, tea towels drying on a radiator, a window with flat grey London light and condensation. Natural side light from the window, slightly underexposed, no makeup look. Palette: sweatshirt grey, pepper red, kettle teal. Candid, unpolished creator content.”

  • Rooftop legwork, the generated first frame

    “Vertical documentary photograph, 28mm lens, dusk. A rooftop of rusted corrugated iron with a concrete water-tank stand on Lagos Island, Nigeria, overlooking dense rooftops, satellite dishes and the lagoon in violet haze; a yellow minibus in the street far below. A Nigerian man in his mid-forties, wiry and bald, a gap-toothed grin, sweat on his scalp, wearing a loose matching Ankara print shirt and trousers in cobalt blue and saffron yellow, white socks and black slides, mid-move in an Afrobeats legwork dance, one knee up, arms loose, shoulders bouncing. Two schoolgirls in green-and-white check uniforms sit on the water tank behind him, laughing and filming him on a phone. Light: last warm sun from the left, violet sky. Palette: cobalt, saffron, rust, dusk violet. Real sweat, dust and texture. No readable text.”

  • The first frame of Four on a scooter

    “Vertical night street photograph from a moving scooter alongside, 50mm lens, 1/30 s, rain streaks and light trails. A Hanoi street in a monsoon downpour, the asphalt a mirror of neon reflections; the shopfronts behind are shuttered with plain metal roller doors and have no signs at all. A Vietnamese family of four rides one small scooter under one huge cobalt-blue rain poncho: the father, 38, wiry, green pith helmet, steers one-handed while balancing a two-metre tower of stacked red plastic stools on his other shoulder; a 9-year-old boy standing between his knees hugs a live white goose; behind, the mother, 35, with round glasses, holds a sleeping toddler. Deadpan faces, nobody smiling at the camera. Grain, motion blur in the background, sharp faces. No text, no logos, no labels, nothing printed anywhere.”

  • The first frame of Second line

    “Vertical parade photograph, 28mm lens from low in front of a marching drumline, afternoon sun. A street in Tremé, New Orleans, during a Sunday second line: shotgun houses, dancers with feathered parasols, a crowd. A 15-year-old Black snare drummer, slim, braces on his teeth, sunglasses pushed up on his head, a purple-and-gold high school band jacket unbuttoned over a white T-shirt, plays a rapid roll with his eyes closed and a huge grin, sticks blurred; behind him the drumline with bass drums and tenors recedes down the street. Palette: band purple and gold, brass shine, parasol pastels. Sweat, motion blur on the sticks, sun flare. No readable text, no logos.”

The answer

What comes back

A generation. Check status first: succeeded has the file in output, a signed link that works for 24 hours, so download what you keep. failed has error and failure_cause, and costs nothing. usage.cost_usd is what the call was charged.

200 OK, trimmed
{  "id": "gen_...",  "object": "generation",  "model": "xai/grok-imagine-image-2.0",  "status": "succeeded",  "output": [    {      "type": "image",      "url": "https://api.tryleap.ai/files/..."    }  ],  "error": null,  "usage": {    "cost_usd": "0.081"  }}

Inputs

What Grok Imagine 2.0 takes

Only prompt is needed; everything else has a default. The same schema is public, with no key, at api.tryleap.ai/v1/public/models/xai/grok-imagine-image-2.0.

Promptprompt
Text, up to 8,000 characters, required
Aspect ratioaspect_ratio
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3. Default: 1:1
Imagesn
1 to 4. Default: 1
Resolutionsettings.resolution
1K, 2K. Default: 1K
Qualitysettings.quality
Standard, Draft. Default: Standard

Pricing

Price per call

A 1K image costs $0.081. A first top-up of $5, with no fee, covers 61 default calls. Prices are the provider's list price plus our margin (35% on most models, less on the dearest video), read from the catalog, and a quote gives the exact price of any input for free.

Grok Imagine 2.0 and its family

A free quote
curl https://api.tryleap.ai/v1/quotes \  -H "x-api-key: $LEAP_API_KEY" \  -H "content-type: application/json" \  -d '{    "model": "xai/grok-imagine-image-2.0",    "input": {      "prompt": "A silk scarf in the wind on a ferry deck",      "aspect_ratio": "1:1",      "settings": {        "resolution": "1k",        "quality": "standard"      }    }  }'

How it works

How the Grok Imagine 2.0 API works

Every model takes the same request, a model ID and its input, and results, prices, failures and limits work the same way for all of them.

  • Wait for it, or hear when it ends

    prefer: wait=60 holds the request until the result is ready, for up to a minute. A longer run is read again by its ID, or a signed webhook tells your server when it ends.

    prefer: wait=60 / "webhook": "https://..."

    In the docs
  • Failed calls cost nothing

    The price is held when a call starts and charged only if it succeeds. A failed or refused call comes back with its failure_cause, and the hold is released.

    "status": "failed" / "failure_cause": "provider_refused"

    In the docs
  • The price before the call

    POST /v1/quotes takes the same body as a generation and returns its exact price, with the input checked, for free. Every result carries what it was charged.

    POST https://api.tryleap.ai/v1/quotes / "cost_usd"

    In the docs
  • Rate limits

    600 requests a minute per API key and 300 per IP address. A 429 carries Retry-After with the seconds to wait.

    RateLimit-Remaining / Retry-After

    In the docs
  • Safe retries

    Send an idempotency key and a retry after a dropped connection returns the same generation instead of starting a second one.

    idempotency-key: <uuid>

    In the docs
  • Batches

    POST /v1/batches starts up to 50 calls in one request, priced and held together, so either all start or none do.

    POST https://api.tryleap.ai/v1/batches

    In the docs

MCP

Or let your agent call it.

Leap's MCP server lets Claude Code, Claude, VS Code and other MCP clients run Grok Imagine 2.0, read its inputs and fetch the result, on your balance. Signing in happens in the browser, so there is no key to paste.

Add Leap to Claude Code
claude mcp add --transport http leap https://app.tryleap.ai/api/mcp

Claude Code signs you in through the browser the first time it calls Leap.

Teach your coding agent the Leap API
curl -fsSL https://www.tryleap.ai/install.sh | sh

Installs the Leap skill for every coding agent it finds: which endpoint to call, how to read a model's inputs, when to wait and when to poll.

Questions

Grok Imagine 2.0 API questions

How much does the Grok Imagine 2.0 API cost?
A 1K image costs $0.081. By resolution and quality, a call costs $0.054 to $0.11. That is the provider's list price plus our margin, the same as in the studio. POST /v1/quotes prices any input for free before you run it.
Can I try the Grok Imagine 2.0 API for free?
No. API keys run on paid credit, so a key's first call needs a top-up, and quotes are free. A 1K image costs $0.081. A first top-up of $5, with no fee, covers 61 default calls.
Do I pay for calls that fail?
No. The price is held when a call starts and charged only if it succeeds. A call that fails, or that the model's safety filter refuses, comes back with status "failed" and a failure_cause, and the hold is released.
Is this xAI's own API?
No. Leap is a separate service: it sends your call to xAI's model and gives you what it makes, so you need no xAI account. One Leap key runs Grok Imagine 2.0 and every other model in the catalog, from one balance.
What are the rate limits?
600 requests a minute per API key and 300 a minute per IP address. A batch starts up to 50 calls in one request. A 429 says how long to wait in its Retry-After header.
Can an AI agent call it?
Yes. Leap's MCP server lets Claude Code, Claude, VS Code and other MCP clients find Grok Imagine 2.0, read its inputs, run it and fetch the result on your balance. The client signs you in through the browser, so there is no key to paste.

Build with Grok Imagine 2.0.

Keys run on paid credit, and the first top-up has no fee. The same key runs every model on Leap.

Get an API key