$20 a Month, Hard Cap: My Side-Project AI Bill
01 / The $19.40 receipt that made me stop guessing
My side project is a small tool that turns a git log into short release notes. It runs in about forty seconds and it costs real money every time I press enter. For three months I told myself the cost was tiny. Then I added the receipts: $6.10 in month one, $11.85 in month two, and $19.40 in month three. Nothing about the tool had changed. What changed was me. I ran it more often, I pasted longer logs, and I tested prompt variants without counting. The bill drifted upward without a single decision to spend more.
The fix was not a clever prompt. It was a hard monthly ceiling of $20, written down before I wrote another line of code. This is the walkthrough I wish I had at the start: how to pick a cap, how to measure your way under it, and what to do when you are about to hit it on day 22. I keep the project on CheapRelay, a pay-as-you-go AI relay, because billing is per real token with no monthly fee and no subscription. That matters a lot when your entire budget is one small number. A quiet month costs nothing, and an active month costs exactly what you used.
These are my figures from one tiny project. Treat them as a worked example, not as a benchmark for your own workload.
02 / Draw the $20 line before you write any code
A cap only works when it is a number you can defend out loud. I picked $20 because it is less than one takeaway meal a week, and because losing it would sting without making me abandon the project. Your number will differ. What does not differ is the need to write three things down first: the monthly ceiling, the per-run ceiling, and the exact moment you stop.
Decide what hard means. For me it means that when the running total reaches $20, the app refuses to call the API for the rest of the month. Not be careful. Not try to stay under. Stop. Anything softer turned into negotiation at 11pm on a Tuesday.
Split the $20 into buckets so one busy week cannot eat the whole month:
- ■ $14 for normal runs, which is about 90 runs at my current $0.15 average.
- ■ $4 for one-off experiments, prompt tests and rewrites of bad output.
- ■ $2 in reserve for the bad day when a retry loop spins and you need room to notice it.
Why not $5? Because below roughly $10 I rationed so hard that I stopped testing, and the project quietly died twice. The ceiling should be small enough that losing it stings, and large enough that you can still finish a month of real work. I also put the ceiling in a config file rather than my memory, because memory is where budgets go to fail.
03 / Measure one run down to the token before you scale anything
CheapRelay bills per real token, including cache reads and cache writes. That detail changes the math: a cached prompt is cheaper, but it is not free. So read the usage block that comes back with every response and log four numbers: input tokens, cache write tokens, cache read tokens, and output tokens. Then multiply each by the per-token price shown on the relay model list for the model you chose. Do not eyeball it. Use the usage object the API returns.
My first measured run had a 1,240-token prompt made of a long git log plus static instructions, with about 900 tokens of that repeated on every call and therefore cacheable after the first one, and 310 tokens of output. That run cost roughly $0.15 before I trimmed anything. One number turned a vague worry into arithmetic: $0.15 multiplied by 120 runs is $18, which fits inside $20 with $2 to spare. Before that measurement I had no idea whether my month supported 20 runs or 200.
Do a two-dollar dry run before you commit to any design:
- ■ Run the tool ten times on real inputs and record every usage block.
- ■ Add the ten totals and divide by ten to get your true average cost per run.
- ■ Divide your monthly run bucket by that average to get your allowed number of runs per month.
- ■ Write that run limit next to the money limit, because runs are what you actually make decisions about.
That dry run is the whole method. Ten real runs cost me about $1.50 and saved me from building a batch feature I could never have afforded to use.
04 / Trim the input until the arithmetic finally fits
The cheapest token is the one you never send. Once I had the $0.15 figure, the obvious target was to get a run under $0.10, which would raise my monthly allowance from 130 runs to 200 inside the $14 bucket. Four changes did it.
- ■ Cut the log window from 500 commits to the last 40. My prompt dropped from 1,240 tokens to 430.
- ■ Keep the static instructions in a stable prefix so the relay can cache them. Cache reads and writes still bill, but one small cache write beats resending the whole block on every call.
- ■ Cap output with a hard max_tokens value. I use 320. Notes longer than that were filler anyway.
- ■ Use a small model for the routine pass. Claude Haiku 4.5 handles the ordinary rewrite for me, and I only escalate to a larger model on the rare gnarly log.
After those four changes the same job costs me about $0.06 a run, so the identical $14 bucket now covers roughly 230 runs instead of 90. I did not change providers, hunt for a discount, or negotiate anything. I just stopped sending tokens that carried no information.
One warning from experience: do not jump to a bigger model to fix a prompt problem. When my output was sloppy I was tempted to escalate, and the run cost went from $0.06 to several times that immediately. Tightening the instructions and shortening the log was free.
05 / The three thresholds that stop a runaway day
Budgets fail late in the month, when you are tired and one more run feels harmless. My tool stores a running total in a small JSON file after every call, then compares it to the $20 ceiling. Three levels are enough:
- ■ At 80 percent, or $16, print a warning and switch to the shorter prompt variant by default.
- ■ At 95 percent, or $19, allow one run per day and block batch runs entirely.
- ■ At 100 percent, or $20, return a plain message that the monthly cap is reached and do not call the API at all.
The 80 percent warning matters more than the hard stop, because it gives you a week to decide what deserves the remaining $4. Twice it told me to finish my prompt work early instead of discovering the wall on the last day. If you use a CLI such as Claude Code, Codex or Gemini CLI, or any OpenAI SDK, the same pattern works: wrap your client in one function that checks the total, logs the usage, and refuses to spend past the line.
06 / The three numbers I check every Sunday
The cap only stays honest if I look at it. Five minutes on Sunday, three numbers:
- ■ Monthly spend so far, compared with the day of the month, so $10 on day 10 is fine and $10 on day 25 is not.
- ■ Average cost per run, which tells me whether a prompt change helped or hurt.
- ■ Cache read tokens as a share of input tokens, which shows whether my stable prefix is actually being reused.
My last four months came in at $20.00, $17.35, $20.00 and $14.80. Two months hit the ceiling on purpose, which is the point: the ceiling is a decision, not an accident. Nothing broke, nothing got cancelled, and the project kept shipping.
If you want to run the same experiment, sign up at CheapRelay, point your OpenAI-compatible code at https://api.cheapapirelay.com/v1 with the Gemini native routes under /v1beta, and set your own hard ceiling before your first call. There is no monthly fee, so the only number that matters is the one you decided on before you started.
Sign up Try the prices yourself, sign-up credit included.
More reading
| Date | Aisle | Written in | Title |
|---|---|---|---|
| 2026-10-30 | Cheap how-tos | EN | $3 a Month Bought Our Team a Prompt Style Guide A beginner walkthrough for writing a team prompt style guide on a $3 monthly budget: templates, token math, tests and a weekly review. |
| 2026-10-30 | Cheap how-tos | EN | Trim Prompt Cost from $12.40 to $1.40 a Week A beginner walkthrough for cutting user data out of prompts, with worked token math that turns a $12.40 week into $1.40. |
| 2026-10-30 | Cheap how-tos | EN | A $10 Test Budget for Judging AI Output A beginner walkthrough for judging AI output quality with a spreadsheet, a rubric and a $10 budget. |
| 2026-10-30 | Cheap how-tos | EN | $3.80 a Month After Dropping the Free Tiers A beginner walkthrough for moving a hobby project from free AI tiers to pay-as-you-go on a five-dollar monthly budget. |
| 2026-10-30 | Cheap how-tos | EN | A $2.17 Receipt for My Personal Knowledge Chatbot A beginner walkthrough: 46 documents, 240 chunks, 1.42M tokens, one $2.17 monthly receipt. No subscription, no vector database, no fixed cost. |
| 2026-10-30 | Cheap how-tos | EN | 307 Flashcards for About $1.20 in Tokens A budget walkthrough: extract a textbook chapter, chunk it, prompt a cheap LLM, and export 307 flashcards for roughly $1.20 in tokens. |