Tweepy vs TwitterAPI.io

By Sarah Wong•10 min read
Split-screen Python REPL — left half shows tweepy.Client returning a 403 Forbidden tier-restricted error, right half shows a plain requests.get call returning a list of tweet objects from twitterapi.io
Same Python, same task — the difference is what's behind the endpoint.

Tweepy is the de-facto Python client for the X (Twitter) API. If you've written any Python code that touches X in the last decade, you've probably imported tweepy. It is well-maintained, well-documented, and well-trusted — the library itself is not the problem. The problem is what sits on the other side of the library in 2026.

Every tweepy call routes through the official X API surface, which means every call inherits the official pricing. X now sells API access pay-per-usage with no subscriptions: $0.005 per post read, $0.010 per user read, $0.010 per follower/following read, and $0.015 per post created ($0.20 for a post with a URL), capped at 3,000,000 post reads per monthly billing cycle, above which you need Enterprise (docs.x.com, 2026). A tweepy script that worked fine in 2022 can return HTTP 403 in 2026 because the v1.1 endpoint it called was retired.

This page is for teams who are already on tweepy and hitting these walls — or evaluating Python options for a new project and trying to avoid them. We compare tweepy's official path with TwitterAPI.io, a third-party HTTP API with the same data surface, no tier system, and pay-per-result pricing: $0.00015 per returned tweet ($0.15 per 1,000 tweets), with a 15-credit ($0.00015) minimum per request. The migration is a ~30 minute mechanical swap for most workloads. Code, cost math, and the full migration checklist below.

Migration economics

At 1,000,000 Post-reads/month: Tweepy on X's pay-per-usage pricing costs $5,000 (1,000,000 × $0.005). Same workload on TwitterAPI.io costs $150 ($0.15 per 1,000 tweets) — about 33x lower, for a half-day of migration work. Above 3,000,000 Post reads per monthly billing cycle the official API requires Enterprise.

01 — Section

Tweepy in 2026 — Status and What Changed Under It

Tweepy itself is healthy. The repository is active, the 4.x line ships incremental support for new X API endpoints as they appear, and the library covers both the v2 surface (recommended) and the surviving v1.1 endpoints. As a piece of Python, tweepy is a fine choice. If your stack is Node.js rather than Python, the same migration for the twitter-api-v2 npm package, with a measured field mapping, is on our twitter-api-v2 (npm) quick start for Node.js.

What changed is the API behind it. The v1.1 endpoints that older tweepy code relied on — statuses/filter, statuses/sample, parts of users/show — were retired in the 2023-2024 v1.1 sunset. Any project using tweepy.Stream or api.get_user(screen_name=...) against v1.1 stopped working when those endpoints went dark. The maintained surface today is the v2 client (tweepy.Client) and the small subset of v1.1 still exposed (tweepy.API for media upload). For a call-by-call map of the old v1.1 endpoints to X API v2 and TwitterAPI.io, with measured page sizes, see Twitter API 1.1 endpoint map and status.

The deeper change is pricing. Every v2 call is now billed per resource returned: $0.005 for each post read and $0.010 for each user read, so a tweepy script's bill grows with every page it paginates, up to the 3,000,000 post-read monthly cap, beyond which X routes you to Enterprise. The library does not (and cannot) shield you from this — its job is to call the API, not to renegotiate the tier.

02 — Section

Why Tweepy Users Hit Walls in 2026

The most common failure patterns reported in tweepy issues since X's 2026 pricing change:

Failures mid-job from the monthly cap, not from per-window rate limits. Pre-2026 rate-limiting was per-15-minute window — wait, retry, succeed. The pay-per-usage cap is monthly and account-wide: once you cross 3,000,000 post reads in a billing cycle, further reads need an Enterprise agreement. Tweepy's built-in retry handler cannot wait this out — the cap only resets with the next billing cycle.

