# X Search

> Search X (Twitter) posts via xAI's built-in x_search tool. Requires xai-oauth skill or XAI_API_KEY env var.

- Skill: `clawdbrunner/x-search` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add clawdbrunner/x-search`
- Raw SKILL.md: https://api.skillmd.com/api/skills/clawdbrunner/x-search/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: clawdbrunner (https://skillmd.com/u/clawdbrunner)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/clawdbrunner/x-search

---


# X Search Skill

Search X (Twitter) posts using xAI's x_search tool via the Responses API.

## Usage

```bash
# 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

1. xai-oauth skill (preferred) — runs `xai-oauth.py token`
2. `XAI_API_KEY` environment 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 `--handles` and `--exclude` simultaneously
- Max 10 handles per filter
- Retries on 5xx/timeout (up to 2 retries with backoff)

