API / enable-x-search-video-understanding

API

Enable video understanding on X Search

Enable video understanding on X Search

Set enable_video_understanding on the x_search tool so Grok can inspect video attached to X posts when answering. This flag lives on X Search only. Base X Search setup: Search X posts with the Grok API.

xAI SDK

import os

from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import x_search

client = Client(api_key=os.getenv("XAI_API_KEY"))
chat = client.chat.create(
    model="grok-4.6",
    tools=[
        x_search(enable_video_understanding=True),
    ],
)

chat.append(user("Summarize the video in the latest SpaceX launch posts on X."))
response = chat.sample()
print(response.content)

OpenAI Responses

curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
  "model": "grok-4.6",
  "input": [
    {
      "role": "user",
      "content": "Summarize the video in the latest SpaceX launch posts on X."
    }
  ],
  "tools": [
    {
      "type": "x_search",
      "enable_video_understanding": true
    }
  ]
}'

Vercel AI SDK

import { xai } from '@ai-sdk/xai';

const tools = {
  x_search: xai.tools.xSearch({
    enableVideoUnderstanding: true,
  }),
};

Image understanding on the same tool

enable_image_understanding is also available on x_search for stills attached to posts. You can set both flags on one tool when the query needs video and images.

Pitfalls

  • enable_video_understanding is an X Search parameter only. Web Search has no video-understanding flag.
  • Console API credits are separate from SuperGrok's weekly pool on grok.com.