HTTP 403 on endpoints that worked before. When X moved full-archive search behind higher access levels, tweepy code calling client.search_all_tweets(...) without that access started returning 403. The error message is accurate but unhelpful (Your API key does not have access to this product).

Costs that scale with max_results and pagination. Pre-2026, a tweepy job that paged through 50,000 tweets cost the same as a tweepy job that pulled 50. Post-2026, every post on every page bills $0.005, so 50,000 posts cost $250 and 50 posts cost $0.25. The library's tweepy.Paginator makes paging easy — which makes runaway bills easy too.

No way to see access limits before the call. Tweepy abstracts the v2 endpoint behind a method call. The library cannot tell you, before you run the call, whether your account has access — you find out from the response.

03 — Section

TwitterAPI.io as a Python Alternative

TwitterAPI.io is a third-party HTTP API with the same shape of data — tweets, users, search, followers, trends — but a different operating model: no tier system, no per-endpoint tier wall, no monthly account cap, and $0.00015 per returned tweet (15 credits, $0.15 per 1,000 tweets), with a 15-credit minimum per request. The API is plain HTTP and JSON, so requests works as the client (httpx, aiohttp, anything that speaks HTTP works the same way); there is also a twitterapi-io package on PyPI, including a tweepy-style client covered in section 04.

The trade-offs are real and worth naming up front: there is no tweepy.Paginator and no rate-limit auto-handler, and the tweepy-style client below is read-only; you do get a single endpoint that doesn't shift tier underneath you. You can call the HTTP API directly, or keep most of your tweepy code through the tweepy-style client in the next section. For workloads that are bounded by cost rather than convenience, the swap is a net win — for most analytics, monitoring, and research projects in 2026, that's the entire workload class.

Auth is a single header (X-API-Key). You get the key by signing in with Google at twitterapi.io — no application form, no tier interview, no enterprise contract. Spend is billable per call against a credit balance you top up; there is no monthly minimum, no committed spend, and no contract.

04 — Section

The Two-Line Path: a Tweepy-Style Client (twitterapi-io 0.2.0)

If your codebase already calls tweepy.Client, the shortest migration is not a rewrite. The twitterapi-io package on PyPI (version 0.2.0 and later, pip install -U twitterapi-io) ships twitterapi_io.compat.TweepyClient, a client with the same method names and the same response.data / response.meta shape for the common read calls. You change the import and the key; your read calls stay, and only your except tweepy.* imports need updating (see below). It is a tweepy-style interface built by TwitterAPI.io and is not affiliated with tweepy or X.

Methods covered (read-only): get_user / get_users, get_tweet / get_tweets, get_users_tweets, search_recent_tweets (not limited to the last 7 days), get_users_followers / get_users_following and get_users_mentions. Write methods such as create_tweet exist only so old code fails loudly: they raise NotImplementedError with a pointer to the docs.

What we saw when we ran it (twitterapi-io 0.2.0, clean virtualenv, 2026): get_user(username="XDevelopers") returned the account's numeric id; get_users_tweets(id="44196397", exclude=["replies"]) returned 20 tweets with meta holding result_count and next_token; search_recent_tweets("from:XDevelopers", max_results=10) returned 20; create_tweet raised NotImplementedError.

Three differences to plan for. First, max_results is accepted so your code runs, but pages are a fixed size of about 20, so a call asking for 10 still returns (and bills) a full page; loop on meta["next_token"] instead of sizing pages. Second, billing follows TwitterAPI.io's per-result pricing, not X's: about $0.003 for a 20-tweet page at 15 credits per tweet, versus $0.10 for the same 20 post reads at $0.005 each. The per-method call counts are in the package README on PyPI, and current prices are on the pricing page. Third, the exception classes keep tweepy's names (TooManyRequests, NotFound, Unauthorized and so on) but live in twitterapi_io.compat.errors, so an except tweepy.TooManyRequests: block will not catch them; change those imports to from twitterapi_io.compat.errors import TooManyRequests.

