Preparing today's journal

Please wait a moment.

Back to stories

I Capped My AI Costs

I looked at where AI charges come from and how to stop them before a small mistake becomes an expensive loop.

Read like a book
Normal
A developer at a morning desk holding a long receipt in one hand while looking at a budget slider

Topic

AI & Technology

I Capped My AI Costs

I looked at where AI charges come from and how to stop them before a small mistake becomes an expensive loop.

Summary

Summary

  1. AI Gateway is a single doorway for viewing and managing requests sent to different AI models.
  2. Seeing usage is useful, but setting a spending limit for each API key is safer.
  3. Before choosing a model, decide whether cost, response time, or throughput matters most for the job.
12Page
A developer at a morning desk holding a long receipt in one hand while looking at a budget slider

Summary

At a glance

  • AI Gateway is a single doorway for viewing and managing requests sent to different AI models.
  • Seeing usage is useful, but setting a spending limit for each API key is safer.
  • Before choosing a model, decide whether cost, response time, or throughput matters most for the job.

I was about to give AI one more job when I thought about the bill. A single request looks cheap. An automated task repeating the same mistake all night does not.

So I went back to Vercel’s official announcements. The simplest way I can explain AI Gateway is a single doorway for viewing and managing requests sent to different AI models. I found four things worth keeping.

See where the money went

Vercel’s AI Gateway launch announcement says it can show cost and usage, and move a request to another provider when one fails.

A receipt does not save money by itself. It does show which request ran long, how many tokens it used, and where the bill grew. That is more useful than my usual diagnosis: “This month feels expensive.”

Set the limit before the mistake

Budgets for API keys let me set a spending cap and a refresh period for each key. Once the cap is used, requests stop.

This matters more to me than a neat month-end report. A report tells me the money is gone. A cap can stop a bad loop while the mistake is still small. Automated work is dangerous less because it fails once and more because it can fail very patiently.

Choose a rule, not a favorite

Provider sorting can rank providers by cost, time to first response, or throughput. The cheapest choice is not always the right one. A draft may favor cost, a chat may need a quick response, and a long task may need higher throughput.

Routing rules can replace or deny selected model requests without changing the app’s code. That makes model changes easier, but it does not make a replacement automatically good. I still need to check quality, speed, and cost.

Three scenes I rehearsed

These are imaginary examples, not real incidents.

  • An agent summarizes its own summary again and again. The answer gets shorter while the receipt turns into a paper roll. The budget cap finally presses stop.
  • The fastest provider wins in the morning and the cheapest one wins after lunch. I do not need to change fan clubs. I only need a clear rule for the job.
  • Old code keeps calling a retired model. A routing rule sends tested work to a replacement, or rejects it clearly when I am not ready.

My order is now simple:

  1. Make request counts and costs visible.
  2. Split keys by job and set limits I can afford.
  3. Pick one main rule: cost, response time, or throughput.
  4. Test representative work again after changing models.

Before I give AI another job, I will set the card limit. It may sound cautious, but cautious systems tend to last longer.

Continue reading

Previous story · Next story

Previous storyAs automation got cheaper and faster, I checked where it could still stopNext story Big Work Needs Seams