Skip to main content
Lesson 12 of 16 · Getting started with Grok & xAI

Generate images and videos

Lesson 12 of 16 Updated November 2, 2026 Beginner
On this page
  1. Visual creation with Grok
  2. Generate an image
  3. Generate a video
  4. Write prompts that hold up
  5. Four limits to plan for from the first try
  6. Key takeaways

Updated November 2, 2026: Imagine. grok-imagine-image-quality was retired on November 2, 2026: its requests are now served by Imagine Image 2.0 (grok-imagine-image-2.0, $0.04 per image) at low quality. If you have older code, replace the model ID and set the quality you want; grok-imagine-image (version 1.0) isn’t affected. Imagine Image 2.0 accepts up to five reference images and auto quality, now the default.

Visual creation with Grok

Now that you’ve seen how Grok understands an image, let’s see how it makes one. The grok-imagine family of models generates images and videos from text descriptions, which makes it a tool for content creation, visual prototyping, and illustration. A visual idea that used to require a brief, a contractor, and two days of waiting can now be tested in minutes, even if you then hand the final version to a professional.

Generate an image

On grok.com, generation is built into the conversational interface: just describe the image you want in your message. The quality of the result depends almost entirely on how precise that description is, as in this example, which sets the subject, the place, the time, and the style:

Create an illustration of a ginger cat sitting on a Paris
rooftop at sunset, in watercolor style.

Grok automatically uses the grok-imagine model to create the image, which appears in the conversation and can be downloaded. Two models coexist depending on what you need: grok-imagine-image, the standard model, fast and inexpensive, is good for iterations and trying out framing, while grok-imagine-image-2.0 (Imagine Image 2.0) produces more detailed, more realistic renders that you save for the version you keep.

Through the API, you get precise control over generation:

response = client.images.generate(
    model="grok-imagine-image",
    prompt="A futuristic landscape with floating buildings",
    n=1,
    aspect_ratio="16:9",
    resolution="2k"
)

Available aspect ratios include 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, and others, enough to produce a banner and its vertical mobile version from the same prompt. You can generate up to 10 images per request, which is the right way to explore an art direction: ten variations of a good prompt beat a single image from a prompt you think is perfect.

Grok can also edit existing images. Editing through the API lets you add elements, change the style or mood, fix details, and above all chain successive edits by feeding the output of one request into the next. That chaining is far better than a giant prompt that tries to do everything at once: you move forward through clear corrections and can go back. You can provide up to 5 source images per editing request.

Generate a video

Unlike images, which are produced instantly, video creation is an asynchronous process, and that has a direct consequence for your code: you can’t wait for the response within the request. The sequence goes like this:

  1. You submit your request with a description
  2. You receive a request ID
  3. The video is generated in the background
  4. You retrieve the result once generation is finished

There are three approaches. Text-to-Video creates a video from a text description, Image-to-Video animates an existing image (the most reliable route when you already have the starting visual you want), and reference images act as a style guide for the video, so it stays consistent with a brand identity.

ParameterValues
Duration1 to 15 seconds per generation
Aspect ratio1:1, 16:9, 9:16, 4:3, and others
Resolution480p or 720p

You can also extend a generated video: you add 2 to 10 seconds to the end of an existing clip, with a prompt describing what should happen next. It’s the simplest way to go beyond the length of a single generation without losing visual continuity.

Write prompts that hold up

For an image, describe the subject, style, colors, mood, and lighting rather than just naming an object. Name the style you want explicitly (watercolor, photography, vector illustration, pixel art), because otherwise the model decides for you. Specify the composition (front view, high angle, close-up, or panoramic), then the details that anchor the scene: textures, materials, time of day, season.

For a video, movement is what carries the result: specify what moves, in which direction, and how fast, then the mood you want (calm, dynamic, dramatic, or joyful). Be realistic about scope, because short clips with simple movements give better results than a complex shot requested all at once.

Four limits to plan for from the first try

The URLs of generated images and videos are temporary: download your creations right away, or you’ll have to regenerate them, and an identical generation never gives exactly the same result. Content moderation applies automatically. Video generation has a default timeout of ten minutes, which you need to account for in your error handling. Finally, video editing is limited to 8.7 seconds of output at a maximum resolution of 720p: worth knowing before you build an editorial format on it.

Key takeaways

  • grok-imagine generates images (standard and 2.0) and videos
  • Images are generated instantly; videos are generated asynchronously
  • Several aspect ratios and resolutions are available
  • Image editing and video extension expand your creative options
  • Generated URLs are temporary: download your creations without delay