python
# pip install -U twitterapi-io   (0.2.0 or later)
import os

# Before: import tweepy; client = tweepy.Client(bearer_token=os.environ["X_BEARER_TOKEN"])
from twitterapi_io.compat import TweepyClient
client = TweepyClient(bearer_token=os.environ["TWITTERAPI_IO_KEY"])

# Unchanged tweepy-style read calls
user = client.get_user(username="XDevelopers")
print(user.data.id, user.data.username)

tweets, token = [], None
while len(tweets) < 100:
    resp = client.get_users_tweets(id=user.data.id, exclude=["replies"], pagination_token=token)
    tweets.extend(resp.data or [])
    token = (resp.meta or {}).get("next_token")
    if not token:
        break
print(len(tweets), "tweets")
# Bill: about 100 tweets x 15 credits = 1,500 credits = $0.015
05 — Section

Side-by-Side — Fetch the Last 1,000 Posts from @elonmusk — Tweepy (pay-per-use, $0.005 per post read)

Same task, two implementations. Both return a list of tweet objects. Tweepy uses tweepy.Client against v2; the alternative uses requests against TwitterAPI.io's /twitter/tweet/advanced_search.

python
import os
import tweepy

client = tweepy.Client(bearer_token=os.environ["X_BEARER_TOKEN"])

tweets = []
for page in tweepy.Paginator(
    client.search_recent_tweets,
    query="from:elonmusk",
    max_results=100,
    tweet_fields=["created_at", "public_metrics"],
    limit=10,  # 10 pages × 100 = 1,000
):
    if page.data:
        tweets.extend(page.data)
print(len(tweets))
# Bill: 1,000 post reads × $0.005 = $5.00
06 — Section

And via twitterapi.io — TwitterAPI.io (no tier required)

python
import os
import requests

API_KEY = os.environ["TWITTERAPI_IO_KEY"]
tweets = []
cursor = ""

while len(tweets) < 1000:
    r = requests.get(
        "https://api.twitterapi.io/twitter/tweet/advanced_search",
        headers={"X-API-Key": API_KEY},
        params={
            "query": "from:elonmusk",
            "queryType": "Latest",
            "cursor": cursor,
        },
        timeout=30,
    )
    r.raise_for_status()
    body = r.json()
    tweets.extend(body["tweets"])
    cursor = body.get("next_cursor", "")
    if not cursor:
        break

print(len(tweets))
# Bill: 1,000 tweets × $0.00015 = $0.15 total (~50 pages of 20 tweets, $0.003 each)
07 — Section

What the migration buys you — practical comparison

The shape is similar — both require pagination, both return tweet objects, both can be wrapped in your own helper class. Tweepy's auto-pagination is convenient; the explicit cursor loop is more transparent about cost. Neither is structurally harder than the other.

08 — Section

Cost Comparison Across Workload Sizes

The gap is a straight multiple of the per-read price. X's pay-per-usage plan bills $0.005 per post read with no subscription and caps you at 3,000,000 post reads per monthly billing cycle; TwitterAPI.io bills $0.15 per 1,000 returned tweets, with no monthly cap.

Monthly cost — Tweepy via X official vs TwitterAPI.io:

Workload (Post-reads/mo)Tweepy (X pay-per-use, $0.005/read)TwitterAPI.io ($0.15/1K tweets)
10,000$50$1.50
100,000$500$15
1,000,000$5,000$150
3,000,000$15,000 (at the monthly cap)$450
5,000,000Enterprise only (above the 3M cap)$750
10,000,000Enterprise only (above the 3M cap)$1,500

The official price is about 33 times higher ($5 per 1,000 post reads versus $0.15 per 1,000 tweets). There is no break-even volume: pay-per-usage has no flat fee to amortize, so the ratio holds from the first read to the 3M cap. Most analytics and monitoring workloads land in the 100K-10M range, which is where the swap usually pays for itself in the first week.

09 — Section

5-Step Migration Checklist

