Model Capabilities

Image-to-Video

View as Markdown

Transform a still image into a video by providing a source image along with your prompt. The model animates the image content based on your instructions.

You can provide the source image as:

  • A public URL pointing to an image
  • A base64-encoded data URI (e.g., data:image/jpeg;base64,...)

The demo below shows this in action; hold to animate a still image:

Time-lapse
Loading video…
Hold to animate
Playing
import osimport xai_sdkclient = xai_sdk.Client(api_key=os.getenv("XAI_API_KEY"))response = client.video.generate(    prompt="Generate a slow and serene time-lapse",    model="grok-imagine-video",    image_url="https://docs.x.ai/assets/api-examples/video/milkyway-still.png",    duration=12,)print(response.url)

In the Vercel AI SDK, the prompt parameter accepts an object with image and text fields for image-to-video generation. The image field can be a URL string, base64-encoded string, Uint8Array, ArrayBuffer, or Buffer.



Did you find this page helpful?

Last updated: April 2, 2026