> ## Documentation Index
> Fetch the complete documentation index at: https://docs.varios-ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# xAI Imagine Video

> Generates videos through the xAI video API (async submit and poll), stores MP4 as a Flow persistent resource, and attaches it to the tool message.

## Options

<ParamField body="model" type="string" required>
  xAI model id for video generation (for example `grok-imagine-video`).
</ParamField>

<ParamField body="credential" type="string" required>
  Reference to stored credentials. Use credential parameters `apiKey` or `xaiApiKey` for Bearer auth against `https://api.x.ai/v1/`. See the [xAI video generations guide](https://docs.x.ai/docs/guides/video-generations).
</ParamField>

<ParamField body="endpointUrl" type="string">
  Optional base URL. If omitted or empty, defaults to `https://api.x.ai/v1`.
</ParamField>

<ParamField body="costs" type="number">
  Optional flat cost per successful run.
</ParamField>

## Arguments

<ParamField body="prompt" type="string" required>
  Description of the desired scene.
</ParamField>

<ParamField body="duration" type="integer">
  Clip length in seconds (1–15), default 8.
</ParamField>

<ParamField body="aspect_ratio" type="string">
  `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`; default `16:9`.
</ParamField>

<ParamField body="resolution" type="string">
  `480p` or `720p`; default `720p`.
</ParamField>

<ParamField body="lastImagesCount" type="integer">
  Optional: how many of the latest chat images (max. 3) to send as `image` (data URL) for image-to-video or guidance.
</ParamField>

## Prompt function

```
\Avency\BotAPI\Service\Adapter\XaiImagineVideo::execute
```
