<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: LeanStack</title>
    <description>The latest articles on DEV Community by LeanStack (@leanstack).</description>
    <link>https://dev.to/leanstack</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4186957%2F59b0556e-8bd9-4ef8-9104-1b3b315dd41e.png</url>
      <title>DEV Community: LeanStack</title>
      <link>https://dev.to/leanstack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leanstack"/>
    <language>en</language>
    <item>
      <title>276,814 agent requests in a month for $430 flat (and $0 in per-token API bills)</title>
      <dc:creator>LeanStack</dc:creator>
      <pubDate>Thu, 15 Oct 2026 13:59:02 +0000</pubDate>
      <link>https://dev.to/leanstack/276814-agent-requests-in-a-month-for-430-flat-and-0-in-per-token-api-bills-4nnn</link>
      <guid>https://dev.to/leanstack/276814-agent-requests-in-a-month-for-430-flat-and-0-in-per-token-api-bills-4nnn</guid>
      <description>&lt;h1&gt;
  
  
  276,814 agent requests in a month for $430 flat
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Edited Oct 18: corrected the provider table and figures after reader comments (thanks, arhancanli). By the LeanStack team. Disclosure: we run LeanStack and its free model-testing Lab at goleanstack.com, linked at the end. Every number below comes from our own gateway logs for September 15 to October 15, 2026. We left out anything we couldn't measure.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most "I run agents for $0" posts leave out one of two things: either there's barely any traffic, or the real bill is hidden somewhere. Here's our month with nothing removed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;276,814 model requests&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;9.9B input tokens&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;385M output tokens&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;66 scheduled agent jobs&lt;/strong&gt; running around the clock&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$430/month in flat subscriptions&lt;/strong&gt;, and &lt;strong&gt;$0 in metered per-token API bills&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That $430 is not zero, and we won't pretend it is. But at this volume a pay-per-token setup would be a very different conversation. Below is the setup pattern, the real breakdown, what went wrong, and who this approach is a bad fit for.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern: one gateway, many routes
&lt;/h2&gt;

&lt;p&gt;The most important decision was putting &lt;strong&gt;one local gateway&lt;/strong&gt; in front of our agents' model traffic. Agents and scripts talk to a single local endpoint, and the gateway decides which route each request goes to.&lt;/p&gt;

&lt;p&gt;That gives you four things you can't easily get otherwise:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One log of everything.&lt;/strong&gt; Every request is written to one file, with provider, model, status, duration and token usage (including cached tokens). All the numbers in this article come from that file. Without it we'd be guessing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Routing in one place.&lt;/strong&gt; Agents ask for a model or a route name, and the gateway maps it to a provider. Moving a workload from a paid route to a free one is a single config change, not twenty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fallbacks.&lt;/strong&gt; When a route rate-limits or fails, the gateway can try another candidate. As you'll see below, that matters a lot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost visibility by billing type.&lt;/strong&gt; The log shows which work is covered by flat-rate subscriptions and which runs on free model tiers, and that nothing lands on a metered per-token key. That's how we know the metered API spend is $0.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you take only one thing from this post, take this: &lt;strong&gt;put a gateway in front of your agents before you optimise anything else.&lt;/strong&gt; You can't cut a bill you can't see.&lt;/p&gt;

&lt;h2&gt;
  
  
  Routing by task
&lt;/h2&gt;

&lt;p&gt;Not every agent step needs a frontier model. Our rough rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Heavy reasoning and coding go to the strongest models on flat plans.&lt;/strong&gt; In our month, most of our input tokens went through flat subscriptions (see the split below).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background and scheduled work goes to free or cheap routes.&lt;/strong&gt; Summaries, classification, triage and the long tail of cron-style jobs run on free model tiers wherever the quality holds up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Experiments go to preview and free SKUs&lt;/strong&gt;, with the expectation that they'll be flaky.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's how input tokens actually split across billing types:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Billing type&lt;/th&gt;
&lt;th&gt;Share of input tokens (approx.)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Flat subscriptions (Claude, xAI, Cursor, ChatGPT, Google Antigravity)&lt;/td&gt;
&lt;td&gt;~78%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A $10/mo coding plan&lt;/td&gt;
&lt;td&gt;~11%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Free model tiers (OpenRouter free and preview SKUs, NVIDIA free tier, local free routes)&lt;/td&gt;
&lt;td&gt;~10%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google API key (billing not yet confirmed)&lt;/td&gt;
&lt;td&gt;~2%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And by route (requests / input tokens including cache). This table shows the free and API-key routes only. Subscription-covered usage is left out, so these rows don't add up to the overall totals above:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Requests&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OpenRouter, dedicated free route&lt;/td&gt;
&lt;td&gt;61,705&lt;/td&gt;
&lt;td&gt;488M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenRouter, free and preview&lt;/td&gt;
&lt;td&gt;53,291&lt;/td&gt;
&lt;td&gt;191M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local free routes&lt;/td&gt;
&lt;td&gt;10,132&lt;/td&gt;
&lt;td&gt;182M&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice the mismatch. The free routes carry &lt;strong&gt;lots of requests but a small share of tokens&lt;/strong&gt;: the two OpenRouter routes alone are 114,996 requests. The heavy, context-rich work sits on the flat plans. That's the point. Free tiers absorb volume, and flat plans absorb depth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Caching is doing most of the work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Most of our input tokens were cache reads.&lt;/strong&gt; Agents resend the same system prompt, tool definitions and conversation history on almost every call. If your provider and client support prompt caching, a stable prompt prefix is the cheapest optimisation there is.&lt;/p&gt;

