Real-time X/Twitter search powered by Grok's x_search tool, returning real tweets with cited sources.
Configuration
Set the xAI API key:
clawdbot config set skills.entries.search-x.apiKey "xai-YOUR-KEY"
Or use an environment variable:
export XAI_API_KEY="xai-YOUR-KEY"
Get an API key:https://console.x.ai
Commands
Basic search
node {baseDir}/scripts/search.js "AI video editing"
Filter by time
node {baseDir}/scripts/search.js --days 7 "breaking news"
node {baseDir}/scripts/search.js --days 1 "trending today"
Filter by account
node {baseDir}/scripts/search.js --handles @elonmusk,@OpenAI "AI announcements"
node {baseDir}/scripts/search.js --exclude @bots "real discussions"
Output options
node {baseDir}/scripts/search.js --json "topic" # 完整 JSON 响应
node {baseDir}/scripts/search.js --compact "topic" # 仅推文内容,无冗余信息
node {baseDir}/scripts/search.js --links-only "topic" # 仅 X 链接
Conversation examples
User:"Search X for discussions about Claude Code" Action: Execute a search with "Claude Code" as the keyword
User:"Find @remotion_dev's tweets from the past week"
Action: Execute --handles @remotion_dev --days 7
User:"What are the trending topics about AI on Twitter today?"
Action: Execute --days 1 "AI trending"
User:"Search X for content about Remotion best practices from the past 30 days"
Action: Execute --days 30 "Remotion best practices"
How it works
Use xAI's Responses API (/v1/responses) to call the x_search tool:
- Model:
grok-4-1-fast-non-reasoning(optimized for agentic search) - Returns real tweets with URLs
- Includes verifiable cited sources
- Supports date and account filtering
Return format
Each result includes:
- @username(display name)
- Tweet content
- Publish date/time
- Direct link to the tweet
Environment variables
XAI_API_KEY— xAI API key (required)SEARCH_X_MODEL— model override (default: grok-4-1-fast)SEARCH_X_DAYS— default search days (default: 30)