SpyBara
Go Premium

Documentation 2026-09-07 22:57 UTC to 2026-09-08 21:00 UTC

7 files changed +121 −13. View all changes and history on the product overview
2026
Wed 30 23:57 Tue 29 23:59 Mon 28 23:57 Sun 27 22:59 Sat 26 23:59 Fri 25 23:01 Thu 24 23:59 Wed 23 23:59 Tue 22 23:58 Mon 21 23:00 Sun 20 23:01 Sat 19 23:59 Fri 18 23:59 Thu 17 10:04 Wed 16 19:01 Tue 15 17:00 Mon 14 06:00 Sun 13 05:00 Fri 11 21:00 Tue 8 21:00 Mon 7 22:57 Thu 3 16:59 Wed 2 22:03
Details

970 970 

971**Batch Requests**971**Batch Requests**

972 972 

973* A batch can contain an **unlimited** number of requests in theory, but extremely large batches (>1,000,000 requests) may be throttled for processing stability.973* A batch can contain an **unlimited** number of requests in theory, but extremely large batches (>100,000 requests) may be throttled for processing stability.

974* Each individual request that can be added to a batch has a maximum payload size of **25MB**.974* Each individual request that can be added to a batch has a maximum payload size of **25MB**.

975* A team can send up to **1000** add-batch-requests API calls every **30 seconds** (this is a rolling limit shared across all batches in the team).975* A team can send up to **1000** add-batch-requests API calls every **30 seconds** (this is a rolling limit shared across all batches in the team).

976* Image and video results contain signed URLs that expire after **1 hour**. Download the media promptly after retrieving results.976* Image and video results contain signed URLs that expire after **1 hour**. Download the media promptly after retrieving results.

docs-mcp.md +17 −0

Details

16 16 

17## Quickstart17## Quickstart

18 18 

19### Grok Build

20 

21In Grok Build, add the server from the terminal:

22 

23```bash customLanguage="bash"

24grok mcp add --transport http xai-docs https://docs.x.ai/api/mcp

25```

26 

27Or declare it directly in `~/.grok/config.toml`:

28 

29```toml customLanguage="toml"

30[mcp_servers.xai-docs]

31url = "https://docs.x.ai/api/mcp"

32```

33 

34Run `grok mcp doctor xai-docs` to verify the connection. See [MCP Servers](/build/features/mcp-servers) for project-scoped configuration and troubleshooting.

35 

19### Cursor36### Cursor

20 37 

21In Cursor, go to **Settings → MCP** and add a new server:38In Cursor, go to **Settings → MCP** and add a new server:

Details

129 129 

130* [Image-to-Video](/developers/model-capabilities/video/image-to-video) — Animate a still image.130* [Image-to-Video](/developers/model-capabilities/video/image-to-video) — Animate a still image.

131* [Video Editing](/developers/model-capabilities/video/editing) — Modify an existing video.131* [Video Editing](/developers/model-capabilities/video/editing) — Modify an existing video.

132* [Reference-to-Video](/developers/model-capabilities/video/reference-to-video) — Guide a generated video with one or more reference images.132* [Reference-to-Video](/developers/model-capabilities/video/reference-to-video) — Guide a generated video with reference images, and on `grok-imagine-video-1.5` pin exact first or last frames.

133* [Video Extension](/developers/model-capabilities/video/extension) — Continue an existing video from its last frame.133* [Video Extension](/developers/model-capabilities/video/extension) — Continue an existing video from its last frame.

134 134 

135## How it works135## How it works


381 381 

382### Request Modes382### Request Modes

383 383 

384The video generation endpoint supports multiple modes, determined by which fields are set. Only one mode can be active per request:384The video generation endpoint supports multiple modes, determined by which fields are set. Edit and extend use dedicated endpoints; generation modes share `/v1/videos/generations`:

385 385 

386| Mode | REST API fields | AI SDK shape | Description |386| Mode | REST API fields | AI SDK shape | Description |

387|------|-----------------|--------------|-------------|387|------|-----------------|--------------|-------------|

388| Text-to-video | `prompt` only | `prompt: "..."` | Generates video from a text prompt alone. |388| Text-to-video | `prompt` only | `prompt: "..."` | Generates video from a text prompt alone. |

