From prompt topixel-perfect reality.
Grok Imagine
∣
Available in API
From prompt to
pixel-perfect reality.State-of-the-art image and video generation, editing, and restyling — one API for every visual modality.
Up to 2K resolution10 images per requestVideo up to 15sFrom $0.02 / image






Text & image to video
Product demos, visual effects, and creative content. Turn a photo into a cinematic video with smooth pans, zooms, and reveals.
- Text-to-video and image-to-video in one API
- Up to 15-second clips with motion control
- High-fidelity output across photoreal and stylized scenes
- Combine product and client references into one shot
- Preserves garment shape, texture, and color
- Returns ready-to-use video for product detail pages
- Restage your product in any environment or angle
- Add people, change perspective, or shift the scene
- Up to 10 images per request at 2K resolution
- Target specific attributes without disturbing the rest
- Iterate on colors, materials, and details in seconds
- Switch between image and video edits on demand
- Apply cinematic, anime, retro, watercolor, and more
- Side-by-side compare with the source video
- One source — endless creative directions
- Go from sketch or render to polished output
- Explore variations across mood, lighting, and style
- Bridge concept and production with a single prompt
PropertyDiningPerfumeClothing
Virtual try-on
Upload a photo of a person and a clothing item — the API generates a video of them wearing it. Perfect for e-commerce and fashion.

Product

Client
Try-on
Product placement
Turn a single product photo into scroll-stopping content for every channel. Generate up to 10 images per request at 2K resolution.





OriginalAd MockupChange AngleAdd a FamilyChange Perspective
Precision edits
Edit colors and objects with accuracy for complete control over your product showcase.
InputRedFurSilverCatStar
Creative restyle
Seamlessly switch between styles to reinvent the experience in seconds. Drag the slider to compare the original with the restyle.
Original
Block
BlockCyberpunkAnimeRetroOrigamiWatercolorMosaic
Mockups into reality
Turn your rough ideas into multiple realities at the click of a button.

Sketch3DMoon prototypeEarth prototype

Product

Client
Try-on
PropertyDiningPerfumeClothing
Ready to build?
Start generating images and videos with just a few lines of code.
Create API KeyTry on Playground
Copy
import xai_sdkclient = xai_sdk.Client()response = client.video.generate( prompt="A glowing crystal-powered rocket launching from Mars", model="grok-imagine-video", duration=10, aspect_ratio="16:9", resolution="720p",)print(response.video.url)# 1. Start generationcurl -X POST https://api.x.ai/v1/videos/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $XAI_API_KEY" \ -d '{ "model": "grok-imagine-video", "prompt": "A glowing crystal-powered rocket launching from Mars" }'# 2. Poll with the returned request_idcurl -X GET "https://api.x.ai/v1/videos/REQUEST_ID" \ -H "Authorization: Bearer $XAI_API_KEY"import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.XAI_API_KEY, baseURL: "https://api.x.ai/v1",});// 1. Start generationconst { request_id } = await client.post("/videos/generations", { body: { model: "grok-imagine-video", prompt: "A glowing crystal-powered rocket launching from Mars", },});// 2. Poll until donelet result;do { await new Promise((r) => setTimeout(r, 5000)); result = await client.get(`/videos/${request_id}`);} while (result.status !== "done");console.log(result.video.url);import timefrom openai import OpenAIclient = OpenAI( base_url="https://api.x.ai/v1", api_key="YOUR_API_KEY",)# 1. Start generationresponse = client.post( "/videos/generations", body={ "model": "grok-imagine-video", "prompt": "A glowing crystal-powered rocket launching from Mars", },)request_id = response["request_id"]# 2. Poll until donewhile True: result = client.get(f"/videos/{request_id}") if result["status"] == "done": print(result["video"]["url"]) break time.sleep(5)PythoncURLJavascript (OpenAI)Python (OpenAI)
Powerful without compromise
Our image and video models top the leaderboards on quality, speed, and price.
| Model | Rank | Price | Latency | | ------------ | ---- | ----- | ------- | | Grok Imagine | 1 | | | | Veo 3.1 Fast | 4 | | | | Veo 3 | 5 | | | | Sora 2 Pro | 9 | | | | Sora 2 | 12 | | |
Source: Artificial Analysis Text-to-Video Rankings, 2026-01-28
“Grok Imagine API delivers outstanding video quality with native audio generation, combining photorealistic realism, strong creative style, and an impressive level of control.”
fal
Common questions
About image and video generation, editing, and pricing. For a deeper dive, visit the docs.
What image generation capabilities does the Imagine API support?
What video generation features are available?
How does pricing work for image and video generation?
What aspect ratios and resolutions are supported?
Can I edit existing images and videos with text prompts?
How do I get started with the API?
What are the rate limits and input constraints?
Is content moderation applied to generated outputs?
What is AI product placement for ads?
Can I generate both images and videos for ads?
Can I generate ad variations at scale?
Can I iterate and refine ad creatives?
Does this work with Meta, Google, TikTok, and other ad platforms?
