X Search Skill
Search X (Twitter) posts using xAI's x_search tool via the Responses API.
Usage
# Basic search
python3 ~/.openclaw/skills/x-search/scripts/x-search.py "search query"
# Filter by handles
python3 ~/.openclaw/skills/x-search/scripts/x-search.py "topic" --handles @elonmusk,@xaboratory
# Exclude handles
python3 ~/.openclaw/skills/x-search/scripts/x-search.py "topic" --exclude @spam1,@spam2
# Date range
python3 ~/.openclaw/skills/x-search/scripts/x-search.py "topic" --from 2026-01-01 --to 2026-05-16
# Media filters
python3 ~/.openclaw/skills/x-search/scripts/x-search.py "topic" --images --videos
Credential Resolution
- xai-oauth skill (preferred) — runs
xai-oauth.py token XAI_API_KEYenvironment variable (fallback)
Output
JSON to stdout with success, answer, citations, inline_citations, model, and credential_source fields.
Notes
- Standard library Python only (no pip dependencies)
- Cannot use both
--handlesand--excludesimultaneously - Max 10 handles per filter
- Retries on 5xx/timeout (up to 2 retries with backoff)