Most tweepy → TwitterAPI.io migrations take a half-day for a single-purpose script and 2-3 days for a larger codebase. The pattern is mechanical:

Step 1 — Swap the base URL and auth header. Replace bearer_token=... (Tweepy Client constructor) with an X-API-Key header on a requests.Session. Base URL changes from the official api.twitter.com host (v2 namespace) to the api.twitterapi.io host. Auth-method change is one line. If you use the tweepy-style client instead, Step 1 is changing import tweepy / tweepy.Client(...) to from twitterapi_io.compat import TweepyClient / TweepyClient(bearer_token=<your TwitterAPI.io key>), plus your except tweepy.* imports to twitterapi_io.compat.errors, and Steps 2 to 4 shrink to checking the methods you call are on the read-only list above.

Step 2 — Map endpoints. Most v2 endpoints map 1:1 to a TwitterAPI.io endpoint with a similar name. search_recent_tweets → /twitter/tweet/advanced_search. get_users → /twitter/user/info. get_users_tweets → /twitter/user/last_tweets. Streaming → /oapi/tweet_filter/add_rule (webhook or websocket). The TwitterAPI.io docs (docs.twitterapi.io) lists every endpoint with the same query semantics tweepy users know.

Step 3 — Adjust params. Param names differ in places — max_results → pageSize is a common one. Date range params use ISO 8601 strings the same way. Tweet/user fields are returned by default rather than opted-in via tweet.fields= parameters.

Step 4 — Handle pagination. Tweepy's Paginator is replaced by a while cursor: loop that reads next_cursor from the response. A small helper function (15 lines) gives you tweepy-like pagination ergonomics. Sample helper at the bottom of this page in the code block.

Step 5 — Benchmark + cut over. Run the new code alongside tweepy for one full pull. Compare result counts; spot-check tweet IDs for parity. Most migrations match exactly because both APIs read from the same underlying X data. Cut over when parity is confirmed.

10 — Section

When to Stay on Tweepy

The honest case for staying on tweepy in 2026 is narrow but real. Stay on tweepy if all of the following are true: (1) your volume is small enough that $0.005 per post read is an acceptable bill (100,000 reads = $500/month) and stays under the 3M monthly cap; (2) you already have an official developer account with billing set up; (3) you specifically need official-API writes (post creation, like, follow) — TwitterAPI.io is read-focused for most use cases; (4) you depend on tweepy's auto-rate-limit-handling and don't want to maintain pagination code yourself.

Most teams who hit this page do not satisfy all four. The first condition alone eliminates monitoring, analytics-at-scale, news-feed ingestion, and most historical backfills, where the per-read price compounds. For everything else, the migration math is unambiguous — and the code change is small enough that you can keep tweepy as a fallback wrapper if you want.

python
import os
import requests
from typing import Iterator

API_KEY = os.environ["TWITTERAPI_IO_KEY"]
HEADERS = {"X-API-Key": API_KEY}


def search_paginate(query: str, limit: int | None = None) -> Iterator[dict]:
    """Tweepy-Paginator-style helper for /twitter/tweet/advanced_search.
    Drop into existing tweepy code with minimal surface area change.
    """
    count = 0
    cursor = ""
    while True:
        r = requests.get(
            "https://api.twitterapi.io/twitter/tweet/advanced_search",
            headers=HEADERS,
            params={"query": query, "queryType": "Latest", "cursor": cursor},
            timeout=30,
        )
        r.raise_for_status()
        body = r.json()
        for tweet in body["tweets"]:
            yield tweet
            count += 1
            if limit and count >= limit:
                return
        cursor = body.get("next_cursor", "")
        if not cursor:
            return