389| Image-to-video | `prompt` + `image` | `prompt: { image, text }` | Generates video with the provided image as the starting frame. |389| Image-to-video | `prompt` + `image` | `prompt: { image, text }` | Generates video with the provided image as the starting frame. |

390| Reference-to-video | `prompt` + `reference_images` or `reference_audios` | `prompt: "..."` + `providerOptions.xai.{ mode: "reference-to-video", referenceImageUrls }` | Generates video guided by reference images and/or a preset voice on `grok-imagine-video-1.5`. |390| Reference-to-video | `prompt` + `reference_images` or `reference_audios` | `prompt: "..."` + `providerOptions.xai.{ mode: "reference-to-video", referenceImageUrls }` | Generates video guided by reference images and/or a preset voice on `grok-imagine-video-1.5`. |

391| First & Last frame | `last_frame`, optionally with `image` and/or `prompt` | REST body `last_frame` (no dedicated AI SDK field) | On `grok-imagine-video-1.5`, pins the exact last frame. Add `image` to also pin the first frame and interpolate between the two. `prompt` is optional whenever a frame is pinned. Can be combined with `reference_images` / `reference_audios`. |

391| Edit-video | `/v1/videos/edits` + `video` | `prompt: "..."` + `providerOptions.xai.{ mode: "edit-video", videoUrl }` | Modifies an existing video based on the prompt. |392| Edit-video | `/v1/videos/edits` + `video` | `prompt: "..."` + `providerOptions.xai.{ mode: "edit-video", videoUrl }` | Modifies an existing video based on the prompt. |

392| Extend-video | `/v1/videos/extensions` + `video` | `prompt: "..."` + `providerOptions.xai.{ mode: "extend-video", videoUrl }` | Extends an existing video from its last frame. |393| Extend-video | `/v1/videos/extensions` + `video` | `prompt: "..."` + `providerOptions.xai.{ mode: "extend-video", videoUrl }` | Extends an existing video from its last frame. |

393 394 

394The following combination is **not allowed** and will return a `400 Bad Request` error:395On `grok-imagine-video-1.5`, `image` combined with `reference_images`, `reference_audios`, or `last_frame` is reference-to-video with a pinned first frame. The clip starts on that image rather than treating it as a style reference. `last_frame` on its own (no `image`, no references) is valid: the model generates the opening and lands on the pinned frame. `prompt` is optional for any request that includes `image`, `reference_images`, or `last_frame`; it is required only for text-to-video. Classic `grok-imagine-video` still rejects `last_frame` and rejects combining `image` with reference inputs.

395 396 

396* `image` + `reference_images` — use one or the other397Do not mix AI SDK `mode` values. Each request supports exactly one of `"edit-video"`, `"extend-video"`, or `"reference-to-video"`. When you omit `mode`, the AI SDK uses standard generation.

397* Mixing `mode` values in the AI SDK — each request supports exactly one of `"edit-video"`, `"extend-video"`, or `"reference-to-video"`

398 398 

