Skip to main content
Back to API Platform

Grok Image API

xAI Grok Imagine. Fast tier for quick iteration, Quality tier for higher fidelity at 1k or 2k. Integrate this model via REST with endpoint docs, parameters, and code examples.

Image Generation
Editing
Credit Cost
1 credit
Type
Image

API Endpoint

POST
/api/v1/models/xai-image/run

Test This Model

Run a real request through the API pipeline and inspect the exact input and output your integration will handle. Uses your credits like any API call; failed runs are refunded automatically.

Parameters

Input parameters accepted by this model

ParameterTypeDefault
prompt
required
string
-
aspect_ratio
enum
1:1
quality
enum
fast
resolution
enum
2k

Supported Aspect Ratios

1:1
16:9
9:16
4:3
3:4
3:2
2:3

See also

Related endpoints on this model — you may need a different apiId for a different operation (e.g. image edit vs generation).

Example Outputs

Real outputs generated by this model

A misty mountain valley at dawn, layered ridgelines, a winding river through pine forest, soft light
View Details

A misty mountain valley at dawn, layered ridgelines, a winding river through pine forest, soft light

1 credit
5.5s
A cozy independent bookshop interior with warm lamplight and towering shelves, inviting reading nook
View Details

A cozy independent bookshop interior with warm lamplight and towering shelves, inviting reading nook

1 credit
6.7s
A delicate hummingbird hovering beside a trumpet flower, iridescent feathers, crisp macro photography
View Details

A delicate hummingbird hovering beside a trumpet flower, iridescent feathers, crisp macro photography

1 credit
6.0s
A playful golden retriever leaping into a lake to fetch a stick, water splashing, sunny summer day
View Details

A playful golden retriever leaping into a lake to fetch a stick, water splashing, sunny summer day

1 credit
5.4s
A dramatic desert landscape with towering red rock arches under a star-filled night sky, long exposure
View Details

A dramatic desert landscape with towering red rock arches under a star-filled night sky, long exposure

1 credit
6.2s
A charming Parisian cafe corner with a striped awning and flowers, cobblestone street, soft morning light
View Details

A charming Parisian cafe corner with a striped awning and flowers, cobblestone street, soft morning light

1 credit
6.7s
A vintage typewriter on a desk beside a steaming coffee and an open notebook, warm cinematic lighting
View Details

A vintage typewriter on a desk beside a steaming coffee and an open notebook, warm cinematic lighting

1 credit
10.7s
A vibrant coral reef alive with tropical fish and a sea turtle, crystal-clear water, sun rays underwater
View Details

A vibrant coral reef alive with tropical fish and a sea turtle, crystal-clear water, sun rays underwater

1 credit
6.7s
A surreal floating island with waterfalls spilling into the clouds, fantasy landscape, golden light
View Details

A surreal floating island with waterfalls spilling into the clouds, fantasy landscape, golden light

1 credit
6.0s
A field of vibrant tulips stretching to a windmill on the horizon, bright blue sky, Dutch countryside
View Details

A field of vibrant tulips stretching to a windmill on the horizon, bright blue sky, Dutch countryside

1 credit
6.7s
A snow-dusted log cabin glowing warmly in a pine forest at twilight, smoke from the chimney, peaceful
View Details

A snow-dusted log cabin glowing warmly in a pine forest at twilight, smoke from the chimney, peaceful

1 credit
5.4s
A detailed steaming bowl of ramen with fresh herbs and a soft egg, overhead shot, appetizing food photography
View Details

A detailed steaming bowl of ramen with fresh herbs and a soft egg, overhead shot, appetizing food photography

1 credit
6.0s
A retro 1960s diner at dusk, neon signs glowing, classic cars parked outside, nostalgic warm tones
View Details

A retro 1960s diner at dusk, neon signs glowing, classic cars parked outside, nostalgic warm tones

1 credit
6.2s
A curious orange tabby kitten peeking out of a wicker basket, soft window light, adorable detail
View Details

A curious orange tabby kitten peeking out of a wicker basket, soft window light, adorable detail

1 credit
6.1s
A powerful waterfall cascading through a lush green canyon, mist catching rainbow light, wide landscape
View Details

A powerful waterfall cascading through a lush green canyon, mist catching rainbow light, wide landscape

1 credit
6.2s
A rustic loaf of crusty bread and a glass of red wine on a wooden table, candlelit, moody food photography
View Details

A rustic loaf of crusty bread and a glass of red wine on a wooden table, candlelit, moody food photography

1 credit
6.1s
A whimsical hot air balloon shaped like a whale floating over rolling green hills, dreamy pastel sky
View Details

A whimsical hot air balloon shaped like a whale floating over rolling green hills, dreamy pastel sky

1 credit
6.6s
An elegant modern living room with floor-to-ceiling windows overlooking a misty forest, warm natural light
View Details

An elegant modern living room with floor-to-ceiling windows overlooking a misty forest, warm natural light

1 credit
6.7s
A vibrant street food market at night, glowing lanterns and sizzling woks, rich atmospheric color
View Details

A vibrant street food market at night, glowing lanterns and sizzling woks, rich atmospheric color