def user_tweets_paginate(user_name: str, limit: int | None = None) -> Iterator[dict]:
    """Tweepy-Paginator-style helper for /twitter/user/last_tweets."""
    count = 0
    cursor = ""
    while True:
        r = requests.get(
            "https://api.twitterapi.io/twitter/user/last_tweets",
            headers=HEADERS,
            params={"userName": user_name, "cursor": cursor},
            timeout=30,
        )
        r.raise_for_status()
        body = r.json()
        for tweet in body["data"]["tweets"]:
            yield tweet
            count += 1
            if limit and count >= limit:
                return
        cursor = body.get("next_cursor", "")
        if not cursor:
            return


# Migration target — replaces tweepy.Paginator(client.search_recent_tweets, ...)
tweets = list(search_paginate("from:elonmusk", limit=1000))
print(f"fetched {len(tweets)} tweets — bill ~$0.15")

# Migration target — replaces client.get_users_tweets(user_id, ...)
for t in user_tweets_paginate("openai", limit=200):
    print(t["createdAt"], t["text"][:80])

Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.

11 — Questions

Questions readers ask

Is Tweepy still maintained in 2026?

Yes. The tweepy 4.x line is actively maintained on GitHub, with incremental releases adding support for new X v2 endpoints as they appear. The library is healthy; the issue is the API pricing on the other side of it, not the Python code.

Can I use Tweepy on a free X account?

There is no free tier any more: X sells API access pay-per-usage with no subscriptions. New developer accounts get $20 of free credits on a first eligible card (about 4,000 post reads at $0.005), and X matches your first auto-recharge up to $50. Tweepy makes the same API calls regardless; the bill comes from your account, not the library.

Does TwitterAPI.io have a Python SDK?

Yes. pip install -U twitterapi-io installs the Python package; from version 0.2.0 it includes twitterapi_io.compat.TweepyClient, a read-only, tweepy-style client (get_user, get_users_tweets, search_recent_tweets, followers, following, mentions) so existing tweepy read calls keep working after a two-line change (exception classes are imported from twitterapi_io.compat.errors). It is not affiliated with tweepy or X. You can also call the plain HTTP API with requests or httpx and an X-API-Key header.

How much does TwitterAPI.io cost compared to Tweepy on X?

TwitterAPI.io charges $0.00015 per returned tweet ($0.15 per 1,000 tweets, with a 15-credit minimum per request), with no subscription required, no monthly minimum, and no monthly read cap. Tweepy routes to X's pay-per-usage pricing: $0.005 per post read and $0.010 per user read, capped at 3,000,000 post reads per monthly billing cycle (Enterprise above that). That is about 33x more on X: at 1,000,000 post reads a month it is $5,000 versus $150.

How long does a Tweepy to TwitterAPI.io migration take?

A single-purpose script is typically a half-day swap (Steps 1-5 in the checklist above). A multi-file codebase with several different endpoint calls is usually 2-3 days. The migration is mechanical because the data is the same — tweets, users, search results carry the same information, under camelCase field names such as likeCount and createdAt. Most teams keep tweepy in their requirements.txt during the cut-over for parity benchmarking, then remove it once the new pull matches the old one tweet-for-tweet.

Can I use Tweepy and TwitterAPI.io together in the same project?

Yes — and several teams do this for the long tail of API coverage. Common pattern: route all read operations (search, user info, timelines, followers) through TwitterAPI.io for the cost savings; keep tweepy for the handful of write operations (post creation, like, follow) if you prefer to run them through the official API. The two clients don't conflict; they just hit different base URLs.

Does TwitterAPI.io support streaming the way Tweepy supports Filtered Stream?

Yes — through webhooks and websockets. Define a rule via /oapi/tweet_filter/add_rule and matching posts get pushed to your callback URL (webhook) or streamed over a persistent websocket connection. The rule syntax accepts the same advanced-search operators that v2 Filtered Stream uses, so existing tweepy stream rules port over cleanly. No Enterprise agreement and no monthly read cap.

12 — Further reading

Continue

More from this series

Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.

Build it

Stop reading. Start building.

Starter credits cover real testing on real data. Google sign-in, no card, no application queue.

Get an API key

Already building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.