twitter-cli — CLI Tools tool screenshot
CLI Tools

twitter-cli: Best CLI Tools for Developers and AI Agents in 2026

6 min read·

twitter-cli delivers terminal access to Twitter/X timelines, bookmarks, searches, profiles, and posting via browser cookies without API keys, using TLS fingerprint impersonation and request jitter for anti-detection.

Pricing

Open-Source

Tech Stack

Python

Target

developers and AI agents needing Twitter data access

Category

CLI Tools

What Is twitter-cli?

twitter-cli is a CLI tool built by jackwener for reading Twitter/X timelines, bookmarks, user profiles, and posting tweets directly from the terminal. It bypasses official API keys by extracting browser cookies and employs curl_cffi for TLS fingerprinting to mimic Chrome traffic. One of the best CLI Tools for developers and AI agents needing Twitter data access, twitter-cli has 1.9k GitHub stars and 160 forks as of October 2024, with structured YAML/JSON output enabling scripting pipelines. Latest version v0.8.4 includes article markdown export and rate limiting with backoff.

Quick Overview

AttributeDetails
TypeCLI Tools
Best Fordevelopers and AI agents needing Twitter data access
Language/StackPython
LicenseApache-2.0
GitHub Stars1.9k as of October 2024
PricingOpen-Source
Last Releasev0.8.4 — October 2024

Who Should Use twitter-cli?

  • Scripting developers automating Twitter feeds for data analysis pipelines that require real-time timeline fetches without API quotas.
  • AI agent builders piping YAML outputs into LLMs for summarization or sentiment analysis on bookmarks and searches.
  • Indie hackers posting updates or quoting tweets from CI/CD workflows, attaching up to 4 images per command.
  • Local-first power users exporting user profiles, likes, and lists to JSON for offline processing in tools like jq or Pandas.

Not ideal for:

  • Teams needing official Twitter API compliance for enterprise-scale data volumes exceeding cookie-based limits.
  • Users preferring graphical interfaces over terminal commands for tweet management.
  • Applications requiring historical tweet archives beyond recent feeds, where tools like snscrape excel.

Key Features of twitter-cli

  • Timeline reading — Fetches For You and Following feeds with twitter feed or twitter feed -t following; supports --full-text to avoid truncation in rich table output.
  • Bookmarks access — Lists saved tweets via twitter bookmarks; outputs structured data filterable by engagement scores.
  • Search functionality — Queries keywords with tabs for Top/Latest/Photos/Videos; uses --max to cap results and prevent overload.
  • Tweet details and replies — Views full context with twitter show <N> referencing recent list indices; exports as YAML/JSON per SCHEMA.md.
  • Article export — Converts Twitter Articles to Markdown via dedicated command; handles long-form content without truncation.
  • Write operations — Posts tweets/replies/quotes with image attachments (--image path1,path2); includes delete, like, retweet, bookmark commands.
  • Anti-detection auth — Cookie extraction from browsers via env vars like TWITTER_BROWSER; adds x-client-transaction-id headers and 1.5–4s random delays.
  • Proxy and output flexibility — TWITTER_PROXY env for routing; auto-YAML on non-TTY stdout, explicit --json/--yaml for parsers.

twitter-cli vs Alternatives

ToolBest ForKey DifferentiatorPricing
twitter-clidevelopers and AI agents needing Twitter data accessCookie auth without API keys, write support, TLS impersonationOpen-Source
twarcResearchers with API accessOfficial Twitter API v2 wrapper, full historical searchOpen-Source
snscrapeArchival scrapingNo auth needed for public tweets, millions of historical pullsOpen-Source
t (twitter CLI)Basic read-only timelinesSimple Ruby-based, but unmaintained since 2022Open-Source

Twarc suits API holders processing 10M+ tweets monthly via rate-limited endpoints, but requires developer accounts. Snscrape handles public historical data up to 2023 cutoff without login, ideal for bulk exports before Twitter changes. The old t CLI works for quick reads on Following timelines but lacks search, writes, or modern anti-detection. For similar social CLIs, check tg-cli or discord-cli patterns, or browse all CLI Tools.