1 credit
8.0s
A lone red sailboat on a calm turquoise sea at golden hour, minimalist composition, gentle reflections
View Details

A lone red sailboat on a calm turquoise sea at golden hour, minimalist composition, gentle reflections

1 credit
6.7s
A close-up of a bee collecting pollen from a sunflower, wings mid-flutter, macro detail, soft bokeh
View Details

A close-up of a bee collecting pollen from a sunflower, wings mid-flutter, macro detail, soft bokeh

1 credit
6.1s
A serene Japanese tea garden in spring, cherry blossoms drifting over a koi pond, soft morning light, highly detailed
View Details

A serene Japanese tea garden in spring, cherry blossoms drifting over a koi pond, soft morning light, highly detailed

1 credit
6.8s
A cozy attic art studio bathed in afternoon sun, canvases and brushes everywhere, warm dust motes in the light
View Details

A cozy attic art studio bathed in afternoon sun, canvases and brushes everywhere, warm dust motes in the light

1 credit
6.7s
A majestic snow leopard resting on a rocky Himalayan ledge, piercing eyes, crisp wildlife photography
View Details

A majestic snow leopard resting on a rocky Himalayan ledge, piercing eyes, crisp wildlife photography

1 credit
6.1s
a thrilling action sequence of a woman trying to find her favorite candy. The candy wrapper is purple with a pixelated dragon and reads "Pixel Dojo". The woman says "Gotta have that pixel dojo candy. with over 60 ai tools, it's basically zero calories."
View Details

a thrilling action sequence of a woman trying to find her favorite candy. The candy wrapper is purple with a pixelated dragon and reads "Pixel Dojo". The woman says "Gotta have that pixel dojo candy. with over 60 ai tools, it's basically zero calories."

1 credit
4.9s
a thrilling action sequence of a woman trying to find her favorite candy. The candy wrapper is purple with a pixelated dragon and reads "Pixel Dojo". The woman says "Gotta have that pixel dojo candy. with over 60 ai tools, it's basically zero calories."
View Details

a thrilling action sequence of a woman trying to find her favorite candy. The candy wrapper is purple with a pixelated dragon and reads "Pixel Dojo". The woman says "Gotta have that pixel dojo candy. with over 60 ai tools, it's basically zero calories."

1 credit
6.3s
a thrilling action sequence of a woman trying to find her favorite candy. The candy wrapper is purple with a pixelated dragon and reads "Pixel Dojo". The woman says "Gotta have that pixel dojo candy. with over 60 ai tools, it's basically zero calories."
View Details

a thrilling action sequence of a woman trying to find her favorite candy. The candy wrapper is purple with a pixelated dragon and reads "Pixel Dojo". The woman says "Gotta have that pixel dojo candy. with over 60 ai tools, it's basically zero calories."

1 credit
1050.2s
A dramatic low-angle photograph of a master martial artist mid-strike inside a sleek modern dojo, shattering a wooden board that explodes into thousands of glowing purple and pink pixel fragments that scatter through the air like embers. The dojo has polished concrete floors, floor-to-ceiling windows revealing a rain-soaked Tokyo cityscape at night, and minimal Japanese architectural details — clean wooden beams, a torii gate silhouette visible through the glass. The pixel fragments cast colored light across the fighter's face and the wet floor reflections. Shot on Sony A7R V, 35mm f/1.4, shallow depth of field, dramatic side lighting from a single overhead spotlight cutting through atmospheric haze, rain streaks visible on the windows. Hyperrealistic, editorial photography, 8K resolution
View Details

A dramatic low-angle photograph of a master martial artist mid-strike inside a sleek modern dojo, shattering a wooden board that explodes into thousands of glowing purple and pink pixel fragments that scatter through the air like embers. The dojo has polished concrete floors, floor-to-ceiling windows revealing a rain-soaked Tokyo cityscape at night, and minimal Japanese architectural details — clean wooden beams, a torii gate silhouette visible through the glass. The pixel fragments cast colored light across the fighter's face and the wet floor reflections. Shot on Sony A7R V, 35mm f/1.4, shallow depth of field, dramatic side lighting from a single overhead spotlight cutting through atmospheric haze, rain streaks visible on the windows. Hyperrealistic, editorial photography, 8K resolution

1 credit
6.5s

Code Examples

Generate image(s) — copy and paste to get started

bash
curl -X POST "https://pixeldojo.ai/api/v1/models/xai-image/run" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A retro-futurist skyline at dawn",
    "num_outputs": 2
  }'

Response Format

Submit Response (202 Accepted)

json
{
  "jobId": "job_abc123...",
  "status": "pending",
  "statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123...",
  "creditCost": 1,
  "creditsRemaining": 95,
  "expiresAt": "2026-07-15T00:29:48Z"
}

Completed Response

json
{
  "jobId": "job_abc123...",
  "status": "completed",
  "output": {
    "images": [
      "https://temp.pixeldojo.ai/pixeldojotemp/1705930123-456789.png"
    ]
  },
  "creditCost": 1,
  "expiresAt": "2026-07-15T00:29:48Z"
}