How I Cut My LLM API Bills by 40% (And Built a Free Cost Calculator)
Description and use
The author built an LLM cost calculator and a task routing strategy, cutting API bills by 40 % and simplifying multi-model management.
Problem
Cost observability was a nightmare; monthly bills changed unpredictably due to varying pricing models across providers.
Outcome
Implemented cost calculator and routing strategy cut LLM API bills by ~40% and streamlined multi-model management.
Workflow
- Build a frontend-only cost calculator to quantify token costs per model.
- Define a tiered routing strategy: Tier 1 for high-cost, high-intelligence tasks; Tier 2 for balanced tasks; Tier 3 for low-cost, high-speed tasks.
- Apply routing logic to direct 70% of agent calls to cheaper models, escalating to Claude only when confidence is low.
- Move to an API aggregator gateway to unify endpoints, handle failover, and simplify key management.
Evidence
Every time I tweaked the routing logic, my monthly bill changed in ways I couldn't predict.
By routing the "dumb" tasks (which make up 70% of my agent's calls) to cheaper models, and only escalating to Claude when confidence is low, my bills dropped by nearly 40%.
Using a unified endpoint means I just send one OpenAI-compatible request, and the gateway handles the routing and automatic failover.
- Record date: 2026-11-01T16:58:44.232Z