DEV Community

Henry Godnick
Henry Godnick

Posted on

What I Learned After 6 Months of Obsessively Tracking My AI Costs

Six months ago I started keeping a spreadsheet of every dollar I spent on AI APIs. It started as a practical thing — I'd just gotten a bill I didn't expect and wanted to understand where the money was going. What I ended up learning surprised me, and not in the ways I expected.

The surprise wasn't the total

I expected to find out I was spending too much. That wasn't the reveal.

The reveal was when I was spending it. Most of my AI API costs clustered into two distinct patterns: late nights when I was tired and letting the AI do more of the thinking for me, and early mornings right after I woke up and started a new session with a massive context window I hadn't bothered to trim.

The money followed my bad habits. Not my good work.

The context window tax

Here's something nobody told me: the longer your conversation, the more every subsequent message costs. It compounds.

I had a session with Claude that started as a quick sanity check on some Swift code. Three hours later I was still in the same session, the context was enormous, and every back-and-forth was costing me significantly more than those same messages would have cost fresh.

I was paying a "lazy developer tax" without knowing it existed.

What I actually built

After about two months of spreadsheet-tracking, I got annoyed enough to build something. I wanted to see my costs in real time — not in a dashboard I'd have to open, but right there in my face while I was working.

That turned into TokenBar, a macOS menu bar app that shows your live token usage and cost as you work. It sits in your menu bar like a gas gauge. You glance up, you see the number, you make a decision.

It sounds simple. It changed how I code.

The behavioral shift

Once I could see the number in real time, I started doing things differently:

I started summarizing before continuing. Instead of carrying a 20,000-token context forward, I'd ask the AI to summarize key decisions and start fresh. Same output, a third of the cost.

I got more specific in my prompts. Vague prompts generate long responses which generate high costs. "Refactor this function" became "refactor this function to reduce nesting, keep the same interface, don't explain why."

I stopped treating AI as a rubber duck. I used to think out loud through the AI. Turns out I can think out loud to myself for free.

The number that surprised me most

After six months of tracking, I ran the full analysis. My most expensive day wasn't a day I was building something new. It was a day I was debugging a problem that, in retrospect, I could have solved by reading the docs.

I'd burned through roughly $18 in a single afternoon because I kept asking the AI "why isn't this working" instead of just reading the error message properly.

$18 is nothing. But it represents about 3 hours of lazy troubleshooting I could have done in 20 minutes.

What I'd tell myself at month zero

AI APIs aren't expensive if you're intentional. They're wildly expensive if you're not.

Get something in your face — literally in your menu bar or your IDE — that shows you the number as it grows. It changes your behavior the same way a calorie counter changes your eating. Not because you become paranoid, but because you become aware.

That's it. Awareness is the whole thing.

If you're curious, TokenBar is what I built for this. Five bucks, lifetime. It pays for itself the first time it stops you from an $18 afternoon.

Top comments (0)