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 key management.
Problem
Cost observability is a nightmare when using multiple LLM providers with different pricing models, leading to unpredictable monthly bills.
Outcome
By quantifying costs and routing tasks to appropriate models, the author cut LLM API bills by nearly 40% and streamlined key management.
Workflow
- Build a frontend-only cost calculator to quantify token costs per model.
- Define a task routing strategy with three tiers: high-cost/high-intelligence, balanced, and low-cost/high-speed models.
- Apply routing logic to send 70% of tasks to cheaper models and only use expensive models when confidence is low.
- Unify API endpoints with an aggregator gateway to manage keys, dashboards, and failover.
- Use the calculator to estimate savings before changing routing logic.
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-01T18:59:09.429Z