▸ Agent Skills
9 min read

Contact Sales

Try for free

Products

GrokBusinessGovernment

Download

iOSAndroidGrok on X

Developers

API ConsoleDocumentationCLI

Try for free

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.

Explore playgroundDocs

Image Video

Generate Generate in Playground

Up to 2K resolution 10 images per request Video up to 15s From $0.02 / image

Image 1: Generated with Grok ImagineImage 2: Generated with Grok Imagine

Image 3: Generated with Grok Imagine

Image 4: Generated with Grok Imagine

Image 5: Generated with Grok ImagineImage 6: Generated with Grok Imagine

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

Video 28

Video 29

Video 30

Video 31

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

Image 7: Product

Product

Image 8: Client

Client

Video 32

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

Image 9: Original

Image 10: Ad Mockup

Image 11: Change Angle

Image 12: Add a Family

Image 13: Change Perspective

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

Video 33

Video 34

Video 35

Video 36

Video 37

Video 38

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

Video 39

Original

Video 40

Video 41

Video 42

Video 43

Video 44

Video 45

Video 46

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

Image 14: Sketch

Video 47

Video 48

Video 49

Sketch 3D Moon prototype Earth prototype

Video 50

Video 51

Video 52

Video 53

Image 15: Product

Product

Image 16: Client

Client

Video 54

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.

ModelRankPriceLatency
Grok Imagine1
Veo 3.1 Fast4
Veo 35
Sora 2 Pro9
Sora 212

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

Built with Grok

Products

ChatBuildImagineVoiceGrokipedia

Download

grok.comiOSAndroidGrok on X

Solutions

BusinessGovernmentCustomer SupportLegalSecurityUse Cases

Developers

API OverviewPricingModelsConsoleDocsStatus

Enterprise

Contact SalesFAQsBAADPA

Company

AboutColossusCareersNewsContact

Trust

SafetySecurityPrivacy PortalSubprocessorsHelp Center

Legal

TermsEnterprise TermsPrivacyCookiesAUPBrand

Social

@spacexai@grokDiscord

Built with Grok

Copy black SVG

Copy white SVG


Last updated Oct 08, 2026