Skip to content

That's just a taste — their profile full of gems!

Visit profile
User avatar
Stephen Williams
July 18877

AI token bills need engineering, not vibes

I’m seeing more teams hit the same wall: their AI usage grows faster than the value they’re getting from it.

Not because the models are bad. Not because “AI is too expensive.” Usually because nobody designed for cost once the prototype started working.

And yes, the free ride is over. Between usage-based pricing, agentic tools that keep resending long transcripts, and teams defaulting to premium models for everything, token spend can get ugly fast.

What I liked here is that the answer isn’t some hand-wavy “governance framework.” It’s mostly solid engineering hygiene.

A few points I strongly agree with:

Prompt caching is the first thing I’d check.
If you have stable system prompts, tool definitions, schemas, or other repeated prefix content, and you’re not structuring requests to maximize cache hits, you’re just donating margin to your provider. This is one of those rare optimizations that’s both high-impact and pretty unglamorous.

Context hygiene matters more than people think.
A lot of coding workflows are quietly burning money because context just keeps growing. Long-running sessions feel productive, but they’re often quadratic-cost traps. Clear context when switching tasks. Compress when possible. Stop carrying giant rules files and stale transcript baggage into every turn.

Batching is underused.
If the workload can wait, it should probably be batched. Evaluations, offline enrichment, nightly analysis, background classification—there’s no reason to pay real-time prices for async work. I still see teams architect everything like every request is latency-sensitive. It isn’t.

Structured outputs are also cost controls.
People talk about JSON schemas like they’re just a reliability feature. They’re not. They also cut out a lot of verbose model filler and reduce retries from malformed outputs. Less rambling, fewer retries, lower bill.

The bigger idea, though, is model routing.

Too many teams still have a one-model strategy, which is really a no-strategy strategy. If you’re using your most expensive model for formatting, lightweight extraction, basic classification, and routine coding help, you’ve already lost. Expensive reasoning models should be reserved for the work that actually needs them.

The same goes for open-weight models. I’m broadly in favor of using them where they fit, but I also appreciate the caveat: cheap inference on paper is not the same thing as low total cost in production. Once you include GPUs, ops overhead, reliability, and on-call burden, managed APIs often still win until you’re at serious scale.

Another point that deserves more attention: observability.

You can’t optimize what you can’t attribute.

If you don’t know cost by feature, user, workflow, or model path, then every conversation about AI spend turns into theater. You need enough visibility to answer very boring but very important questions:

Which features are actually expensive?
Where are cache hit rates bad?
Who is routing simple tasks to premium models?
Which agent flows are exploding context length?

That’s the difference between “we should control AI spend” and actually controlling it.

The compounding effect is also real. This isn’t about finding one silver bullet. It’s stacking practical moves:

prompt caching + context cleanup + batch APIs + structured outputs + semantic caching + model routing

That’s how teams get to meaningful savings without tanking quality.

My main takeaway is simple: AI cost optimization is becoming a core engineering discipline. Not a finance afterthought. Not a slide in an “AI strategy” deck. Actual implementation work.

If I were reviewing an AI team right now, I wouldn’t just ask what models they use. I’d ask:

  • how they manage context growth
  • whether they’re getting cache hits
  • what percent of traffic can be batched
  • how routing decisions are made
  • whether they can attribute spend to product behavior

Because the teams that win here won’t necessarily be the ones with the biggest model budget.

They’ll be the ones that treat tokens like a production resource instead of a magical infinite one.

Curious what others are seeing: where is your AI spend actually leaking right now—context bloat, bad routing, retries, or just too much premium model usage?

#softwareengineering#ai#costoptimization#promptengineering#llm#developers#enterprisetech#aiengineering#finops#aiproduct
Like
Dislike

97

32

Add a comment...