| name | twitter-cli |
| displayName | Twitter CLI |
| description | Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, and user lookups. Invoke whenever the user requests any Twitter/X interaction. |
| author | jackwener |
| upstream | public-clis/twitter-cli |
| upstreamSha | 7c634e0d396b1e7af9f63315b414925fe4f29ae7 |
| version | 0.8.0 |
| tags | ["Social","Search","CLI"] |
| aliases | ["Twitter","X","推特","推文"] |
| scenarios | ["搜索 Twitter/X 推文或话题","查看时间线、书签或用户动态","对推文执行点赞、转推、回复、引用等操作"] |
twitter-cli — Twitter/X CLI Tool
Binary: twitter
Credentials: browser cookies (auto-extracted) or env vars
Setup
uv tool install twitter-cli
uv tool upgrade twitter-cli
Authentication
IMPORTANT FOR AGENTS: Before executing ANY twitter-cli command, you MUST first check whether credentials exist. If not, proactively guide the user through authentication. Do NOT assume credentials are configured.
CRITICAL: Write operations (posting tweets, replying, quoting) require full browser cookies. Only providing auth_token + ct0 via env vars may trigger HTTP 226 ("looks like automated behavior"). Prefer browser cookie extraction whenever possible.
Step 0: Check if already authenticated
twitter status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED"
If AUTH_OK, continue to the command reference.
If AUTH_NEEDED, guide the user using one of the following methods.
Step 1: Guide user to authenticate
Method A: Browser cookie extraction (recommended)
Ensure the user is logged into x.com in Arc, Chrome, Edge, Firefox, or Brave. twitter-cli auto-extracts cookies.
- All Chrome profiles are scanned automatically.
- To specify a profile:
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
- To prioritize a specific browser:
TWITTER_BROWSER=chrome twitter feed
Verify with:
twitter whoami
Method B: Environment variables
export TWITTER_AUTH_TOKEN="<auth_token from browser>"
export TWITTER_CT0=
twitter