Quick and dirty Twitter API pricing analysis for Thresholderbot
Twitter's new API pricing starts at $5,000 per month to read 1 million tweets per month. According to our metrics, Thresholderbot read more than 15 million tweets per month on average over the last 12 full months of activity — and that estimate may be far too low if retweets are counted as 2 reads.
Our implementation fetches each Thresholderbot user's "reverse chronological" timeline every ~90 seconds. That's one Twitter API request per user per 90 second interval1, but each one of those API requests may return 0 or more individual tweets (depending on how many accounts each user follows, how frequently those accounts tweet, etc).
According to the Twitter API "Tweet Caps" documentation, if a single API request returns 100 tweets from a user's timeline, that would count as 100 reads against the allowance. For bonus points, every retweet returned in a user's timeline counts as two reads according to this forum post.
Given that 2x penalty for retweets2, the 15M tweets per month reported above is actually much lower than what we'd be charged for if we paid for API access, because a significant proportion of tweets in the average user's timeline are retweets.
For the record, Thresholderbot costs about $230/month to run, depending on the number of emails sent in each month. That cost breaks down like so:
Service | Cost per month | Notes |
---|---|---|
AWS (Amazon Web Services) | $200 | Infrastructure provider (EC2, RDS, S3) |
Mailgun | $12-20 | Outbound email to users (35,000 – 45,000 per month) |
$12 | G Suite for @thresholderbot.com email accounts |
Our AWS spend in particular could be optimized by simplifying Thresholderbot's hilariously over-engineered, overly complex codebase and architecture, but … that effort would be wasted now!
Footnotes
-
Note: that 90s interval was specifically chosen to stay well under the rate limits for that API endpoint to make sure we're not abusing Twitter's systems! ↩
-
On a technical level, I understand why they would charge 2x views for each retweet, since each retweet is literally returned as two tweets in a trenchcoat. ↩