OpenRouter, and keeping your costs sane.
Chapter two was about you talking to an AI. This chapter is about the things you build talking to an AI — automatically, thousands of times, while you sleep. That's where the money goes if you're not careful, and it's entirely avoidable.
What OpenRouter is
OpenRouter is one account and one API key that reaches every major AI model — Claude, Gemini, GPT, Llama, DeepSeek, dozens more — through a single bill. Instead of signing up with five vendors, wrangling five keys and five invoices, you top up one balance and pick whichever model you want, per request, by changing one word in your code.
Two reasons this matters, and the second is the real one.
- You can use a cheap model for cheap work. Most of what your automations do is boring: sort this into a category, pull the date out of this email, write a two-line summary. Paying a frontier model to do that is like hiring a surgeon to open your mail. A small fast model does it just as well for a fraction of the cost.
- You can have several models check each other. This is the trick that took me longest to find. Have one model write the thing, then hand it to a different model and ask it to find the flaws. Different models fail differently, so one catches what the other missed. The quality gain is real, and it's larger than the gain from just buying the biggest model and trusting it.
I have a standing rule for my own business: no paid APIs, ever. No paid scrapers, no data vendors, no $200/month enrichment tools. Build it in-house or don't build it. OpenRouter is the single exception I've carved out, because AI models are the one thing you genuinely cannot self-host at quality. Everything else in this guide is free.
Getting started
- Sign up at openrouter.ai and add ten dollars. Not a hundred. Ten.
- Go to Keys and create a key. It looks like
sk-or-v1-.... - Put it in a file called
.envon your server — never inside the code itself, and never in git. - Ask your agent: "wire this project up to OpenRouter using the key in .env, and default to a cheap model."
Ten dollars will last you a shockingly long time if you follow the next two sections, and if it doesn't, you've learned something important for ten dollars.
Rule one: cascade. Cheap first, expensive only when earned.
Don't pick "the best model" and use it everywhere. Match the model to the job. My standing rule, which lives in my CLAUDE.md so I never have to repeat it:
- Start with a cheap, fast model for anything routine — classifying, extracting, summarizing, first drafts, tidying data. These handle the overwhelming majority of real work.
- Step up to a mid-tier model when the cheap one gets it wrong twice in a row. That's your signal, not a hunch.
- Reserve the frontier model for the hard reasoning: architecture decisions, gnarly debugging, anything where being wrong is expensive.
To make that concrete, here's what the Claude family costs. Prices are per million tokens — a token is roughly three-quarters of a word — split into what you send in and what it writes back out. Output is where the money is, always.
| Model | Input / 1M | Output / 1M | Use it for |
|---|---|---|---|
| Haiku 4.5 | $1.00 | $5.00 | The workhorse. Classify, extract, summarize, sort. Most of your volume. |
| Sonnet 5 | $3.00 | $15.00 | The balanced middle. Real writing, real code, most agent work. |
| Opus 4.8 | $5.00 | $25.00 | Hard reasoning, long autonomous jobs, when being right matters. |
| Fable 5 | $10.00 | $50.00 | The absolute ceiling. Reach for it deliberately, not by default. |
Look at the spread: the top model costs ten times the cheap one on output. If you run everything through the expensive one out of laziness, you are lighting money on fire for no measurable gain on the easy 80% of your work. OpenRouter also carries very inexpensive models from other vendors — check the live prices on their models page, because they change often — and those are frequently the right choice for high-volume grunt work.
Cheap model first. If it fails twice, step up. Never default to the expensive one just because it's there. This one habit is the difference between a $15 month and a $400 month, and I have had both.
Rule two: one key per project
This is the single most useful cost-control move and almost nobody does it. Create a separate OpenRouter API key for every project. Not one key for everything. One per thing.
Why it matters: with one shared key, your dashboard shows a single number going up and you have no idea which project is responsible. You feel vaguely anxious about the bill and do nothing, because you can't act on a number you can't attribute. With one key per project, the dashboard shows you exactly which thing is eating the money — and now you can fix it, because you know where to look.
OpenRouter lets you set a spending limit on each individual key. This is the part that turns anxiety into a solved problem:
- Name each key after the project.
podcast-pipeline,lead-scorer,website-chat. - Give each one a monthly limit slightly above what you expect it to cost.
- When a key hits its limit, that project stops and nothing else is affected.
Now a runaway loop in one experiment burns twenty dollars and stops, instead of quietly draining your whole balance overnight. That is not a hypothetical. That is the thing that happens to everybody once, and the key limit is why it only happens once.
Rule three: watch it for the first week, then stop worrying
When you build something new that calls a model, check the OpenRouter dashboard once a day for the first week. You're looking for one thing: is the shape of the spending what I expected? A pipeline you thought would cost pennies a day and is costing four dollars a day has a bug in it — usually it's being called far more often than you think, or you're sending it enormous amounts of unnecessary text every single time.
Two things that quietly cost more than people expect:
- Sending the whole conversation history on every call. Costs grow with every turn. If a chat feature gets expensive fast, this is almost always why.
- Retry loops with no ceiling. Something fails, it retries, it fails, it retries. Always cap the retries. Always.
After that first week, if the shape is right, stop watching. The key limit is your safety net. That's what it's for.
Where the real cost is, though
Honestly? For most people reading this, your AI bill is going to be small — twenty or thirty dollars a month, less than one SaaS subscription. The money you're actually bleeding is somewhere else entirely, and that's the next chapter.