399When you omit `mode`, the AI SDK uses standard generation.399See [First & Last frame](/developers/model-capabilities/video/reference-to-video#first--last-frame) for `last_frame` examples.

400 400 

401## Customize Polling Behavior401## Customize Polling Behavior

402 402 


754 754 

755* [Models](/developers/models) — Available video models and pricing755* [Models](/developers/models) — Available video models and pricing

756* [Image-to-Video](/developers/model-capabilities/video/image-to-video) — Animate a still image756* [Image-to-Video](/developers/model-capabilities/video/image-to-video) — Animate a still image

757* [Reference-to-Video](/developers/model-capabilities/video/reference-to-video) — Guide a video with reference images757* [Reference-to-Video](/developers/model-capabilities/video/reference-to-video) — Guide a video with reference images, or pin the first & last frame

758* [Video Editing](/developers/model-capabilities/video/editing) — Edit existing videos758* [Video Editing](/developers/model-capabilities/video/editing) — Edit existing videos

759* [Video Extension](/developers/model-capabilities/video/extension) — Extend existing videos759* [Video Extension](/developers/model-capabilities/video/extension) — Extend existing videos

760* [Image Generation](/developers/model-capabilities/images/generation) — Generate still images from text760* [Image Generation](/developers/model-capabilities/images/generation) — Generate still images from text

Details

2 2 

3# Image-to-Video3# Image-to-Video

4 4 

5Transform a still image into a video by providing a source image along with an optional prompt. The model animates the image content based on your instructions. On `grok-imagine-video-1.5`, image-to-video supports native 1080p.5Transform a still image into a video by providing a source image along with an optional prompt. The model animates the image content based on your instructions. On `grok-imagine-video-1.5`, image-to-video supports native 1080p. Sending `image` alone is image-to-video. Combining it with `last_frame` or `reference_images` is reference-to-video with that image as the pinned first frame. See [First & Last frame](/developers/model-capabilities/video/reference-to-video#first--last-frame).

6 6 

7You can provide the source image as:7You can provide the source image as:

8 8 


17## Related17## Related

18 18 

19* [Video Generation](/developers/model-capabilities/video/generation) — Generate videos from text prompts19* [Video Generation](/developers/model-capabilities/video/generation) — Generate videos from text prompts

20* [Reference-to-Video](/developers/model-capabilities/video/reference-to-video) — Guide a video with reference images20* [Reference-to-Video](/developers/model-capabilities/video/reference-to-video) — Guide a video with reference images, or pin the first & last frame

21* [Model page: grok-imagine-video-1.5](/developers/models/grok-imagine-video-1.5)21* [Model page: grok-imagine-video-1.5](/developers/models/grok-imagine-video-1.5)

22* [Videos API](/developers/rest-api-reference/inference/videos) — Video generation endpoints22* [Videos API](/developers/rest-api-reference/inference/videos) — Video generation endpoints

23* [Video Editing](/developers/model-capabilities/video/editing) — Edit existing videos23* [Video Editing](/developers/model-capabilities/video/editing) — Edit existing videos

Details

2 2 

3# Reference-to-Video3# Reference-to-Video

4 4 

5Provide reference images, a preset voice, or both to guide the generated video. Images incorporate specific people, objects, clothing, or other visual elements without locking the first frame (unlike [image-to-video](/developers/model-capabilities/video/image-to-video)). This is useful for virtual try-on, product placement, character-consistent storytelling, and voice identity. On `grok-imagine-video-1.5`, you can also pick the voice your subject speaks in (see [Reference audio](#reference-audio)).5Provide reference images, a preset voice, or both to guide the generated video. Images incorporate specific people, objects, clothing, or other visual elements without locking the first frame (unlike [image-to-video](/developers/model-capabilities/video/image-to-video)). This is useful for virtual try-on, product placement, character-consistent storytelling, and voice identity. On `grok-imagine-video-1.5`, you can also pick the voice your subject speaks in (see [Reference audio](#reference-audio)), and pin the exact first or last frame (see [First & Last frame](#first--last-frame)).

6 6 

7Each reference image can be provided as a public HTTPS URL, a base64-encoded data URI, or a `file_id` from the [Files API](/developers/files) — and you can mix kinds within a single request. See [Imagine → Files API Integration](/developers/model-capabilities/imagine/files/inputs) for `file_id` details and examples.7Each reference image can be provided as a public HTTPS URL, a base64-encoded data URI, or a `file_id` from the [Files API](/developers/files) — and you can mix kinds within a single request. See [Imagine → Files API Integration](/developers/model-capabilities/imagine/files/inputs) for `file_id` details and examples.

8 8 


257done257done

258```258```

259 259 

260## First & Last frame

261 

262On `grok-imagine-video-1.5`, `last_frame` pins the exact last frame of the clip. The video ends arriving on that image rather than re-rendering it as a reference. `image` combined with `reference_images`, `reference_audios`, or `last_frame` is the matching first-frame pin.

263 

264| Request shape | Result |

265|---------------|--------|

266| `image` + `last_frame` | Pinned first and last frame. The model interpolates between the two. |

267| `last_frame` only | Pinned last frame. The model generates the opening and lands on the pinned image. |

268| `last_frame` + `reference_images` / `reference_audios` | Pinned last frame with reference guidance. Add `image` to pin the first frame as well. |

269 

270`prompt` is optional in every first & last frame request. Include one to steer motion and camera work between the frames; omit it to let the frames alone drive the clip.

271 

272`last_frame` uses the same URL, data-URI, and `file_id` shapes as [image-to-video](/developers/model-capabilities/video/image-to-video). The Python SDK and Vercel AI SDK do not yet expose a dedicated `last_frame` parameter; send it on the REST body.

273 

274Classic `grok-imagine-video` rejects `last_frame` and rejects combining `image` with reference inputs.

275 

276```python customLanguage="pythonRequests"

277import os

278import time

279import requests

280 

281headers = {

282 "Content-Type": "application/json",

283 "Authorization": f"Bearer {os.environ['XAI_API_KEY']}",

284}

285 

286response = requests.post(

287 "https://api.x.ai/v1/videos/generations",

288 headers=headers,

289 json={

290 "model": "grok-imagine-video-1.5",

291 "prompt": "The camera dollies from the sunlit doorway to the window, settling on the closing frame.",

292 "image": {"url": "<FIRST_FRAME_URL>"},

293 "last_frame": {"url": "<LAST_FRAME_URL>"},

294 "duration": 8,

295 "aspect_ratio": "16:9",

296 "resolution": "720p",

297 },

298)

299 

300request_id = response.json()["request_id"]

301 

302while True:

303 result = requests.get(

304 f"https://api.x.ai/v1/videos/{request_id}",

305 headers={"Authorization": headers["Authorization"]},

306 )

307 data = result.json()

308 if data["status"] == "done":

309 print(data["video"]["url"])

310 break

311 elif data["status"] == "expired":

312 print("Request expired")

313 break

314 time.sleep(5)

315```

316 

317```bash

318REQUEST_ID=$(curl -s -X POST https://api.x.ai/v1/videos/generations \

319 -H "Content-Type: application/json" \

320 -H "Authorization: Bearer $XAI_API_KEY" \

321 -d '{

322 "model": "grok-imagine-video-1.5",

323 "prompt": "The camera dollies from the sunlit doorway to the window, settling on the closing frame.",

324 "image": {"url": "<FIRST_FRAME_URL>"},

325 "last_frame": {"url": "<LAST_FRAME_URL>"},

326 "duration": 8,

327 "aspect_ratio": "16:9",

328 "resolution": "720p"

329 }' | jq -r '.request_id')

330 

331while true; do

332 RESULT=$(curl -s https://api.x.ai/v1/videos/$REQUEST_ID \

333 -H "Authorization: Bearer $XAI_API_KEY")

334 STATUS=$(echo "$RESULT" | jq -r '.status')

335 if [ "$STATUS" = "done" ]; then

336 echo "$RESULT" | jq -r '.video.url'

337 break

338 elif [ "$STATUS" = "failed" ] || [ "$STATUS" = "expired" ]; then

339 echo "Request $STATUS"; echo "$RESULT" | jq .

340 break

341 fi

342 sleep 5

343done

344```

345 

260## Related346## Related

261 347 

262* [Video Generation](/developers/model-capabilities/video/generation) — Generate videos from text prompts348* [Video Generation](/developers/model-capabilities/video/generation) — Generate videos from text prompts

rate-limits.md +2 −2

Details

40| grok-4.20-0309-non-reasoning | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |40| grok-4.20-0309-non-reasoning | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |

41| grok-build-0.1 | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |41| grok-build-0.1 | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |

42| grok-4.20-multi-agent-0309 | T0: 9, T1: 12, T2: 18, T3: 31, T4: 56 | T0: 2.5M, T1: 3.7M, T2: 6.2M, T3: 11M, T4: 21M |42| grok-4.20-multi-agent-0309 | T0: 9, T1: 12, T2: 18, T3: 31, T4: 56 | T0: 2.5M, T1: 3.7M, T2: 6.2M, T3: 11M, T4: 21M |

43| grok-imagine-image-2.0 | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

44| grok-imagine-image | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |43| grok-imagine-image | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

44| grok-imagine-image-2.0 | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

45| grok-imagine-image-quality | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |45| grok-imagine-image-quality | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

46| grok-imagine-video-1.5 | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

47| grok-imagine-video | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |46| grok-imagine-video | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

47| grok-imagine-video-1.5 | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

48 48 

49### What counts toward TPM49### What counts toward TPM

50 50