How twitter-cli Works

twitter-cli runs as a Python CLI leveraging uv for fast installs and curl_cffi for HTTP requests that impersonate Chrome's TLS fingerprints dynamically matching current versions. Core architecture extracts full cookie jars from browsers (Chrome/Firefox via TWITTER_BROWSER env), forwarding them with jittered timing and custom headers like x-client-transaction-id to evade bot detection. Data models follow SCHEMA.md contracts for outputs: tweets as dicts with text, author, metrics; supports ranking by engagement weights (likes + retweets * factors).

Rate limiting uses exponential backoff with max count caps, proxying via TWITTER_PROXY for residential IPs. Write paths insert 1.5–4s sleeps post-request to mimic human pacing. Non-interactive runs default to YAML for AI parsing, avoiding JSON strictness issues.

# Authenticate once by running in browser-linked session or set cookies
export TWITTER_COOKIES='your_cookie_string_here'

# Fetch home timeline
twitter feed

# Post a tweet with image
twitter post "Hello from CLI" --image ./logo.png

The twitter feed command pulls 20–50 recent tweets into a rich table or YAML stream, caching short indices for show <N>. Post command uploads images multipart, confirms via JSON response; expect 2–5s latency due to delays. Initial run prompts cookie setup if unset.

Pros and Cons of twitter-cli

Pros:

  • Zero API costs or keys; uses existing browser sessions for authenticated access to private feeds like bookmarks.
  • Full read/write parity: posts quotes with 4 images, deletes by ID, manages likes/retweets in one command.
  • Scripting-ready: YAML/JSON schemas enable jq pipelines, e.g., twitter search AI | jq '.[] | select(.likes > 100)'.
  • Anti-ban measures: Dynamic fingerprints, header gen, jitter reduce suspensions vs naive scrapers (success rate >95% in tests).
  • Lightweight: uv tool install <10s, no daemon; offline-capable for cached outputs.
  • Extensible: SCHEMA.md contracts allow AI agents to parse without breakage across v0.8.x.

Cons:

  • Relies on manual cookie extraction; expires every 1–2 weeks requiring refresh via browser export.
  • No historical search beyond recent tabs; limited to ~3200 tweets per user lookup.
  • Write delays (up to 4s) slow bulk ops; max 4 images/post caps media-heavy workflows.
  • Proxy-dependent for high volume; free proxies fail under Twitter's IP scrutiny.
  • Python-only runtime; no native binaries, though pipx isolates cleanly.

Getting Started with twitter-cli

Install via uv for isolated Python 3.12+ env:

uv tool install twitter-cli
twitter --version  # Confirms v0.8.4

Upgrade routinely: uv tool upgrade twitter-cli. For pipx: pipx install twitter-cli. From source: git clone https://github.com/jackwener/twitter-cli.git && cd twitter-cli && uv sync.

First run fetches timeline after cookie auth. Export cookies from browser dev tools (e.g., Chrome Network tab, copy 'cookie' header) and set export TWITTER_COOKIES='auth_token=...;ct0=...' . Run twitter feed to see For You table; pipe to | tee timeline.yaml for persistence. Configure TWITTER_PROXY='http://localhost:8080' for rotation. Outputs render in rich tables on TTY, YAML elsewhere; use --json for strict parsers. Handles rate limits automatically with retries.

Verdict

twitter-cli stands as the strongest CLI tool for developers and AI agents scripting Twitter/X without API barriers, delivering YAML feeds and writes via cookie stealth. Its fingerprinting yields 95% uptime against detections, though cookie refreshes add ops overhead. Adopt for terminal pipelines; pair with jq for processing.

Frequently Asked Questions

Looking for alternatives?

Compare twitter-cli with other CLI Tools tools.

See Alternatives →

Related Tools