Products
Download
Developers
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.
Image Video
Generate Generate in Playground
Up to 2K resolution 10 images per request Video up to 15s From $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
Property Dining Perfume Clothing
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.
- Combine product and client references into one shot
- Preserves garment shape, texture, and color
- Returns ready-to-use video for product detail pages

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.
- 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





Original Ad Mockup Change Angle Add a Family Change Perspective
Precision edits
Edit colors and objects with accuracy for complete control over your product showcase.
- Target specific attributes without disturbing the rest
- Iterate on colors, materials, and details in seconds
- Switch between image and video edits on demand
Input Red Fur Silver Cat Star
Creative restyle
Seamlessly switch between styles to reinvent the experience in seconds. Drag the slider to compare the original with the restyle.
- Apply cinematic, anime, retro, watercolor, and more
- Side-by-side compare with the source video
- One source — endless creative directions
Original
Block
Block Cyberpunk Anime Retro Origami Watercolor Mosaic
Mockups into reality
Turn your rough ideas into multiple realities at the click of a button.
- Go from sketch or render to polished output
- Explore variations across mood, lighting, and style
- Bridge concept and production with a single prompt

Sketch 3D Moon prototype Earth prototype

Product

Client
Try-on
Property Dining Perfume Clothing
Ready to build?
Start generating images and videos with just a few lines of code.
Create API KeyTry on Playground
Copy
import xai_sdk
client = 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 generation
curl -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_id
curl -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 generation
const { request_id } = await client.post("/videos/generations", {
body: {
model: "grok-imagine-video",
prompt: "A glowing crystal-powered rocket launching from Mars",
},
});
// 2. Poll until done
let 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 time
from openai import OpenAI
client = OpenAI(
base_url="https://api.x.ai/v1",
api_key="YOUR_API_KEY",
)
# 1. Start generation
response = 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 done
while True:
result = client.get(f"/videos/{request_id}")
if result["status"] == "done":
print(result["video"]["url"])
break
time.sleep(5)
Python cURL Javascript (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 thedocs.
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?
© 2026 X.AI LLC
Products
ChatBuildImagineVoiceGrokipedia
Download
Solutions
BusinessGovernmentCustomer SupportLegalSecurityUse Cases
Developers
API OverviewPricingModelsConsoleDocsStatus
Enterprise
Company
AboutColossusCareersNewsContact
Trust
SafetySecurityPrivacy PortalSubprocessorsHelp Center
TermsEnterprise TermsPrivacyCookiesAUPBrand
Social
Copy black SVG
Copy white SVG
Last updated Oct 08, 2026