When we first put Swrly's PR review workflow into production, it cost roughly $4.20 per review. That sounds fine until you realize a mid-sized engineering team opens 200–300 PRs a month. That is $840–$1,260 a month for one workflow. We had four more like it in the queue.
We did not have a scale problem. We had a cost architecture problem.
Three months later, after applying the patterns below, the same PR review workflow costs $0.38 per run — a reduction of just over 90%. Quality is objectively better. Speed is higher. We learned most of this the hard way, which means you do not have to.
Here is what actually moves the needle on AI agent costs.
The Real Sources of Cost
Before you can cut costs, you need to know where they come from. For most agent pipelines, the breakdown looks like this:
- Model selection — using Opus for every step, including ones that do not require it, is the single largest source of overspend. It accounts for 40–60% of total token cost in unoptimized pipelines.
- Context bloat — most pipelines pass the full upstream context to every downstream step. In practice, 60–70% of those tokens are irrelevant to what the current step needs to do.
- Retry loops — when an agent fails and retries with the same full context, you pay for the failed attempt in full. Three retries with 4,000-token context costs 4x the tokens of one successful call. No guardrails means this compounds quietly.
- Platform markup — some platforms charge per-token fees on top of your LLM provider bill. These markups range from 2x to 5x the raw inference cost. They are rarely disclosed clearly on pricing pages.
Most teams try to fix costs by switching to cheaper models across the board. That is the wrong instinct — you end up degrading quality on steps that actually need reasoning power and saving almost nothing on the steps that do not.
The right approach is targeted: fix the architecture, not just the model selection.
Pattern 1: BYOK — Eliminate the Platform Markup First
This one change can reduce your total AI spend by 50–80% before you touch a single workflow.
Most AI agent platforms bundle orchestration and inference into one bill. They act as a pass-through to your LLM provider, add a markup, and call it "credits" or "compute units." The math is rarely transparent. What looks like a $49/month plan ends up costing $300+ once token charges are applied.
BYOK (bring your own key) routes inference directly from the platform to your LLM provider. There is no intermediary markup. A call that costs $0.015 on the Anthropic API costs $0.015 in your Swrly workflow — not $0.045 after a 3x platform markup.
The compounding effect matters here. If you run 1,000 agent executions per month and each uses an average of 5,000 tokens:
| Billing model | Token cost per 1M tokens | Monthly token cost |
|
Top comments (0)