&lt;p&gt;What helped us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep the prefix stable.&lt;/strong&gt; Put the system prompt and tool schemas first and don't reorder them. Put anything that changes (timestamps, run IDs) at the end.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reuse conversations instead of starting over&lt;/strong&gt; for long-running agents, where the client supports it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch cached tokens per route.&lt;/strong&gt; Some routes in our logs report zero cached tokens, either because caching isn't reported there or because it isn't happening. The gateway log is how you find out which.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Flat plans plus free tiers, and the actual bill
&lt;/h2&gt;

&lt;p&gt;Our real monthly cost:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude plan: $200&lt;/li&gt;
&lt;li&gt;Cursor plan: $200&lt;/li&gt;
&lt;li&gt;ChatGPT plan: $20&lt;/li&gt;
&lt;li&gt;Coding plan: $10&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total: $430/month flat&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Metered per-token API spend: &lt;strong&gt;$0&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The site that sells this playbook runs on a free hosting tier with a free Redis for signups, so hosting adds nothing either.&lt;/p&gt;

&lt;p&gt;The honest caveat: this works because flat plans let you use a lot within their limits. &lt;strong&gt;Those limits are real&lt;/strong&gt;, which brings us to what didn't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spend caps and guardrails
&lt;/h2&gt;

&lt;p&gt;With flat plans the risk isn't a surprise invoice. It's burning through your quota or getting throttled mid-task. With any metered key in the mix, the risk is a runaway loop overnight. Either way, the guardrails are the same:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;per-agent daily budget&lt;/strong&gt; (requests or tokens) that hard-stops the agent rather than just warning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allow-listed routes per agent.&lt;/strong&gt; A background job should not be able to escalate itself to your most expensive model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No metered key as a silent fallback.&lt;/strong&gt; If a free route fails, fall back to another free or flat route, or fail loudly. Never quietly spill onto pay-per-token.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What didn't work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A lot of our requests failed.&lt;/strong&gt; Among the failures were &lt;strong&gt;22,111 rate limits (HTTP 429)&lt;/strong&gt;. The rest were a mix of not-found errors (often models that were renamed or retired), upstream 5xx errors, bad requests and client disconnects.&lt;/p&gt;

&lt;p&gt;Free and preview routes were the worst offenders. Some free routes in our logs succeeded well under half the time. Lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free tiers are unreliable by design.&lt;/strong&gt; Budget for retries and fallbacks from day one, and don't put anything user-facing on a single free route.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model names churn.&lt;/strong&gt; Preview and stealth models appear and disappear. Many of our 404s came from routes pointing at models that no longer existed. Review your routing table regularly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate limits shape everything.&lt;/strong&gt; Spreading load across routes and providers is what keeps a high-volume setup alive. One free route won't carry 66 scheduled jobs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A log is the only way you'll know.&lt;/strong&gt; Without per-request status logging, a big chunk of your agent work silently failing just looks like "the agents are a bit flaky."&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Who this does NOT fit
&lt;/h2&gt;

&lt;p&gt;Be honest with yourself before copying this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Low volume.&lt;/strong&gt; If you make a few hundred calls a month, pay-as-you-go is almost certainly cheaper than $430 in plans. This only makes sense at heavy volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production, customer-facing workloads.&lt;/strong&gt; Flat-rate plans and free tiers come with their own terms of service, rate limits and no SLA. If your customers depend on it, use proper API contracts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Teams and compliance needs.&lt;/strong&gt; Personal plans are personal. If you need data processing agreements, audit trails or shared billing, this isn't your setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anyone who wants zero maintenance.&lt;/strong&gt; Routing tables, retired models, quota juggling and fallbacks take ongoing attention.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next: we test the free routes in public
&lt;/h2&gt;

&lt;p&gt;Because so much of our volume rides on free and preview models, we started testing them on a fixed suite and publishing the raw results. That's the LeanStack Drop Lab, which we run.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Drop #1, free model baselines:&lt;/strong&gt; &lt;a href="https://goleanstack.com/drops/drop-1-free-model-baselines" rel="noopener noreferrer"&gt;https://goleanstack.com/drops/drop-1-free-model-baselines&lt;/a&gt;. Instruction-following, calibration and reasoning tests on three seeds, with per-seed scores, timeouts and hard fails shown as they happened, plus the raw run JSON.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All drops:&lt;/strong&gt; &lt;a href="https://goleanstack.com/drops" rel="noopener noreferrer"&gt;https://goleanstack.com/drops&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want the full setup, the &lt;strong&gt;LeanStack playbook&lt;/strong&gt; is $19 in early access and ships on 1 Nov: &lt;a href="https://conchcraft.gumroad.com/l/gpqcdc" rel="noopener noreferrer"&gt;https://conchcraft.gumroad.com/l/gpqcdc&lt;/a&gt;. If you'd rather have your own agent bill reviewed, there's a $490 Agent Bill Audit: &lt;a href="https://conchcraft.gumroad.com/l/ohfxlq" rel="noopener noreferrer"&gt;https://conchcraft.gumroad.com/l/ohfxlq&lt;/a&gt;. Everything else lives at &lt;a href="https://goleanstack.com" rel="noopener noreferrer"&gt;https://goleanstack.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Rows from different harnesses are marked as not directly comparable, and we say so on the page. If you have questions about any of the numbers above, ask in the comments. We'll answer with whatever the logs show.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>agents</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
