Video Understanding on X
On this page
Updated November 3, 2026. The xAI SDK example originally called
client.responses.create(), a method that doesn’t exist inxai-sdk. With this SDK, pass thex_search()tool toclient.chat.create(). OpenAI SDK examples now configure the client to point tohttps://api.x.ai/v1. The period ends beforeto_date(exclusive), so an April period ends on2026-05-01. Thexaboratoryaccount didn’t exist; the example now filters onxai. Cost descriptions match xAI billing (image and video vision count as image tokens); removed the unsourced numerical ranking. Code verified withxai-sdk1.21.0 andopenai3.42.1. Sources: X Search · Pricing.
Analyze Videos Posted on X
X Search offers an exclusive feature that Web Search doesn’t: video understanding. With the enable_video_understanding parameter, the model can analyze video content within X posts it finds during its search. Combined with image understanding, this capability makes X Search a complete multimedia analysis tool.
Activation
Enable it via the enable_video_understanding parameter:
{
"tools": [{
"type": "x_search",
"enable_video_understanding": true
}]
}
You can enable image and video understanding simultaneously:
{
"tools": [{
"type": "x_search",
"enable_image_understanding": true,
"enable_video_understanding": true
}]
}
SDK Syntax
xAI SDK (Python)
from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import x_search
client = Client() # key read from XAI_API_KEY
chat = client.chat.create(
model="grok-4.20-0309-reasoning",
tools=[x_search(enable_image_understanding=True, enable_video_understanding=True)],
)
chat.append(user("Analyze the latest AI product video demos on X"))
response = chat.sample()
print(response.content)
print(response.citations)
In this SDK, from_date and to_date are datetime objects, not strings.
OpenAI SDK (Python)
The following examples use this client:
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["XAI_API_KEY"], base_url="https://api.x.ai/v1")
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input="Analyze the latest AI product video demos on X",
tools=[{
"type": "x_search",
"enable_image_understanding": True,
"enable_video_understanding": True
}]
)
Vercel AI SDK (JavaScript)
tools: {
x_search: xai.tools.xSearch({
enableImageUnderstanding: true,
enableVideoUnderstanding: true,
}),
},
Use Cases
Product Launch Monitoring
Tech companies frequently post video demos of their products on X. With video understanding, you can automate the analysis of this content:
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input="What new features were shown in video by AI companies this week?",
tools=[{
"type": "x_search",
"enable_image_understanding": True,
"from_date": "2026-10-27",
"to_date": "2026-11-03" # exclusive: through November 2 inclusive
}]
)
Tutorial Analysis
Developers often share short video tutorials on X. Video understanding lets you extract key information without watching every video.
Creative Monitoring
Marketing or design teams can analyze trend videos, creative ads, or viral content posted on X.
Full Parameter Combination
X Search reaches its full potential when you combine all its parameters:
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input="Summarize video demos published by xAI in October",
tools=[{
"type": "x_search",
"allowed_x_handles": ["xai"], # without @, max 20 accounts
"from_date": "2026-10-01",
"to_date": "2026-11-01", # exclusive: all of October
"enable_image_understanding": True,
"enable_video_understanding": True
}]
)
This query combines four filters: specific accounts, time window, image analysis, and video analysis.
Cost and Performance Impact
According to xAI’s pricing grid, the X Search tool is billed per number of posts and profiles retrieved ($5 per 1,000 posts, $10 per 1,000 profiles), and vision for found images and videos adds tokens, counted as image tokens. A query that opens many videos can therefore cost significantly more than text-only search. Discipline comes down to three steps. Enable the feature only when videos are truly essential to the question. Reduce the corpus upstream with account and date filters, which apply to every search launched by the model: fewer candidate posts means fewer videos to watch. And monitor query consumption: the response indicates how many posts and profiles were retrieved.
Multimedia Capabilities Summary
| Feature | Web Search | X Search |
|---|---|---|
| Text | Yes | Yes |
Images (enable_image_understanding) | Yes | Yes |
Video (enable_video_understanding) | No | Yes |
Video understanding is an X Search exclusive. If you need to analyze videos found on the web (outside X), you’ll need to use other approaches, such as sending visual content directly to the model.
Key Takeaways
- Video understanding is an X Search exclusive
- Enable with
enable_video_understanding: true - Combinable with image understanding, handles, and dates
- Cost: retrieved posts and profiles, plus image tokens for watched videos; filter by accounts and dates
- Ideal for launch monitoring, demo analysis, and multimedia monitoring