Update: new self-contained skill without the need for installing CLI is here: https://github.com/ropl-btc/agent-skills
Read-only CLI for twitterapi.io, built for OpenClaw, Claude Code, and other AI agents that need a simple, reusable interface for reading Twitter/X data.
This repo gives you two things:
- a small installable CLI:
twitterapi-io - a matching OpenClaw skill in
skills/twitterapi-io
- a small read-only CLI for
twitterapi.io - a matching OpenClaw skill under
skills/twitterapi-io - opinionated commands for common read workflows
- designed to be easy for humans and AI agents to use repeatedly
- not a posting client
- not a like/reply/delete client
- not a full wrapper for every twitterapi.io endpoint
- save
TWITTERAPI_IO_KEYlocally withauth - fetch one tweet by id or URL
- fetch one user by username
- fetch recent tweets for a user
- fetch replies to a tweet
- fetch quote tweets for a tweet
- fetch thread context for a tweet
- fetch mentions for a username
- run advanced search with pagination and helper time flags
- return compact JSON by default, with
--rawwhen needed
helpauthtweetuseruser-tweetsrepliesquotesthread-contextmentionssearch
pipx install git+https://github.com/ropl-btc/twitterapi-io-cli.gitThen run:
twitterapi-io helpgit clone https://github.com/ropl-btc/twitterapi-io-cli.git
cd twitterapi-io-cli
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install .At https://twitterapi.io/dashboard:
- log in
- copy your API key
Per the official docs, all requests authenticate with the x-api-key header.
Save the API key locally:
twitterapi-io auth --api-key YOUR_KEYThis writes to:
~/.config/twitterapi-io/config.json
You can also use an env var instead:
export TWITTERAPI_IO_KEY='YOUR_KEY'twitterapi-io helptwitterapi-io tweet --url 'https://x.com/jack/status/20'or:
twitterapi-io tweet --id 20twitterapi-io user --username OpenAItwitterapi-io user-tweets --username OpenAI --limit 10Include replies:
twitterapi-io user-tweets --username OpenAI --limit 10 --include-repliestwitterapi-io replies --url 'https://x.com/jack/status/20' --limit 20twitterapi-io quotes --id 20 --limit 20twitterapi-io thread-context --id 20 --limit 40twitterapi-io mentions --username OpenAI --limit 20twitterapi-io search --query 'AI agents -filter:replies' --from-user OpenAI --within-time 24h --max-tweets 50Use Top ranking:
twitterapi-io search --query 'AI agents' --queryType Top --max-pages 2Use explicit unix-time filters:
twitterapi-io search --query '$BTC' --since-time 1741219200 --until-time 1741305600 --max-tweets 50twitterapi-io tweet --id 20 --rawThis repo includes an OpenClaw skill under:
skills/twitterapi-io/SKILL.mdskills/twitterapi-io/scripts/twitterapi_io.pyskills/twitterapi-io/references/links.md
That subfolder is the one to use for skill-specific packaging and publishing.
The main intended interface for end users and agents is still the installed twitterapi-io command.
This CLI is based on the official twitterapi.io docs, especially:
GET /twitter/tweetsGET /twitter/user/infoGET /twitter/user/last_tweetsGET /twitter/tweet/repliesGET /twitter/tweet/quotesGET /twitter/tweet/thread_contextGET /twitter/user/mentionsGET /twitter/tweet/advanced_search- authentication via
x-api-key
MIT