<?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: Leanroute</title>
    <description>The latest articles on DEV Community by Leanroute (@lean_route_b7b5a963c28c97).</description>
    <link>https://dev.to/lean_route_b7b5a963c28c97</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%2F4059795%2Fe9755dfd-4880-40e2-85fc-7da2606d4cec.png</url>
      <title>DEV Community: Leanroute</title>
      <link>https://dev.to/lean_route_b7b5a963c28c97</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lean_route_b7b5a963c28c97"/>
    <language>en</language>
    <item>
      <title>Announcing opa-sidecar-a2a: A Reference Implementation for Chain-Aware Agent Authorization</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Tue, 15 Sep 2026 14:26:03 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/announcing-opa-sidecar-a2a-a-reference-implementation-for-chain-aware-agent-authorization-12fj</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/announcing-opa-sidecar-a2a-a-reference-implementation-for-chain-aware-agent-authorization-12fj</guid>
      <description>&lt;h1&gt;
  
  
  Announcing opa-sidecar-a2a: A Reference Implementation for Chain-Aware Agent Authorization
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We just open-sourced &lt;a href="https://github.com/leanroute/opa-sidecar-a2a" rel="noopener noreferrer"&gt;opa-sidecar-a2a&lt;/a&gt;, a reference implementation of chain-aware authorization for agent-to-agent (A2A) traffic. It runs as a single Go binary alongside your agent or gateway, evaluates delegation chains against Rego policies, and returns allow/deny with obligations. MIT licensed, no product to buy, no vendor lock-in. This post explains why we built it, what it actually does, and how it fits into a broader story about the emerging A2A authorization gap.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The problem we kept seeing
&lt;/h2&gt;

&lt;p&gt;Every A2A implementation shipping to production today ends up in one of two spots on authorization, both wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spot one: API-key trust.&lt;/strong&gt; Agent B trusts agent A because agent A holds a valid API key. This tells B nothing about whether A is authorized to call B on behalf of the specific user or workflow that originated the request. A compromised or misbehaving agent can call anywhere its key allows, and the callee has no way to know whether the request actually originated with a user who granted this specific action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spot two: bearer-token pass-through.&lt;/strong&gt; Agent A forwards the user's original bearer token to agent B. B checks it, and if it's valid, allows. This assumes agent A is trusted enough to hold the user's credentials and eliminates the ability to distinguish "the user allowed A to do X" from "A decided to do X on the user's behalf without telling them."&lt;/p&gt;

&lt;p&gt;Neither model survives contact with a real delegation chain. Think about how a typical planner-executor pattern looks: user delegates to planner, planner delegates to executor, executor invokes a tool, tool calls a downstream API. Four hops, four different trust relationships. API-key trust collapses them all into "does the caller hold a valid key." Bearer-token pass-through collapses them all into "does the caller have the user's token."&lt;/p&gt;

&lt;p&gt;What actually happens in a real delegation is more like: user grants planner permission to &lt;code&gt;book_flight&lt;/code&gt;. Planner grants executor permission to &lt;code&gt;invoke_tool:flight_booking_v1&lt;/code&gt;. Executor calls the tool. At each hop the grant is narrower than the previous one, and the callee should be able to verify the whole chain before allowing.&lt;/p&gt;

&lt;p&gt;That's chain-aware authorization. And nothing in the OSS ecosystem was implementing it in a way we could point at.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we built
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/leanroute/opa-sidecar-a2a" rel="noopener noreferrer"&gt;opa-sidecar-a2a&lt;/a&gt; is a single Go binary that runs alongside an agent or a gateway. It exposes one production endpoint (&lt;code&gt;POST /authorize&lt;/code&gt;), takes a delegation chain and a proposed action as input, and returns allow/deny plus obligations.&lt;/p&gt;

&lt;p&gt;The moving parts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Signature verification.&lt;/strong&gt; Every grant in the chain carries an ed25519 signature from its issuer. The sidecar verifies each signature against a trust dir of public keys before the policy sees the input. If any signature fails, the grant is marked &lt;code&gt;sig_verified: false&lt;/code&gt; and the reference policy denies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chain linking.&lt;/strong&gt; Adjacent hops must link: grant N+1's issuer must equal grant N's subject. The user grants to planner, planner grants to executor, executor is the caller. Any break in that chain is a deny.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope matching.&lt;/strong&gt; The chain must cover the action being attempted. If the user granted &lt;code&gt;book_flight&lt;/code&gt; but the caller attempts &lt;code&gt;send_email&lt;/code&gt;, the chain doesn't cover it, deny.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time bounds.&lt;/strong&gt; Every grant carries an &lt;code&gt;exp&lt;/code&gt;. If any grant in the chain is expired, deny.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Policy evaluation.&lt;/strong&gt; Once the chain is verified, the Rego policy makes the final call. This is where deployment-specific rules land: rate limits, sensitive-resource restrictions, per-user allowlists, obligations to attach to the response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Obligations.&lt;/strong&gt; A policy can return allow WITH obligations. Common shapes: "MUST redact PII from response," "MUST log to audit stream X," "MUST cap response bytes." The caller is responsible for honoring them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a reference implementation and not a product
&lt;/h2&gt;

&lt;p&gt;We could have built this into Leanroute directly and marketed it as a feature. We chose not to, for three reasons.&lt;/p&gt;

&lt;p&gt;First, chain-aware authorization is a standard that needs to exist, not a differentiator we should keep to ourselves. If we bury the pattern inside our proxy nobody else can look at it, learn from it, or push it forward. As a standalone reference implementation, anyone building an A2A stack (with or without us) can adopt the shape.&lt;/p&gt;

&lt;p&gt;Second, we do not currently proxy A2A traffic through Leanroute. Building the authorization layer without the transport is architecturally weird if we called it a Leanroute feature. As a reference implementation it makes sense: publish the "correct" pattern first, plug our own proxy into it when that ships.&lt;/p&gt;

&lt;p&gt;Third, and honestly: we are a small team. Product surface area is expensive. Standalone reference implementations get to be minimal and understandable in a way that in-product features never do. This repo is meant to be read in an afternoon by anyone who wants to understand the pattern.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's in the repo
&lt;/h2&gt;

&lt;p&gt;Compact but complete for v0.1:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single Go binary (&lt;code&gt;cmd/opa-sidecar&lt;/code&gt;) with SIGHUP hot-reload.&lt;/li&gt;
&lt;li&gt;Reference Rego policies covering the common cases: baseline chain verification, scoped tool invocation, time-bound restrictions, obligations.&lt;/li&gt;
&lt;li&gt;Worked planner-executor demo (two Go agents plus a shell script) that exercises three scenarios: happy path, scope-creep attack, tampered chain.&lt;/li&gt;
&lt;li&gt;Full protocol docs, policy-authoring guide, architecture notes.&lt;/li&gt;
&lt;li&gt;CI covering build, test, gofmt, vet, golangci-lint, and OPA policy syntax.&lt;/li&gt;
&lt;li&gt;MIT licensed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it fits into the broader picture
&lt;/h2&gt;

&lt;p&gt;Two things are converging that make chain-aware authorization urgent, not academic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regulated agent deployments.&lt;/strong&gt; EU AI Act Article 12 and DORA Article 11 (both in force through 2026) require auditable evidence trails for agent actions in regulated industries. That means when a bank's customer service agent invokes a tool that transfers funds, the audit log needs to show not just "agent X did Y" but "user U delegated to agent X, agent X delegated to agent Y, agent Y invoked tool Z, and here's the signed chain proving it." OPA sidecar produces the enforcement side of that story. Its natural complement is a transparency log for the evidence side (see &lt;a href="https://github.com/leanroute/mcp-transparency-log" rel="noopener noreferrer"&gt;MCP Transparency Log&lt;/a&gt;, which we're prototyping next).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCP tool invocation at scale.&lt;/strong&gt; As MCP becomes the standard way for agents to invoke external tools, "who authorized this tool call" becomes the question. Chain-aware authorization gives MCP servers a way to answer it that doesn't require them to trust every agent that talks to them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What comes next
&lt;/h2&gt;

&lt;p&gt;v0.1 is the reference. v0.2 will add revocation, OpenTelemetry, and Envoy ext_authz gRPC support so it works cleanly in service-mesh deployments. v0.3 will add W3C Verifiable Credentials 2.0 compatibility for the credential format.&lt;/p&gt;

&lt;p&gt;If you're building A2A workflows today and hitting the authorization gap, please try it and open issues. Especially if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're on the Google Agent2Agent SDK and want to see what a compatible authorization sidecar looks like.&lt;/li&gt;
&lt;li&gt;You're running MCP tool servers and need to authorize incoming tool calls by more than "does the caller have a valid session."&lt;/li&gt;
&lt;li&gt;You're in a regulated industry and need to produce audit evidence that current API-key models can't.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/leanroute/opa-sidecar-a2a" rel="noopener noreferrer"&gt;github.com/leanroute/opa-sidecar-a2a&lt;/a&gt;. Everything is MIT, no signup needed.&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.openpolicyagent.org/" rel="noopener noreferrer"&gt;Open Policy Agent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-a2a" rel="noopener noreferrer"&gt;Google Agent2Agent (A2A) protocol samples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/TR/vc-data-model-2.0/" rel="noopener noreferrer"&gt;W3C Verifiable Credentials 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/" rel="noopener noreferrer"&gt;MCP (Model Context Protocol)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/chain-aware-authorization-opa-sidecar-mcp"&gt;Chain-aware authorization and OPA as a sidecar pattern (this blog)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>a2a</category>
      <category>agentauthorization</category>
      <category>opa</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Kong AI Gateway Alternative (2026): When a Managed BYOK Gateway Wins</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Mon, 14 Sep 2026 01:49:11 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/kong-ai-gateway-alternative-2026-when-a-managed-byok-gateway-wins-2j5l</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/kong-ai-gateway-alternative-2026-when-a-managed-byok-gateway-wins-2j5l</guid>
      <description>&lt;h1&gt;
  
  
  Kong AI Gateway Alternative (2026): When a Managed BYOK Gateway Wins
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kong AI Gateway is the enterprise-procurement-safe choice. It's the AI layer bolted onto Kong's existing API gateway product, which lots of enterprises already run. Kong Enterprise contracts start around $30-50K annually and scale into six figures. The Kong OSS core is free but missing the management UI, advanced analytics, OIDC, and the AI-specific plugins that make Kong AI Gateway compelling. This post is written for teams that got Kong AI Gateway put in front of them by their platform team or their procurement process and want to sanity-check the alternatives. It compares Kong against Leanroute, LiteLLM, Bifrost, and Portkey, and (because we're the Leanroute team writing this) is honest about the cases where Kong is genuinely the right call.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Who Actually Googles "Kong AI Gateway Alternative"
&lt;/h2&gt;

&lt;p&gt;Three audiences:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Startups whose platform team said "we already run Kong for services, let's use Kong AI Gateway."&lt;/strong&gt; That's a rational-sounding sentence that hides a $30-50K/year enterprise contract. If your monthly LLM spend is $2K, spending $2.5K/mo on the gateway to route it is upside-down math. These teams want confirmation that "we already run Kong" is not, on its own, a good enough reason.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mid-market teams comparing Kong to lighter managed alternatives during procurement.&lt;/strong&gt; Legitimate. Kong's brand is safe; the pricing is not. They want to know if a $15-$25/mo BYOK gateway can do the same job for their traffic shape.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enterprise procurement teams checking whether the AI category has an incumbent yet.&lt;/strong&gt; Kong is one of the "safe" names in this bucket, alongside Datadog and Splunk. They want to know whether picking Kong for the AI-gateway line item is a defensible choice or a habit.&lt;/p&gt;

&lt;p&gt;If you're one of those three, read on.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Kong AI Gateway Gets Right
&lt;/h2&gt;

&lt;p&gt;Genuine, so the pushback lands honestly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Procurement safety.&lt;/strong&gt; Kong is an established API gateway vendor with existing enterprise contracts, DPAs, SOC 2, and legal reviews already done at a lot of companies. Adding an AI gateway line to an existing Kong contract is easier than onboarding a net-new vendor. This is a real, non-technical advantage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plugin ecosystem.&lt;/strong&gt; Kong's plugin architecture is mature. If you need a custom auth flow, an unusual transformation, or an integration with an obscure system, someone has probably already written the Lua plugin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consistent operational model.&lt;/strong&gt; If your platform team already runs Kong for non-AI services, running the AI gateway is marginal cost, with the same admin plane, same routes, and same runbook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enterprise features that actually matter for regulated buyers.&lt;/strong&gt; OIDC, mTLS, WAF, RBAC, dev portal. Not all of these are AI-specific, but if you need them for your API surface, having them consistent between the AI gateway and everything else is worth something.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-hosted-only story.&lt;/strong&gt; For buyers whose compliance rules require the gateway to live inside their infrastructure, Kong is a defensible answer.&lt;/p&gt;

&lt;p&gt;For a Fortune-500 with an existing Kong footprint and a security-first buying committee, Kong AI Gateway is a defensible pick. We're not going to pretend otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Kong Overshoots for Most Teams
&lt;/h2&gt;

&lt;p&gt;The line-items that look small in an enterprise deck and huge in a startup budget:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;License cost.&lt;/strong&gt; Kong Enterprise contracts start around $30-50K annually for small deployments. For a team doing $5K/mo of LLM traffic, the gateway costs more than the traffic, so the ratio is inverted. Even at $50K/mo LLM traffic, spending $50K/year on the gateway is a 8% overhead line item; managed alternatives run 0.5-2% at that scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup surface.&lt;/strong&gt; Kong's core is a real API gateway with Nginx underneath. The AI plugins layer on top of that. If your team is not already running Kong, standing it up for AI gateway alone is a project measured in days to weeks, not hours. Someone on Reddit deploying Bifrost got it working in 30 seconds; standing up Kong takes longer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kong OSS is not Kong AI Gateway.&lt;/strong&gt; The OSS release is missing Kong Manager (the UI), advanced analytics, OIDC, and the enterprise AI plugins. "We'll just use the OSS one" is often "we'll use a fraction of what made Kong appealing."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operational familiarity gate.&lt;/strong&gt; If your platform team already knows Kong, adding the AI layer is easy. If they don't, they're learning a full API gateway stack to solve a much narrower problem (route requests to LLM providers). That's like learning Kubernetes to run one binary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Roadmap lag.&lt;/strong&gt; Kong's AI-specific features (MCP passthrough, semantic caching, LLM-specific guardrails) landed later than the pure-play LLM gateways. As of 2026 they're catching up, but "later than the specialists" is the honest read.&lt;/p&gt;

&lt;p&gt;None of this makes Kong bad. It makes "we already run Kong" not, on its own, a good enough reason to also run Kong AI Gateway.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Case Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Kong AI Gateway&lt;/th&gt;
&lt;th&gt;Leanroute (managed)&lt;/th&gt;
&lt;th&gt;LiteLLM (self-host)&lt;/th&gt;
&lt;th&gt;Bifrost (self-host)&lt;/th&gt;
&lt;th&gt;Portkey (managed)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pricing entry point&lt;/td&gt;
&lt;td&gt;$30-50K+/year&lt;/td&gt;
&lt;td&gt;$15 / $25 monthly&lt;/td&gt;
&lt;td&gt;Free + ops&lt;/td&gt;
&lt;td&gt;Free + ops&lt;/td&gt;
&lt;td&gt;$49/mo + $9/100K logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hosting&lt;/td&gt;
&lt;td&gt;Self-host&lt;/td&gt;
&lt;td&gt;Managed&lt;/td&gt;
&lt;td&gt;Self-host&lt;/td&gt;
&lt;td&gt;Self-host&lt;/td&gt;
&lt;td&gt;Managed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Setup time&lt;/td&gt;
&lt;td&gt;Days to weeks&lt;/td&gt;
&lt;td&gt;Minutes&lt;/td&gt;
&lt;td&gt;Hours&lt;/td&gt;
&lt;td&gt;Under 1 minute&lt;/td&gt;
&lt;td&gt;Minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BYOK&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes, 14 providers&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Providers&lt;/td&gt;
&lt;td&gt;Depends on plugins&lt;/td&gt;
&lt;td&gt;14 curated&lt;/td&gt;
&lt;td&gt;100+&lt;/td&gt;
&lt;td&gt;12+&lt;/td&gt;
&lt;td&gt;40+&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP passthrough&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;Native&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;Native&lt;/td&gt;
&lt;td&gt;Roadmap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Guardrails at edge&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;7 built-in&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;Via config&lt;/td&gt;
&lt;td&gt;Yes (paid tier)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Governance UI&lt;/td&gt;
&lt;td&gt;Kong Manager (paid)&lt;/td&gt;
&lt;td&gt;Included&lt;/td&gt;
&lt;td&gt;Enterprise tier&lt;/td&gt;
&lt;td&gt;Yes (self-host)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ops burden&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise procurement fit&lt;/td&gt;
&lt;td&gt;Highest&lt;/td&gt;
&lt;td&gt;Growing&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Post-PANW&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenAI-compatible wire&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  When Kong Is Actually the Right Call
&lt;/h2&gt;

&lt;p&gt;Being straight, so you don't switch by default when Kong is genuinely the fit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You already run Kong for your non-AI services.&lt;/strong&gt; Adding the AI gateway is marginal effort. Even at $30-50K/year, the platform team's operational familiarity offsets a lot of that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your procurement requires a Gartner-quadrant-listed vendor.&lt;/strong&gt; Kong is on it. Most of us aren't. If your buying committee has a "must be on the MQ" line, some alternatives are eliminated before the technical evaluation even starts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You need mTLS, OIDC, WAF, and RBAC consistent between your AI gateway and your non-AI API surface.&lt;/strong&gt; Bolt-on gateways for AI-only can't match Kong's breadth here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your traffic is 100M+ requests/month and you have SRE headcount already.&lt;/strong&gt; At that scale the license cost amortizes and the operational familiarity of "same runbook as everything else" pays back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You're building a regulated agent deployment (financial services, healthcare, defense).&lt;/strong&gt; Kong's enterprise-security surface is a shorter compliance conversation than most alternatives.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When a Managed BYOK Gateway Wins
&lt;/h2&gt;

&lt;p&gt;For most teams outside those five cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You're a startup or mid-market team.&lt;/strong&gt; $30-50K/year on the gateway is real money that could fund your product roadmap. Managed BYOK at $15-25/mo does the same routing job for 1-2% of the cost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You don't already run Kong.&lt;/strong&gt; The setup surface is real, and "we might use Kong later for services" is not a good enough reason to eat the AI-gateway setup cost now.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your team doesn't have SRE capacity.&lt;/strong&gt; Kong is a real API gateway with real operational needs. If your team is 5 engineers, "run and monitor Kong" is not what you want them doing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your compliance answer is satisfied by a SOC 2 Type II managed vendor.&lt;/strong&gt; A lot of buyers assume they need self-hosting for compliance and don't actually. A managed vendor with the right paperwork clears most standards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want to be on the routing layer in a week, not a quarter.&lt;/strong&gt; Managed BYOK is a same-day setup. Kong AI Gateway with procurement, POC, and platform-team setup is a quarter minimum.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How the Migration Works
&lt;/h2&gt;

&lt;p&gt;For teams moving from Kong AI Gateway to managed BYOK:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sign up for Leanroute.&lt;/strong&gt; BYOK Starter is $15/mo, 14-day free trial.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paste your provider keys into the Providers page.&lt;/strong&gt; OpenAI, Anthropic, Google, xAI, DeepSeek, Bedrock, etc. Keys are AES-256-GCM encrypted at rest, so a database dump reveals nothing usable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change your base URL from your Kong route to &lt;code&gt;https://api.leanroute.dev/v1&lt;/code&gt;.&lt;/strong&gt; Wire is OpenAI-compatible on both sides; no application code changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Migrate any Kong-specific plugin behaviour to Leanroute equivalents.&lt;/strong&gt; Rate-limit plugin → Leanroute per-key caps. Auth plugin → Leanroute API keys. Guardrail plugin → Leanroute's 7 built-in rules. This is the actual work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run 10% of traffic through Leanroute for two weeks.&lt;/strong&gt; Compare logs, latency, cost, and error rates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flip the ratio when the numbers agree.&lt;/strong&gt; Keep Kong for your non-AI services if you're still using it there; drop the AI-gateway line from the contract at renewal.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The migration is intentionally boring because both are OpenAI-wire. The one place it gets less boring is if you had a lot of custom Lua plugins in front of your LLM traffic; you'll need to decide whether to replicate them in application code, use Leanroute's built-ins, or keep Kong specifically for the paths that need those plugins.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Broader Point
&lt;/h2&gt;

&lt;p&gt;The API gateway market has always had two camps: &lt;strong&gt;general-purpose gateways with an AI plugin&lt;/strong&gt; (Kong AI Gateway, Apigee AI extension, Tyk AI) and &lt;strong&gt;AI-specialist gateways&lt;/strong&gt; (Leanroute, Portkey, LiteLLM, Bifrost). The general-purpose camp wins on procurement safety and consistency with your existing API surface. The specialist camp wins on price, setup speed, and depth of AI-specific features.&lt;/p&gt;

&lt;p&gt;The wrong move is picking a general-purpose gateway because "we already run Kong" and paying $30-50K/year for what a specialist gateway does for $15-25/mo. The other wrong move is picking a specialist gateway when your enterprise procurement process really does require a Gartner-listed vendor with an existing MSA.&lt;/p&gt;

&lt;p&gt;Match the gateway camp to your buying committee. If it's a platform-and-security team at a Fortune-500, Kong probably wins. If it's an AI team at a startup or mid-market SaaS, a specialist gateway probably wins.&lt;/p&gt;

&lt;p&gt;If you're in the second camp, we're at &lt;a href="https://leanroute.dev" rel="noopener noreferrer"&gt;leanroute.dev&lt;/a&gt;. If you're in the first camp, Kong AI Gateway is a defensible pick and we won't try to talk you out of it.&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://konghq.com/products/kong-ai-gateway" rel="noopener noreferrer"&gt;Kong AI Gateway product page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zuplo.com/learning-center/the-true-cost-of-kong-tco-analysis" rel="noopener noreferrer"&gt;Kong Enterprise pricing analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/litellm-alternatives-2026"&gt;LiteLLM alternatives in 2026 (this blog)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/bifrost-alternative-when-managed-beats-go"&gt;Bifrost alternative: when managed BYOK beats self-hosting Go (this blog)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/portkey-alternatives-after-palo-alto-acquisition"&gt;Portkey alternatives after the Palo Alto acquisition (this blog)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/self-hosting-an-llm-gateway"&gt;Self-hosting an LLM gateway: the honest ops math (this blog)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/#pricing" rel="noopener noreferrer"&gt;Leanroute pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>kong</category>
      <category>aigateway</category>
      <category>llmgateway</category>
      <category>enterprise</category>
    </item>
    <item>
      <title>FinOps for LLM Spend: Three Reasons Your Bill Changed</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Fri, 11 Sep 2026 04:11:43 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/finops-for-llm-spend-three-reasons-your-bill-changed-3de7</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/finops-for-llm-spend-three-reasons-your-bill-changed-3de7</guid>
      <description>&lt;h1&gt;
  
  
  FinOps for LLM Spend: Three Reasons Your Bill Changed
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When your LLM bill moves month to month, one of three separate things caused it. Your usage changed (more or fewer tokens). Your pricing changed (a discount kicked in, a markup went away, cache-hit rates got billed differently). Or the way your app talks to the model changed (routing, caching, model choice). A dashboard that only shows "spend down 40%" without splitting those three apart is how teams end up thanking the wrong lever, and repeating the wrong fix next quarter. Here is a simple framework for pulling them apart before you claim you saved money.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why this matters
&lt;/h2&gt;

&lt;p&gt;Cloud FinOps figured this out a decade ago. Everyone in the AWS world knows that a lower bill can come from three unrelated things. Fewer instance hours. A Savings Plan kicking in. A rightsizing project. Confusing them is bad practice, because each one points to a different next step.&lt;/p&gt;

&lt;p&gt;LLM spend is going through the same learning curve, from scratch, with teams that were not around for the cloud version. And it is harder here, because more moving parts sit between "user typed a prompt" and "line item on the invoice." Model choice, cache hit rate, provider markup, batch discounts, per-org rate limits, and gateway routing all pull on the number.&lt;/p&gt;

&lt;p&gt;The framework below names the three axes. In practice, most real cost changes are a mix of movement on some or all of them. The trap is treating a combined change as if one lever caused it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Axis 1: Usage change
&lt;/h2&gt;

&lt;p&gt;This is what most dashboards actually show. It is the change in how much work your app is asking the LLM to do, before any pricing or architecture decisions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What causes it&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More or fewer end users&lt;/li&gt;
&lt;li&gt;More or fewer requests per user&lt;/li&gt;
&lt;li&gt;Longer or shorter prompts (context growth, bigger RAG documents)&lt;/li&gt;
&lt;li&gt;Longer or shorter completions (chattier or terser system prompts, JSON-mode differences)&lt;/li&gt;
&lt;li&gt;New features that add or remove LLM calls&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to measure it on its own&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hold everything else fixed. Compare &lt;code&gt;input_tokens + output_tokens&lt;/code&gt; month to month, not dollars. If your token count changed but your cost per token did not, the whole delta is usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Crediting a lower bill to "we optimized" when the real story is that fewer users showed up. That is a churn signal, not an efficiency signal. Congratulations, you saved money on the LLM bill and lost a third of your customers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The FinOps question worth asking every month&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What would this bill have been at last month's cost per token? If the answer is close to this month, usage moved. If it is far off, usage is flat and something else is doing the work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Axis 2: Pricing change
&lt;/h2&gt;

&lt;p&gt;Pricing change is what changed about how you buy the tokens, not what tokens you bought. Most engineering teams never see this axis because it lives in contracts, procurement, and BD conversations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What causes it&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A committed-use discount kicked in (OpenAI, Anthropic, and Google all offer volume tiers)&lt;/li&gt;
&lt;li&gt;Provisioned throughput on Bedrock replaced on-demand rates&lt;/li&gt;
&lt;li&gt;A gateway or aggregator markup got added or removed (5 to 10 percent on OpenRouter, 20 to 40 percent on some enterprise wrappers, zero on flat-fee BYOK gateways)&lt;/li&gt;
&lt;li&gt;Cache-hit rates got billed differently (Anthropic charges 10 percent of the base for cached input, OpenAI dropped cached-input rates in mid-2026, DeepSeek moved to a peak and off-peak model on 2026-08-16)&lt;/li&gt;
&lt;li&gt;Batch API discounts (50 percent off if you can wait)&lt;/li&gt;
&lt;li&gt;Switching between BYOK and managed-invoice paths through the same infrastructure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to measure it on its own&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Compute the effective dollars per million input tokens and dollars per million output tokens for the same model, at the same request pattern, on last month and this month. If usage is flat and the effective rate changed, the whole delta is pricing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Giving engineering credit for a bill drop that was really the finance team negotiating a committed-use tier. The engineers who worked on caching feel like the cache saved money. The finance team knows the commit saved money. Both are right, and both are underselling. Without splitting them, one team's story becomes the official story, and the real driver gets missed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The FinOps question worth asking every month&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If usage had been identical to last month, what would we have paid at this month's contract terms? That number is your pricing-only impact.&lt;/p&gt;

&lt;h2&gt;
  
  
  Axis 3: Architecture change
&lt;/h2&gt;

&lt;p&gt;Architecture change is what the gateway, routing, and caching layer changed in how the workload got served, before it ever reached the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What causes it&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache hit rate moved (prompt cache, semantic cache, RAG retrieval cache)&lt;/li&gt;
&lt;li&gt;Cheaper-model routing (a prompt that used to hit Sonnet 5 now hits DeepSeek V4 Flash on the same-tier arbitrage rule)&lt;/li&gt;
&lt;li&gt;Model choice changed (dropping GPT-5.6 Sol for GPT-5.6 Terra on a workload that did not need premium reasoning)&lt;/li&gt;
&lt;li&gt;Retry policy tightened (fewer retries after upstream 5xx errors)&lt;/li&gt;
&lt;li&gt;Failover happened (primary provider was down, secondary provider costs different)&lt;/li&gt;
&lt;li&gt;Batch consolidation (multiple small requests merged into one)&lt;/li&gt;
&lt;li&gt;Guardrail overhead (prompt-injection detection adds one moderation API call per request)&lt;/li&gt;
&lt;li&gt;MCP tool-use loops resolved in one round trip instead of three&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to measure it on its own&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For a fixed workload and fixed contract terms, compare the effective cost per request. If the token bill dropped but the request count and unit rates are flat, the architecture in front of the model changed. Your gateway logs are the source of truth here. You need per-request records of model chosen, cache hit or miss, retry count, and failover events.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common mistake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Treating a cache-hit-rate improvement as "we saved money" when the customer's prompt pattern happened to shift toward more repetitive requests. That is usage pretending to be architecture. Real architectural wins move the hit rate on a stable prompt pattern.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The FinOps question worth asking every month&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we had served this month's workload with last month's routing rules, cache configuration, and model selection, what would we have paid at this month's contract terms? That number is your architecture-only impact.&lt;/p&gt;

&lt;h2&gt;
  
  
  A concrete example
&lt;/h2&gt;

&lt;p&gt;Two teams. Both send 100 million Sonnet 5 tokens per month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Team A&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On-demand direct to Anthropic&lt;/li&gt;
&lt;li&gt;Retail pricing: $2 per 1M input, $10 per 1M output&lt;/li&gt;
&lt;li&gt;5-to-1 input-to-output ratio, so blended cost is $20 per 6M tokens&lt;/li&gt;
&lt;li&gt;100M tokens per month works out to about $2,000 per month&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Team B&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Has a 10 percent committed-use discount with Anthropic&lt;/li&gt;
&lt;li&gt;Routes through a flat-fee BYOK gateway ($25 per month)&lt;/li&gt;
&lt;li&gt;Prompt cache hit rate is 30 percent&lt;/li&gt;
&lt;li&gt;Same 5-to-1 ratio, same 100M tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Team B math:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full-price tokens: 70 percent of ($333 input + $1,667 output) minus 10 percent commit = about $1,260&lt;/li&gt;
&lt;li&gt;Cache-hit tokens (30 percent, at 10 percent of the input rate): 30 percent of $333 times 0.1 = about $10&lt;/li&gt;
&lt;li&gt;Gateway fee: $25&lt;/li&gt;
&lt;li&gt;Total: about $1,295 per month&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same model. Same workload. 35 percent unit cost difference. Now the questions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;How much of the gap is usage?&lt;/strong&gt; Zero. Both teams sent identical traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much is pricing?&lt;/strong&gt; About $200. The 10 percent commit on 90 percent of the traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much is architecture?&lt;/strong&gt; About $500. The 30 percent cache hit rate and the routing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much is the "gateway is expensive" tax?&lt;/strong&gt; Negative $475. The $25 flat fee is tiny compared to the savings the routing enables.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If Team B's dashboard just says "we spend 35 percent less on LLMs than Team A does," they cannot answer any of those four questions. If Team A ever tries to close the gap, they will guess wrong about which lever to pull.&lt;/p&gt;

&lt;h2&gt;
  
  
  The discipline
&lt;/h2&gt;

&lt;p&gt;Every monthly LLM cost review should answer the same three questions, in this order.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;What did usage do?&lt;/strong&gt; Token count month to month. Request count month to month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What did pricing do?&lt;/strong&gt; Effective dollars per token, by model, month to month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What did architecture do?&lt;/strong&gt; Effective cost per request, at fixed usage and fixed contract terms, month to month.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The three numbers should add up to the total dollar change. If they do not, you have unattributed variance. That usually means a fourth thing is quietly moving. Someone changed the default model. A new feature launched that no one told finance about. A retry storm during a provider outage bloated the bill.&lt;/p&gt;

&lt;p&gt;Teams that do this monthly develop something the teams that skip it lack. An accurate story about why the LLM bill did what it did. Which is what makes future budgets defensible and future optimizations credible.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means for gateway choice
&lt;/h2&gt;

&lt;p&gt;This post is on a gateway vendor's blog, so it is worth being honest about where the framework lands on that question.&lt;/p&gt;

&lt;p&gt;How you route affects the architecture axis heavily, and the pricing axis in some paths. A flat-fee BYOK gateway is really two levers bundled together. It caps the "we take a percent of your tokens" markup at zero (pricing) and lets you route across model choice, cache, and failover (architecture). Whether that combination beats a direct-to-provider setup depends entirely on your cache hit rate, your model diversity, and whether you already have committed-use pricing negotiated.&lt;/p&gt;

&lt;p&gt;But that decision has to be made with the numbers split apart. Not with a "we saved money" claim on either side. The gateway is a lever. Whether pulling it is worth it is a FinOps question, and it needs the three-axes framework to answer honestly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bigger point
&lt;/h2&gt;

&lt;p&gt;Cloud FinOps became a discipline because too many teams confused usage growth with rising unit cost, or Savings Plan kicking in with a rightsizing win. The result was that when the AWS bill spiked, nobody could tell whether it was a scaling problem, a pricing problem, or a wasted-resource problem. And the fix was always a guess.&lt;/p&gt;

&lt;p&gt;LLM spend is going through the same curve. Faster. With fewer reflexes in place. Teams that build the reflex early (split before you attribute, name the axis before you name the win) will make better product bets in year two of their AI investment. Teams that skip it will keep pulling levers and never quite know which one moved the number.&lt;/p&gt;

&lt;p&gt;If you are building the LLM cost story at your company, the three axes are the first tool. The dashboards, the gateway choice, the vendor contracts all follow from having the vocabulary to talk about which axis moved.&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/pricing" rel="noopener noreferrer"&gt;Anthropic API pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.com/api/pricing" rel="noopener noreferrer"&gt;OpenAI API pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://api-docs.deepseek.com/quick_start/pricing" rel="noopener noreferrer"&gt;DeepSeek off-peak pricing policy update&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.finops.org/framework/" rel="noopener noreferrer"&gt;FinOps Foundation framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/#pricing" rel="noopener noreferrer"&gt;Leanroute pricing (BYOK example in this post)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>finops</category>
      <category>llmcost</category>
      <category>aigateway</category>
      <category>byok</category>
    </item>
    <item>
      <title>OpenRouter Alternative: When BYOK Beats Per-Request Markup</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Mon, 07 Sep 2026 11:39:34 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/openrouter-alternative-when-byok-beats-per-request-markup-1o6k</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/openrouter-alternative-when-byok-beats-per-request-markup-1o6k</guid>
      <description>&lt;h1&gt;
  
  
  OpenRouter Alternative: When BYOK Beats Per-Request Markup
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;OpenRouter's model — one API key, hundreds of models, they hold the provider keys, they mark up per token — is excellent for hobby projects and model exploration. It becomes expensive around the point where your monthly LLM spend crosses roughly $200-500 and stays there, and it becomes limiting the moment you need spend caps enforced at gateway edge, provider commitments, or BYOK for compliance reasons. This post walks through the actual arithmetic on when to switch to a BYOK-based alternative, what you gain, what you give up, and how the migration works.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Who Actually Googles "OpenRouter Alternative"
&lt;/h2&gt;

&lt;p&gt;There are two audiences searching for this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Developers whose app grew up.&lt;/strong&gt; Started on OpenRouter because it was the fastest way to try five models in an afternoon. Now the app has real users, real traffic, and a real monthly bill. The small per-request markup that was invisible at $50/mo becomes real money at $2,000/mo — a low-four-figure yearly tax that a different gateway model would erase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teams that want BYOK for control reasons unrelated to price.&lt;/strong&gt; Their finance team wants the OpenAI invoice to come from OpenAI, not through a reseller. Or they have OpenAI enterprise pricing they cannot use through OpenRouter. Or they want to keep their provider rate-limit relationship (spinning up a new key on OpenRouter pulls from OpenRouter's shared pool, not yours). Or their security team has already vetted OpenAI's and Anthropic's DPAs and does not want to re-do it for a reseller.&lt;/p&gt;

&lt;p&gt;If you are one of those two, the rest of this post is written for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Economics: When Does the Markup Start to Matter
&lt;/h2&gt;

&lt;p&gt;OpenRouter's take is not hidden. They publish per-model pricing and it is transparently a small markup above provider pricing. The question is not "is the markup fair" (it is) — the question is "at what point do I actually care."&lt;/p&gt;

&lt;p&gt;Rough thresholds. Using a 5% markup as the floor and 10% as the ceiling:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Monthly LLM spend&lt;/th&gt;
&lt;th&gt;5% markup cost&lt;/th&gt;
&lt;th&gt;10% markup cost&lt;/th&gt;
&lt;th&gt;Alternative flat cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;$50&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$15-25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$200&lt;/td&gt;
&lt;td&gt;$10&lt;/td&gt;
&lt;td&gt;$20&lt;/td&gt;
&lt;td&gt;$15-25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$500&lt;/td&gt;
&lt;td&gt;$25&lt;/td&gt;
&lt;td&gt;$50&lt;/td&gt;
&lt;td&gt;$15-25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$2,000&lt;/td&gt;
&lt;td&gt;$100&lt;/td&gt;
&lt;td&gt;$200&lt;/td&gt;
&lt;td&gt;$15-25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$10,000&lt;/td&gt;
&lt;td&gt;$500&lt;/td&gt;
&lt;td&gt;$1,000&lt;/td&gt;
&lt;td&gt;$15-25&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Break-even lives around the $200-500/month spend point. Below that, OpenRouter's markup is less than a flat $15-25/mo alternative and you should stay put. Above $500/mo the arithmetic flips hard: at $2K/mo of usage you are paying $100-200/mo in markup vs $25 flat, a $75-175/mo saving. At $10K/mo of usage the saving is $500-1000 a month.&lt;/p&gt;

&lt;p&gt;The other axis is direction of travel. If your monthly spend is heading up as your product grows, the crossover happens once. It does not un-happen. The right time to switch is the month before you cross the threshold, not the month after.&lt;/p&gt;

&lt;h2&gt;
  
  
  What BYOK Actually Changes
&lt;/h2&gt;

&lt;p&gt;The obvious change is billing: OpenAI bills you, Anthropic bills you, Google bills you, and the gateway charges only its flat subscription.&lt;/p&gt;

&lt;p&gt;The less obvious changes matter more:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You own your provider rate limits.&lt;/strong&gt; On OpenRouter your requests go through OpenRouter's pool. If OpenRouter as a whole gets rate-limited or their key gets deprioritized during a provider incident, your app feels it. With BYOK your app hits your provider account, whose rate limits you control by contacting the provider directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You get provider-native features you did not know you were missing.&lt;/strong&gt; OpenAI's tier-based rate limits, Anthropic's provisioned throughput on Bedrock, Google's project-level quotas, xAI's beta features gated to specific accounts — all of these depend on the request originating from your account, not a shared one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can negotiate.&lt;/strong&gt; At $10K+/mo of spend you can get committed-use discounts from OpenAI (typically 5-15% off), enterprise pricing from Anthropic, or provisioned throughput on Bedrock. None of that is available if the invoice is aggregated through a reseller.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You keep the data in the provider relationships you have already vetted.&lt;/strong&gt; Some finance and security teams have already gone through the review of OpenAI's DPA and Anthropic's SOC 2, and re-doing that for a reseller is friction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spend caps are enforced at the edge, not after the fact.&lt;/strong&gt; OpenRouter can alert you when you cross a budget, but by then the money is spent. A BYOK gateway with per-org and per-key caps will refuse the request before it hits the provider — so a runaway loop in your code costs you at most one over-limit request, not a weekend of billing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What OpenRouter Gets Right That BYOK Alternatives Don't
&lt;/h2&gt;

&lt;p&gt;Honest counter-side:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zero setup for model exploration.&lt;/strong&gt; Adding a 15th provider on OpenRouter is a dropdown change. Adding a 15th provider on any BYOK gateway involves signing up for that provider, getting a key, adding it to the gateway. If your app switches providers weekly for experimentation, this friction is real.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aggregation of small usage.&lt;/strong&gt; If you use ten providers at $5/mo each, opening ten accounts and managing ten keys is annoying. OpenRouter collapses that to one invoice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some regional coverage is easier through their pool.&lt;/strong&gt; OpenRouter has business relationships with providers that individual developers cannot always match, especially for a subset of China-based providers.&lt;/p&gt;

&lt;p&gt;If your usage looks like "many providers, low total spend, exploratory," OpenRouter is right and you should stay. If your usage looks like "few providers, real spend, production," BYOK usually wins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternatives Compared
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;OpenRouter&lt;/th&gt;
&lt;th&gt;Leanroute&lt;/th&gt;
&lt;th&gt;Portkey&lt;/th&gt;
&lt;th&gt;LiteLLM (self-host)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pricing&lt;/td&gt;
&lt;td&gt;Per-token markup&lt;/td&gt;
&lt;td&gt;Flat $15 / $25 monthly&lt;/td&gt;
&lt;td&gt;Per-request tiers&lt;/td&gt;
&lt;td&gt;Free + ops cost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BYOK&lt;/td&gt;
&lt;td&gt;No (they hold keys)&lt;/td&gt;
&lt;td&gt;Yes — 14 providers&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Providers reachable&lt;/td&gt;
&lt;td&gt;100+&lt;/td&gt;
&lt;td&gt;14 curated&lt;/td&gt;
&lt;td&gt;40+&lt;/td&gt;
&lt;td&gt;100+&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP passthrough&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Native&lt;/td&gt;
&lt;td&gt;Roadmap&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Guardrails at edge&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;7 built-in&lt;/td&gt;
&lt;td&gt;Yes (paid tier)&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hard spend caps&lt;/td&gt;
&lt;td&gt;Alerts only&lt;/td&gt;
&lt;td&gt;Enforced at edge&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes (config)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ops burden&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenAI-compat wire&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Leanroute deliberately curates 14 providers rather than chasing 100+. The rationale: adding a provider means we test the wire format, verify SigV4 / OAuth / whatever auth the provider uses, keep the pricing table current, run the canary against a live account every deploy, and take pages when it breaks. Providers we do not run in production we do not add. Portkey and LiteLLM have wider provider reach; Leanroute has narrower with tighter operational commitment. Pick the trade-off that matches your workload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Migration: How Long It Takes
&lt;/h2&gt;

&lt;p&gt;Assuming your app already uses the OpenAI SDK (most do), moving from OpenRouter to a BYOK gateway is a five-step change:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign up for the BYOK alternative, mint a runtime key.&lt;/li&gt;
&lt;li&gt;Add your provider keys (OpenAI, Anthropic, DeepSeek, etc.) — for most providers this is paste-your-key; for AWS Bedrock this is an AWS IAM credential blob.&lt;/li&gt;
&lt;li&gt;Change your &lt;code&gt;OPENAI_BASE_URL&lt;/code&gt; from &lt;code&gt;https://openrouter.ai/api/v1&lt;/code&gt; to the new endpoint.&lt;/li&gt;
&lt;li&gt;Change the API key from your OpenRouter key to your new gateway key.&lt;/li&gt;
&lt;li&gt;Optional: transition model IDs. On OpenRouter they are &lt;code&gt;provider/model&lt;/code&gt; (e.g., &lt;code&gt;openai/gpt-5-mini&lt;/code&gt;). Most BYOK gateways including Leanroute use the same convention, so this is usually a no-op.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Send one canary request, check the response header for the routing hop, then cut traffic over. For a typical Leanroute-from-OpenRouter migration, an afternoon.&lt;/p&gt;

&lt;p&gt;For a fuller walkthrough with code, see &lt;a href="https://dev.to/blog/migrating-from-openrouter-to-leanroute"&gt;Migrating from OpenRouter to Leanroute&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Concrete Scenarios
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Scenario A: side project at $80/mo.&lt;/strong&gt; You are running a small productivity app for a few hundred users, mostly hitting &lt;code&gt;openai/gpt-5.6-luna&lt;/code&gt; and &lt;code&gt;anthropic/claude-haiku-4-5&lt;/code&gt;. Monthly OpenRouter bill: $80 + ~$5 markup. Switching to Leanroute costs $15-25/mo flat and saves nothing — the $10 markup is less than the flat fee. &lt;strong&gt;Verdict: stay on OpenRouter.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario B: growing SaaS at $1,800/mo.&lt;/strong&gt; You have real customers, real traffic, and the app is chewing through &lt;code&gt;openai/gpt-5.6-terra&lt;/code&gt; for the main workflow and &lt;code&gt;deepseek/deepseek-v4-pro&lt;/code&gt; for the batch summarization job. Monthly OpenRouter bill: $1,800 + ~$90-180 markup. Switching to Leanroute at $25/mo saves $65-155/mo and gets you hard spend caps, MCP passthrough, and guardrails. &lt;strong&gt;Verdict: switch.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario C: enterprise with $15K/mo of Claude traffic.&lt;/strong&gt; You already have an Anthropic enterprise agreement with committed-use pricing. OpenRouter cannot honor your committed-use pricing because the requests are not originating from your Anthropic account. Every request is being billed at retail plus markup. &lt;strong&gt;Verdict: switch immediately — you are paying twice.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When to NOT Switch
&lt;/h2&gt;

&lt;p&gt;Signals OpenRouter is still the right answer for you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monthly spend under ~$200 and staying there.&lt;/li&gt;
&lt;li&gt;You experiment across 20+ models regularly and want them all one dropdown away.&lt;/li&gt;
&lt;li&gt;Your team has no interest in managing provider accounts.&lt;/li&gt;
&lt;li&gt;You need models Leanroute or other BYOK gateways do not carry (some China-hosted models, some niche fine-tunes).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of those are things to be embarrassed about. Pick the tool that fits.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Meta Point
&lt;/h2&gt;

&lt;p&gt;The OpenRouter model — aggregator plus markup — is a genuinely good fit for a specific band of users. The BYOK model — provider relationships stay with you, gateway is flat priced — is a genuinely good fit for a different band. The transition point is roughly the same point where a startup transitions from "moving fast, model shopping" to "we have real users, our LLM bill is a real line item, we want the provider relationships in our name."&lt;/p&gt;

&lt;p&gt;If you want help thinking through your specific numbers, &lt;a href="mailto:sales@leanroute.dev"&gt;email us&lt;/a&gt;. Bring your last three months of OpenRouter invoices and we will tell you honestly whether switching saves you enough to bother.&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/migrating-from-openrouter-to-leanroute"&gt;Migrating from OpenRouter to Leanroute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/litellm-alternatives-2026"&gt;LiteLLM Alternatives in 2026: Honest Comparison of 5 LLM Gateways&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/self-hosting-an-llm-gateway"&gt;Self-Hosting an LLM Gateway: When It's Right, When It's Not&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/docs" rel="noopener noreferrer"&gt;Leanroute docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/#pricing" rel="noopener noreferrer"&gt;Leanroute pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>openrouter</category>
      <category>aigateway</category>
      <category>llmgateway</category>
    </item>
    <item>
      <title>LiteLLM Alternatives in 2026: Honest Comparison of 5 LLM Gateways</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Sun, 06 Sep 2026 14:37:11 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/litellm-alternatives-in-2026-honest-comparison-of-5-llm-gateways-1fnf</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/litellm-alternatives-in-2026-honest-comparison-of-5-llm-gateways-1fnf</guid>
      <description>&lt;h1&gt;
  
  
  LiteLLM Alternatives in 2026: Honest Comparison of 5 LLM Gateways
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LiteLLM was the default OSS LLM gateway from 2024 through mid-2026. The recent CVE-2026-35029 privilege-escalation issue plus the working-month ops overhead of running a self-hosted gateway have pushed a lot of teams to reevaluate. This post compares five real alternatives — Leanroute, Portkey, Kong AI Gateway, Helicone, and OpenRouter — on the dimensions that actually matter: hosting model, wire format, BYOK, MCP support, guardrails, and honest verdicts about who each one is for. It is written by the Leanroute team but includes the cases where you should NOT switch to us.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why People Are Searching for LiteLLM Alternatives
&lt;/h2&gt;

&lt;p&gt;Three overlapping reasons show up in the search data and in our sales inbox:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The recent CVE.&lt;/strong&gt; CVE-2026-35029 (privilege escalation from a read-only viewer role to config-modifier) landed a few days ago. If you already run LiteLLM the patch is fast, but the CVE prompted teams to ask a bigger question: "do we have someone on-call to catch the next one?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The ops burden.&lt;/strong&gt; LiteLLM is free to install and expensive to run. Postgres, Redis, monitoring, patching, secret rotation, on-call. Our working estimate for a mature self-hosted deployment carrying real production traffic is &lt;a href="https://dev.to/blog/self-hosting-an-llm-gateway"&gt;15-25 engineer-hours per week&lt;/a&gt; — a real number that most teams do not budget for when they choose "free."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The category moved.&lt;/strong&gt; LiteLLM was designed in 2023-2024 when the problem was "translate between provider APIs." In 2026 the problem is that plus MCP passthrough, agent-to-agent auth, spend caps that actually work at the gateway edge, and a security model that treats the gateway as a first-class trust boundary rather than an internal utility.&lt;/p&gt;

&lt;p&gt;None of that means LiteLLM is bad. The maintainers have been diligent about patching, the OSS model is legit, and the community is real. It means the space has widened and the right answer depends on what you actually need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Decision Tree
&lt;/h2&gt;

&lt;p&gt;Before the detailed comparison, the shortest useful version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You want to keep self-hosting and just need MORE than LiteLLM (auth, guardrails, MCP) →&lt;/strong&gt; Kong AI Gateway or Portkey OSS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want to STOP self-hosting →&lt;/strong&gt; managed Leanroute, managed Portkey, or Helicone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want observability only (logs, cost tracking) and already have a routing layer →&lt;/strong&gt; Helicone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want to give hobbyist devs multi-provider access without dealing with keys →&lt;/strong&gt; OpenRouter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want a single OpenAI-compatible endpoint that speaks BYOK to 14 providers, adds MCP passthrough, and is priced flat per month regardless of traffic →&lt;/strong&gt; Leanroute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the details.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Five Alternatives
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Portkey
&lt;/h3&gt;

&lt;p&gt;Portkey ships both an OSS gateway you can self-host and a managed cloud. The OSS gateway is credible and actively maintained; the managed cloud adds observability, prompt management, and a UI. Wire format is OpenAI-compatible. Guardrails and semantic caching are in the managed tier. Their focus is enterprise sales, which shows up in the product depth and in the pricing conversations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams that want either self-host-and-stay-in-control OR a managed alternative with a mature enterprise-shaped feature set. Migration from LiteLLM is straightforward because both speak OpenAI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not for:&lt;/strong&gt; teams that want flat monthly pricing and zero per-request markup. Portkey's managed tier is priced on request volume.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Kong AI Gateway
&lt;/h3&gt;

&lt;p&gt;Kong is the incumbent web API gateway with an AI gateway layer bolted on. If your team already runs Kong for other services, adding the AI gateway is genuinely marginal cost — same admin plane, same routes, same operational model. Fully self-hosted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; enterprises with an existing Kong footprint and an SRE team that already knows the operational model. This is the "safe procurement" pick — we saw it beat LiteLLM at a real enterprise account recently, and it won on being an established vendor, not on being a better AI gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not for:&lt;/strong&gt; startups without a platform team. The setup surface is real, and the AI-specific features (spend caps, model routing, guardrails) are less mature than the web-API-gateway core.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Helicone
&lt;/h3&gt;

&lt;p&gt;Helicone is primarily observability — logs, cost tracking, request replay — with proxy-mode routing as a secondary function. Simple integration: change your base URL and you get a dashboard. Open-source with a hosted tier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; teams that want visibility into what their app is spending on LLM calls without owning the routing layer. You keep talking to OpenAI or Anthropic directly (via the proxy), Helicone logs everything, and you get charts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not for:&lt;/strong&gt; teams that need routing decisions, failover, BYOK to multiple providers behind a single endpoint, or MCP passthrough.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. OpenRouter
&lt;/h3&gt;

&lt;p&gt;OpenRouter is a managed multi-provider endpoint. One API key gets you access to hundreds of models across all major providers. They handle the provider keys, they handle billing, you send requests. Pricing is per-token with a small markup on top of provider pricing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; individual developers exploring models, hobbyists, small apps where "one credit card, many models" is the whole win. Great for prototyping.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not for:&lt;/strong&gt; production workloads where the markup adds up, teams that already have provider commitments and want BYOK, or teams that want spend caps enforced at gateway edge (OpenRouter alerts you after the spend, not before). If you fall into that bucket, see our &lt;a href="https://dev.to/blog/openrouter-alternative-byok"&gt;OpenRouter alternative&lt;/a&gt; post for the fuller argument.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Leanroute (us)
&lt;/h3&gt;

&lt;p&gt;We built Leanroute for the middle: teams that have outgrown OpenRouter's markups and hobbyist framing, but do not want the ops burden of LiteLLM or Kong. Flat $15 / $25 per month, BYOK to 14 providers (OpenAI, Anthropic, Google, xAI, DeepSeek, Groq, AWS Bedrock, Z.AI, Kimi, Doubao, Sarvam, Krutrim, plus two more), MCP passthrough on the same endpoint, a 7-rule guardrail starter library at the gateway edge, hard spend caps enforced before your provider invoice grows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; startup and mid-market teams running production LLM traffic who want managed but with their own provider relationships. Flat pricing means the gateway cost is predictable as you scale. BYOK means you keep provider rate limits, discounts, and commitments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Teams with data-residency requirements no managed vendor can meet — you should self-host (LiteLLM, Portkey OSS, or Kong).&lt;/li&gt;
&lt;li&gt;Enterprises whose procurement requires a Gartner MQ-listed vendor. We are not on it, we are honest about it, come back to us when you are ready.&lt;/li&gt;
&lt;li&gt;Teams that need observability only, without routing — Helicone is a cleaner fit for that shape.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;LiteLLM (self-host)&lt;/th&gt;
&lt;th&gt;Leanroute&lt;/th&gt;
&lt;th&gt;Portkey&lt;/th&gt;
&lt;th&gt;Kong AI Gateway&lt;/th&gt;
&lt;th&gt;Helicone&lt;/th&gt;
&lt;th&gt;OpenRouter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hosting model&lt;/td&gt;
&lt;td&gt;Self-host&lt;/td&gt;
&lt;td&gt;Managed (SG)&lt;/td&gt;
&lt;td&gt;Both&lt;/td&gt;
&lt;td&gt;Self-host&lt;/td&gt;
&lt;td&gt;Both&lt;/td&gt;
&lt;td&gt;Managed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wire format&lt;/td&gt;
&lt;td&gt;OpenAI-compat&lt;/td&gt;
&lt;td&gt;OpenAI-compat&lt;/td&gt;
&lt;td&gt;OpenAI-compat&lt;/td&gt;
&lt;td&gt;OpenAI-compat + Kong routes&lt;/td&gt;
&lt;td&gt;OpenAI / Anthropic proxy&lt;/td&gt;
&lt;td&gt;OpenAI-compat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BYOK to your provider account&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes (14 providers)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No (they hold keys)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP passthrough&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;Native&lt;/td&gt;
&lt;td&gt;Roadmap&lt;/td&gt;
&lt;td&gt;Roadmap&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Guardrails at edge&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;7 built-in&lt;/td&gt;
&lt;td&gt;Built-in (managed tier)&lt;/td&gt;
&lt;td&gt;Via plugins&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hard spend caps&lt;/td&gt;
&lt;td&gt;Yes (config-heavy)&lt;/td&gt;
&lt;td&gt;Yes (per-org, per-key)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Alerts only&lt;/td&gt;
&lt;td&gt;Alerts only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pricing model&lt;/td&gt;
&lt;td&gt;Free + ops cost&lt;/td&gt;
&lt;td&gt;Flat monthly&lt;/td&gt;
&lt;td&gt;Per-request tiers&lt;/td&gt;
&lt;td&gt;Enterprise contract&lt;/td&gt;
&lt;td&gt;Freemium / tiered&lt;/td&gt;
&lt;td&gt;Per-token markup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ops burden&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium / None&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Migration Path from LiteLLM
&lt;/h2&gt;

&lt;p&gt;If you decide to move off LiteLLM, the migration to any OpenAI-compatible alternative is mostly a base URL change:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign up for the alternative and set up your provider keys (either transferred as BYOK or added fresh).&lt;/li&gt;
&lt;li&gt;Change &lt;code&gt;OPENAI_BASE_URL&lt;/code&gt; in your app from your LiteLLM instance to the new endpoint.&lt;/li&gt;
&lt;li&gt;Verify the first canary request. Most gateways expose a response header (Leanroute uses &lt;code&gt;x-gateway-provider&lt;/code&gt;) that confirms the routing hop.&lt;/li&gt;
&lt;li&gt;Cut over the rest of your traffic when the canary is clean.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a typical Leanroute migration that takes an afternoon; for teams with heavy per-org config, custom guardrails, or unusual auth budget one or two days. Full docs at &lt;a href="https://leanroute.dev/docs" rel="noopener noreferrer"&gt;leanroute.dev/docs&lt;/a&gt;. If you want a hand, &lt;a href="mailto:sales@leanroute.dev"&gt;sales@leanroute.dev&lt;/a&gt; will reply personally.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Stay on LiteLLM
&lt;/h2&gt;

&lt;p&gt;Two cases where the honest answer is "keep what you have":&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You are one of the teams doing LiteLLM well.&lt;/strong&gt; If you have a platform person who already owns the deployment, patches within hours of CVE announcements, has secret rotation set up, and monitors upstream provider health — you are running it correctly. Switching gains you nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You need customization at the gateway layer that only a codebase you control gives you.&lt;/strong&gt; Some teams add custom auth plugins, custom routing rules, or custom logging pipelines that would be awkward to reproduce on a managed gateway. If you have written more than a few hundred lines of LiteLLM extensions, you are probably in this camp.&lt;/p&gt;

&lt;p&gt;For everyone else, the question worth asking is: does your team actually have the hours to keep owning the operational surface? If the answer is no, that ownership gap ships CVEs faster than the fixes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Meta Point
&lt;/h2&gt;

&lt;p&gt;An LLM gateway is a trust boundary. It holds your provider keys, sees every prompt, and often has admin access to spend caps and routing rules. The right gateway is the one your team can actually own — which is a mix of feature fit and operational fit. Do not pick on features alone; ops overhead is real and compounds.&lt;/p&gt;

&lt;p&gt;The teams that get hurt by CVEs like the LiteLLM one are the teams that installed the gateway eighteen months ago, moved on, and never revisited whether they had the capacity to keep it patched. That is true of any middleware, not just LLM middleware. Revisit the choice once a year. The stakes are quietly getting higher on both sides.&lt;/p&gt;

&lt;p&gt;If you want to talk through your specific setup, &lt;a href="mailto:sales@leanroute.dev"&gt;email us&lt;/a&gt;. We will tell you honestly if we are a fit and point you elsewhere if we are not.&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/BerriAI/litellm/security/advisories" rel="noopener noreferrer"&gt;LiteLLM CVE-2026-35029 advisory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/self-hosting-an-llm-gateway"&gt;Self-Hosting an LLM Gateway: When It's Right, When It's Not&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/openrouter-alternative-byok"&gt;OpenRouter Alternative: When BYOK Beats Per-Request Markup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/blog/migrating-from-openrouter-to-leanroute"&gt;Migrating from OpenRouter to Leanroute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/docs" rel="noopener noreferrer"&gt;Leanroute docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>litellm</category>
      <category>openrouter</category>
      <category>aigateway</category>
      <category>portkey</category>
    </item>
    <item>
      <title>LiteLLM Alternative - Self-hosting an LLM Gateway: when it's right and when it's not</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Thu, 03 Sep 2026 02:29:30 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/litellm-alternative-self-hosting-an-llm-gateway-when-its-right-and-when-its-not-50op</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/litellm-alternative-self-hosting-an-llm-gateway-when-its-right-and-when-its-not-50op</guid>
      <description>&lt;h1&gt;
  
  
  Self-Hosting an LLM Gateway: When It's Right, When It's Not
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An LLM gateway sits on your critical path with your provider keys, your prompts, and often admin access to spend caps and routing rules. When you self-host it, you own the security posture, the patch cadence, and the full ops stack: Postgres, Redis, monitoring, on-call. The CVE-2026-35029 privilege escalation in LiteLLM is a reminder that middleware is not something you can install once and forget. This post is about what self-hosting actually costs on a working month, when it is still the right call, and when a managed gateway makes more sense. It is not an argument that managed is better than self-hosted. It is an argument that the choice deserves an honest cost model instead of a default.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What Just Happened
&lt;/h2&gt;

&lt;p&gt;A few days ago a privilege-escalation issue landed in LiteLLM (CVE-2026-35029, along with a few related chains). In short: a read-only viewer account could reach a config path that let it modify configuration, block keys or endpoints, and in some chains escalate further inside the gateway. The maintainers patched it. LiteLLM users who apply the update quickly are fine.&lt;/p&gt;

&lt;p&gt;That is not a LiteLLM-specific problem. Every popular OSS middleware has shipped security fixes in the last two years. Envoy, Kong, Traefik, Consul, even Nginx itself. Complex middleware with an admin surface and a lot of moving pieces is a place where privilege boundaries slip. It always has been.&lt;/p&gt;

&lt;p&gt;The reason this one caught attention is that LLM gateways are a newer category. Many teams installed one during 2024-2025 because they needed cost tracking and provider failover, and then never revisited the operational side. The CVE is a good moment to revisit it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why LLM Middleware Is a Higher-Value Target Than It Looks
&lt;/h2&gt;

&lt;p&gt;Three reasons LLM gateways are worth attacking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The gateway holds every provider key in your stack.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;OpenAI, Anthropic, Google, xAI, DeepSeek, whatever else. If those keys have no per-model spend cap on the upstream side (most do not have granular caps), stealing them is worth real money to the attacker. A compromised OpenAI key can be used to burn thousands of dollars in a few hours before rate limits kick in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The gateway sees every prompt.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prompts routinely contain data the sending team did not intend to expose: customer PII pasted into a system prompt, secrets embedded in a code snippet, internal document content in a RAG retrieval, drafted emails that reveal deal terms. The gateway is a natural exfiltration point because it has all of it in one place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Gateways often ship with weaker default auth than the app calling them.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The gateway was often built as an internal tool: it started life on a private network with basic-auth admin access, and the auth surface never got hardened when the tool became critical infrastructure. Many self-hosted deployments still have their admin UI reachable from the public internet on the same origin as the API, protected only by a shared bearer token stored in an env var.&lt;/p&gt;

&lt;p&gt;Web API gateways went through the same maturation curve between 2017 and 2020. Kong, Envoy, and Traefik all had multiple privilege-escalation CVEs in that window. What is happening to LLM middleware now is that same curve, compressed into a shorter window because the category matured faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Cost of Self-Hosting: An Honest Checklist
&lt;/h2&gt;

&lt;p&gt;Here is what you actually take on when you decide to self-host an LLM gateway. Not the marketing version, the working-month version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Patch cadence.&lt;/strong&gt; Someone on your team needs to be watching the upstream repo for CVE announcements, evaluating whether they apply to your deployment, testing patches in staging, and deploying them fast. Estimate: 2-4 hours per month in a quiet month, 10+ hours in a month with a critical CVE.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Secret handling.&lt;/strong&gt; BYOK keys for every provider, an admin key, database passwords, Redis credentials, JWT signing keys if you added auth. Rotation policy, storage (Vault? sealed secrets? env vars?), audit trail on who accessed what. Estimate: one-time setup of 8-16 hours, ongoing 1-2 hours per month for rotation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database operations.&lt;/strong&gt; Postgres for request logs, usage aggregations, per-org config. You are now responsible for backups, restore drills, connection pooling, index maintenance, and cost tracking as the log table grows. Estimate: 2-4 hours per month once stable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis operations.&lt;/strong&gt; Cache, rate limits, spend counters. Persistence config, memory limits, monitoring for eviction pressure. Estimate: 1-2 hours per month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring.&lt;/strong&gt; Uptime, latency, error rates, upstream provider health, cache hit rates, spend against per-org caps. Someone needs to configure alerting thresholds and respond to pages. Estimate: 4-8 hours one-time setup, 1-3 hours per month tuning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On-call.&lt;/strong&gt; LLM outages happen. OpenAI has multi-hour incidents roughly monthly. Anthropic has intermittent 5xx storms. When those happen, your gateway is retrying, failing over, hopefully caching, and generally under load in ways it is not under load the rest of the time. Someone needs to be reachable. Estimate: rotating burden across 2+ engineers, or the founder is on-call 24/7.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Config changes without downtime.&lt;/strong&gt; Adding a new provider, changing routing rules, updating guardrail policies, adjusting spend caps. All these need to happen without a restart if you have real traffic. Estimate: implicit in the platform team's ongoing time, hard to break out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adds up to:&lt;/strong&gt; For a mature self-hosted LLM gateway serving real production traffic, budget 15-25 engineer-hours per week across your team. Not per month. Per week.&lt;/p&gt;

&lt;p&gt;At a rough fully-loaded engineer cost of $150k/year in the US or $75k in APAC, that is $22-56k per year of engineering time going into keeping the gateway working. That is the number to compare against managed pricing, not the "$0 for OSS" number.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Self-Hosting IS the Right Call
&lt;/h2&gt;

&lt;p&gt;None of the above means managed always wins. There are real cases where self-hosting is correct:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You have data residency requirements no managed vendor can meet.&lt;/strong&gt; Some regulated verticals (regional banking, defense, government) require that inference metadata never leave a specific jurisdiction, and no managed gateway currently has infrastructure in that jurisdiction. Self-host in-region.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You already have a platform team that runs this class of software.&lt;/strong&gt; If you have SREs who already operate Envoy or Kong for other services, adding an LLM gateway to their scope is marginal cost. The delta is smaller than for a team that has never run middleware before.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You need deep compliance controls that require end-to-end audit.&lt;/strong&gt; Some SOC 2 or ISO 27001 audits require that you can prove which humans touched which config knobs and when. A managed vendor gives you their audit trail, not yours. If your auditor wants your audit trail, you host.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You are at a volume where the managed markup exceeds a dedicated engineer.&lt;/strong&gt; If you are pushing tens of billions of tokens per month, a 5-10% markup on inference is real money. At some threshold (often around $500k/year in LLM spend), a dedicated platform engineer to run the gateway becomes cheaper than the vendor's take. Do the math.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Managed IS the Right Call
&lt;/h2&gt;

&lt;p&gt;The other side, also honestly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Small team, under 10 engineers.&lt;/strong&gt; You do not have a dedicated platform person, and the founder-engineers who would end up owning the gateway have higher-leverage work to do. Managed is the right call by a wide margin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You do not already run OSS middleware in production.&lt;/strong&gt; If nobody on your team currently gets paged for Envoy or Kong, adding an LLM gateway is not marginal. It is a new class of on-call that will crowd out other work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You do not want to be paged when OpenAI goes down.&lt;/strong&gt; Managed gateways handle upstream provider outages for you: they retry, fail over, degrade gracefully. When you self-host, you get to watch your own retries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The vendor is on-call for their infrastructure and you are on-call for your app.&lt;/strong&gt; That split is often the right one at your stage.&lt;/p&gt;

&lt;h2&gt;
  
  
  If You Are Currently on LiteLLM and Considering a Switch
&lt;/h2&gt;

&lt;p&gt;For a Leanroute-specific answer: the migration path is short because Leanroute exposes an OpenAI-compatible endpoint. In most cases the change is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign up, mint a runtime key, add your provider keys via BYOK.&lt;/li&gt;
&lt;li&gt;Change your &lt;code&gt;OPENAI_BASE_URL&lt;/code&gt; from your LiteLLM instance to &lt;code&gt;https://api.leanroute.dev/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Keep your existing model IDs (&lt;code&gt;openai/gpt-5.6-luna&lt;/code&gt;, &lt;code&gt;anthropic/claude-sonnet-5&lt;/code&gt;, etc.) — they work as-is.&lt;/li&gt;
&lt;li&gt;Verify with a canary request. Check the &lt;code&gt;x-gateway-provider&lt;/code&gt; response header to prove routing.&lt;/li&gt;
&lt;li&gt;Cut over the rest of your traffic when the canary is clean.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a typical deployment that takes an afternoon. For a deployment with heavy per-org config, custom guardrails, or unusual auth, budget a day or two. Full docs at &lt;a href="https://leanroute.dev/docs" rel="noopener noreferrer"&gt;leanroute.dev/docs&lt;/a&gt;. If you want a hand, &lt;a href="mailto:sales@leanroute.dev"&gt;sales@leanroute.dev&lt;/a&gt; will reply personally.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Meta Point
&lt;/h2&gt;

&lt;p&gt;An LLM gateway is a trust boundary. When you own the gateway, you own the trust: your team's patching, your team's secret handling, your team's audit trail. When a vendor owns it, they own the trust, and their business exists on being trusted. Both models work. Both models fail when the owner is not paying attention.&lt;/p&gt;

&lt;p&gt;The wrong answer is not making an active choice. The teams that get hurt by CVEs like the LiteLLM one are the teams that installed the gateway eighteen months ago, moved on, and never revisited whether they had the capacity to keep it patched. That is true of any middleware, not just LLM middleware.&lt;/p&gt;

&lt;p&gt;If you are self-hosting, make sure someone on your team owns the operational surface, and give them the time to actually own it. If you are on managed, make sure the vendor's security posture and status page match your risk tolerance. Either way, revisit the choice once a year. The stakes are quietly getting higher on both sides.&lt;/p&gt;

&lt;p&gt;If you are on the fence between the two, the honest question to ask is: do we have the team, and are we willing to give that team the hours? If either answer is no, managed is the right call.&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/BerriAI/litellm/security/advisories" rel="noopener noreferrer"&gt;LiteLLM CVE-2026-35029 advisory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/docs" rel="noopener noreferrer"&gt;Leanroute docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leanroute.dev/#pricing" rel="noopener noreferrer"&gt;Leanroute pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aigateway</category>
      <category>litellm</category>
      <category>saas</category>
      <category>security</category>
    </item>
    <item>
      <title>Chain-aware Authorization: OPA + MCP for the A2A Auth Problem</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Sat, 29 Aug 2026 05:09:35 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/chain-aware-authorization-opa-mcp-for-the-a2a-auth-problem-4d63</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/chain-aware-authorization-opa-mcp-for-the-a2a-auth-problem-4d63</guid>
      <description>&lt;h1&gt;
  
  
  Chain-aware Authorization: OPA + MCP for the A2A Auth Problem
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI agents are nothing but APIs on cron with autonomy and reasoning. That means authorization needs to happen at every tool call, not just at session start. And the policy needs to see the full call chain to make sane decisions, otherwise a "read PII" and a "send email" both scoped correctly still add up to a data leak. The pattern I think will become standard is OPA as a sidecar to every MCP server, evaluating each tool call against a Rego policy that treats the call chain as input. I am calling this chain-aware authorization because nobody has named it yet and every agent stack is going to need it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Problem That Keeps Coming Up
&lt;/h2&gt;

&lt;p&gt;I keep seeing this in LinkedIn posts. Someone builds an agent, gives it a bunch of tool scopes, and then discovers that the composition of tools is where all the actual risk lives.&lt;/p&gt;

&lt;p&gt;Here is the shape of it. Say your agent has &lt;code&gt;read:crm&lt;/code&gt; and &lt;code&gt;send:email&lt;/code&gt;. Both scopes are legit on their own. Reading a customer record, fine. Sending an email, fine. But an agent that reads a customer's PII and then sends an outbound email based on what it read? That is the shape of a data exfiltration. Neither scope caught it because they were granted separately, at session start, and never re-checked against each other.&lt;/p&gt;

&lt;p&gt;The moment agents can chain tool calls, session-scope auth is done. It sees each call in isolation. It cannot look at what came before. And what came before is often the entire story.&lt;/p&gt;

&lt;p&gt;This is the A2A auth problem. And in the projects I have been part of over the last few years, I have not seen anyone solve it cleanly. Everyone hand-rolls something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Usual Answers Are Bad
&lt;/h2&gt;

&lt;p&gt;Three patterns dominate today, and all three fail the composition test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One key per session, static scopes.&lt;/strong&gt; What every framework does out of the box. Grant &lt;code&gt;read:crm&lt;/code&gt; and &lt;code&gt;send:email&lt;/code&gt; at session start, agent uses them the whole loop. Zero re-authorization between calls. This is the version of "auth" that says "the door was locked when you walked in" and then just gives you the run of the house. Easy to build. Easy to break.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One key per tool, narrower scopes.&lt;/strong&gt; Better for blast radius, worse for ergonomics. The agent is now juggling 15 credentials. And composition is still unrestricted, because if it needs both tools, it holds both keys. The keys just look nicer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Framework-native ACLs.&lt;/strong&gt; LangGraph guards, CrewAI validators, custom middleware in every agent stack. All hand-rolled, all different, all buried in application code that nobody security-reviews. When your compliance team asks "prove which tool calls this agent was allowed to make last quarter," nobody has a real answer. They have a guess and a Slack thread.&lt;/p&gt;

&lt;p&gt;None of these treat auth as what it actually is. Auth is a pipeline concern. Not an application concern. The moment you make it the application's job, it stops getting done.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Lesson From Web APIs (Which We Already Learned)
&lt;/h2&gt;

&lt;p&gt;We solved this exact problem a decade ago for web services. Two patterns won:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Envoy + OPA.&lt;/strong&gt; Envoy sits as a reverse proxy in front of every service. OPA sits as a sidecar next to Envoy. Every request from outside hits Envoy, which asks OPA "is this allowed?" before forwarding to the service. The service does not know OPA exists. Auth is a network-layer concern.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Istio auth policies.&lt;/strong&gt; Same idea at the service mesh. Every east-west call gets policy-checked. The mesh does not care what the service is.&lt;/p&gt;

&lt;p&gt;The lesson from both patterns is the same. Authorization belongs in a layer that sees every call and knows nothing about what the calls are guarding. If the service has to opt in, it does not get done.&lt;/p&gt;

&lt;p&gt;AI agents in 2026 are exactly where web services were in 2016. Every framework rolls its own auth in application code. Every framework's auth is bad. The pattern that fixed it before is going to fix it again.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pattern: Chain-aware Authorization
&lt;/h2&gt;

&lt;p&gt;Here is what the stack looks like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      Agent (LangGraph, CrewAI, Claude Code, whatever)
                        │
                        ▼
                  MCP Server
                        │
                  ┌─────┴─────┐
                  │           │
                  ▼           ▼
              OPA Sidecar  Tool Registry
                  │           │
                  ▼           ▼
             Allow / Deny  Actual Tool
                            (DB, API, filesystem)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every tool call goes through the MCP server. Before the server dispatches to the actual tool, it calls out to an OPA sidecar with a payload that includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The tool name being invoked&lt;/li&gt;
&lt;li&gt;The arguments the agent wants to pass&lt;/li&gt;
&lt;li&gt;The identity of the agent and the human it acts for&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The full chain of tool calls made so far in this session&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Any data returned from previous tool calls the policy might care about (redact or hash if needed)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;OPA runs a Rego policy against this input. It returns one of three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Allow.&lt;/strong&gt; MCP forwards the call to the tool as normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deny.&lt;/strong&gt; MCP returns an error to the agent, ideally with a policy reason so the agent can adapt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transform.&lt;/strong&gt; MCP forwards a modified version. This is the underrated one. The policy can redact fields from the response before the agent sees them, add a filter to a DB query, or rewrite the target of an outbound call.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, when I first thought about this, I said "OPA is stateless, we need to make it stateful." I was wrong about the framing. OPA policies are pure functions of their input, and that is actually the whole reason this works. You do not need OPA to become stateful. You need to pass the state as input. The chain is input. The policy stays pure. The state lives one layer up, in the MCP server that appends to the chain as tool calls happen.&lt;/p&gt;

&lt;p&gt;That distinction matters because pure policies stay testable, deterministic, and auditable. The moment you try to bolt hidden state onto OPA, you lose all three.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Real Rego Example
&lt;/h2&gt;

&lt;p&gt;Here is a policy that blocks the composition case I opened with. Read PII, then try to send an email? Denied.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rego"&gt;&lt;code&gt;&lt;span class="ow"&gt;package&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;authz&lt;/span&gt;

&lt;span class="ow"&gt;default&lt;/span&gt; &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="c1"&gt;# Track which sensitive data types the agent has read this session.&lt;/span&gt;
&lt;span class="c1"&gt;# `input.chain` is the array of prior tool calls, oldest first.&lt;/span&gt;
&lt;span class="n"&gt;sensitive_data_read&lt;/span&gt; &lt;span class="n"&gt;contains&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ow"&gt;some&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chain&lt;/span&gt;
    &lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"crm.read_customer"&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s2"&gt;"pii"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;sensitive_data_read&lt;/span&gt; &lt;span class="n"&gt;contains&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ow"&gt;some&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chain&lt;/span&gt;
    &lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"vault.read_secret"&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s2"&gt;"credential"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Outbound network tools that could exfiltrate data.&lt;/span&gt;
&lt;span class="n"&gt;outbound_tool&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"email.send"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"http.post"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"webhook.dispatch"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# The rule. Allow unless the agent has read sensitive data AND is now&lt;/span&gt;
&lt;span class="c1"&gt;# trying to make an outbound call. Neither the read nor the send is&lt;/span&gt;
&lt;span class="c1"&gt;# blocked in isolation. Only the composition.&lt;/span&gt;
&lt;span class="n"&gt;deny_reason&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s2"&gt;"read_then_send_composition"&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;outbound_tool&lt;/span&gt;
    &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sensitive_data_read&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;deny_reason&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent's call chain gets passed in as &lt;code&gt;input.chain&lt;/code&gt;. The current call is &lt;code&gt;input.tool&lt;/code&gt;. That is the whole policy. A handful of rules. Testing it is one Rego test file. Auditing it is a five minute code review.&lt;/p&gt;

&lt;p&gt;Compare that to "add a check in the LangGraph node that calls email.send," which is what most stacks do today. That check lives in one framework, in one node, in one repo, invisible to security review. If a new dev adds a second email node next month, they will forget the check.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Actually Gives You
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Interoperable.&lt;/strong&gt; Any MCP server + any OPA sidecar + any Rego policy. Swap the agent framework, keep the policy. Swap the MCP server, keep the policy. Swap OPA for a home-grown evaluator, keep the same policy interface. Nothing else in the stack cares.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auditable.&lt;/strong&gt; Every allow, deny, and transform is a log line with the full input and the policy version. When someone asks "prove this agent could not exfiltrate customer data," you point at the OPA logs. Rego has good tooling here already because enterprise Kubernetes has been running this pattern at scale for years.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context-aware.&lt;/strong&gt; The policy sees the whole story. Rules like "no more than three writes to the same table per hour," "no email send after any finance.* read," "no LLM call over $0.10 unless the human approved this session," all of these become one-liners.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testable.&lt;/strong&gt; Rego has a first-class test framework. Every rule ships with test cases that fake &lt;code&gt;input.chain&lt;/code&gt;. You catch the "oops, this rule breaks the happy path" case before it goes live.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Portable.&lt;/strong&gt; OPA is a CNCF graduated project. Rego is not going anywhere. Policies you write today will still evaluate in five years. Your bespoke LangGraph guard, on the other hand, is at the mercy of the framework maintainer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Still Hard
&lt;/h2&gt;

&lt;p&gt;I want to be honest about the tradeoffs, because I hate reading blog posts that pretend the recommended pattern is free.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Latency.&lt;/strong&gt; Every tool call now includes a round trip to OPA. OPA is fast, usually sub-millisecond for well-written policies, but for agent loops that fire hundreds of tool calls per session, it adds up. Run OPA as a true sidecar in the same pod so the network hop is loopback. Keep policies small. Cache policy decisions where the input is stable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Policy authoring is a real skill.&lt;/strong&gt; Rego has a learning curve, and small teams may not have anyone who wants to own it. My workaround is to treat policy authoring as a security-team activity and start from an open-source policy library that you adapt, rather than writing from scratch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The chain has to be trusted.&lt;/strong&gt; If the agent lies about its chain (says "no previous calls" when there were 20), the policy is worthless. This is why the MCP server has to be the one appending to the chain and the enforcement point. The agent cannot forge what it does not write.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cross-agent policies are unsolved.&lt;/strong&gt; When agent A calls agent B, whose chain is the input? Both. The right answer is probably "merge the callee's chain with the caller's chain, policy sees the union." But this is not a settled pattern yet. If you are shipping A2A today, be honest with yourself that the auth story is provisional.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Sits at Leanroute
&lt;/h2&gt;

&lt;p&gt;We are implementing chain-aware authorization for LLM routing decisions internally. Every LLM call through the gateway is a policy decision. Which provider, at what price, with what scope. The current implementation uses hand-rolled rules and per-key spend caps. We are migrating toward OPA-backed policy so customers can bring their own rules without patching our code.&lt;/p&gt;

&lt;p&gt;If you want to try the pattern today, the &lt;code&gt;@leanroute/mcp-server&lt;/code&gt; package on npm is a good starting point. It has the MCP hooks you need to insert an OPA call between the tool dispatch and the actual tool. I plan to publish a reference implementation of the full sidecar setup in the next few weeks. If you want the code as soon as it drops, follow the &lt;a href="https://github.com/leanroute/ai-gateway" rel="noopener noreferrer"&gt;Leanroute GitHub&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AI agents are nothing but APIs on cron with autonomy and reasoning. Everything we learned about API authorization still applies.&lt;/li&gt;
&lt;li&gt;Session-scope auth cannot handle composition attacks. Chain-aware auth can.&lt;/li&gt;
&lt;li&gt;The right primitive is OPA, running as a sidecar to your MCP server. Every tool call gets policy-checked against the full call chain.&lt;/li&gt;
&lt;li&gt;Rego policies stay stateless, pure, testable, and auditable. The chain is input, not state.&lt;/li&gt;
&lt;li&gt;The pattern is called chain-aware authorization. Nobody named it. So I did.&lt;/li&gt;
&lt;li&gt;Interoperable. Portable. Boring in the way infrastructure should be.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  About Leanroute
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Leanroute is One Gateway for Models and Tools.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Route LLM calls across 13 providers, forward MCP tools, enforce policy at the gateway. One integration point for cost, routing, and authorization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leanroute.dev" rel="noopener noreferrer"&gt;Learn more at leanroute.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aiagents</category>
      <category>mcp</category>
      <category>opa</category>
      <category>a2a</category>
    </item>
    <item>
      <title>Three new packages to make Leanroute routing a two-line install</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Thu, 27 Aug 2026 16:12:02 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/three-new-packages-to-make-leanroute-routing-a-two-line-install-3eb9</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/three-new-packages-to-make-leanroute-routing-a-two-line-install-3eb9</guid>
      <description>&lt;p&gt;I posted about cutting Claude Code bills 67% by routing across 13 providers instead of paying Anthropic for every request. A few people asked "cool, but how do I actually integrate this into my existing app?"&lt;/p&gt;

&lt;p&gt;Three new packages shipped today.&lt;/p&gt;

&lt;h2&gt;
  
  
  @leanroute/vercel-ai-sdk
&lt;/h2&gt;

&lt;p&gt;If you are on Next.js and use the Vercel AI SDK, this is a drop-in provider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;leanroute&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@leanroute/vercel-ai-sdk&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;generateText&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;generateText&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;leanroute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;deepseek/deepseek-v4-flash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same interface as &lt;code&gt;@ai-sdk/openai&lt;/code&gt;, but the string can be any of 24 headline SKUs across OpenAI, Anthropic, Google, DeepSeek, Groq, xAI, and more. Streaming, tool calling, structured output, and Next.js server components all work out of the box because it wraps &lt;code&gt;createOpenAI&lt;/code&gt; from the AI SDK.&lt;/p&gt;

&lt;h2&gt;
  
  
  @leanroute/langchain
&lt;/h2&gt;

&lt;p&gt;LangChain users get the same treatment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ChatLeanroute&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@leanroute/langchain&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ChatLeanroute&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;anthropic/claude-sonnet-5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Returns a &lt;code&gt;ChatOpenAI&lt;/code&gt; instance, so it plugs into every runnable, agent, and chain that accepts a &lt;code&gt;BaseChatModel&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  create-leanroute-app
&lt;/h2&gt;

&lt;p&gt;New project? Skip the setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-leanroute-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two templates. &lt;code&gt;next&lt;/code&gt; gives you a streaming chat UI with a model picker, cost display, and Vercel deploy config. &lt;code&gt;node&lt;/code&gt; gives you the OpenAI SDK pre-configured with three example scripts. Both take about 60 seconds from &lt;code&gt;npx&lt;/code&gt; to running app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;Grab a runtime key at &lt;a href="https://leanroute.dev/dashboard/keys" rel="noopener noreferrer"&gt;leanroute.dev/dashboard/keys&lt;/a&gt;, export it, install the package that matches your stack. Full walkthrough in the &lt;a href="https://leanroute.dev/blog/cut-claude-code-bills-60-percent-multi-provider-routing" rel="noopener noreferrer"&gt;original post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All three packages: Apache-2.0, source in &lt;a href="https://github.com/leanroute/ai-gateway" rel="noopener noreferrer"&gt;github.com/leanroute/ai-gateway&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>vercel</category>
      <category>langchain</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Cut Claude Code Bills 60% by Routing to DeepSeek and Groq</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Thu, 27 Aug 2026 02:48:49 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/cut-claude-code-bills-60-by-routing-to-deepseek-and-groq-4kkn</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/cut-claude-code-bills-60-by-routing-to-deepseek-and-groq-4kkn</guid>
      <description>&lt;h1&gt;
  
  
  Cut Claude Code Bills 60% by Routing to DeepSeek and Groq
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Claude Code is great. Claude Code on Sonnet 5 for every request is expensive. If you point Claude Code at a gateway that speaks OpenAI, Anthropic, and MCP, you can keep the same workflow and route the cheap work (refactors, small edits, log searches, unit tests) to DeepSeek V4 Flash or Groq gpt-oss, while keeping the hard work on Sonnet or Opus. On a real developer workload the blended bill drops between 60% and 92%.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;Claude Code is the default reason a lot of developers get an Anthropic bill in the first place. Long sessions, big context, tool use, MCP, sub-agents. Each of those things is a great feature. Each of those things is also a token multiplier.&lt;/p&gt;

&lt;p&gt;Here is what a Sonnet 5 heavy user looks like today, in round numbers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input $/M&lt;/th&gt;
&lt;th&gt;Output $/M&lt;/th&gt;
&lt;th&gt;Blended 5:1 per 6M tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;claude-opus-5&lt;/td&gt;
&lt;td&gt;5.00&lt;/td&gt;
&lt;td&gt;25.00&lt;/td&gt;
&lt;td&gt;$50.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;claude-sonnet-5&lt;/td&gt;
&lt;td&gt;2.00&lt;/td&gt;
&lt;td&gt;10.00&lt;/td&gt;
&lt;td&gt;$20.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;claude-haiku-4-5&lt;/td&gt;
&lt;td&gt;1.00&lt;/td&gt;
&lt;td&gt;5.00&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Blended 5:1 (5 input to 1 output) is a reasonable approximation for interactive coding traffic. If you push 6M tokens a day through Sonnet 5, that is about $600 a month. Opus is 2.5x that.&lt;/p&gt;

&lt;p&gt;Now the same math for the models you never think about when you are inside Claude Code:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input $/M&lt;/th&gt;
&lt;th&gt;Output $/M&lt;/th&gt;
&lt;th&gt;Blended 5:1 per 6M tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;deepseek-v4-flash (off-peak)&lt;/td&gt;
&lt;td&gt;0.22&lt;/td&gt;
&lt;td&gt;0.66&lt;/td&gt;
&lt;td&gt;$1.76&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;deepseek-v4-pro (off-peak)&lt;/td&gt;
&lt;td&gt;0.66&lt;/td&gt;
&lt;td&gt;1.98&lt;/td&gt;
&lt;td&gt;$5.28&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;groq/openai/gpt-oss-120b&lt;/td&gt;
&lt;td&gt;0.15&lt;/td&gt;
&lt;td&gt;0.60&lt;/td&gt;
&lt;td&gt;$1.35&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;groq/openai/gpt-oss-20b&lt;/td&gt;
&lt;td&gt;0.075&lt;/td&gt;
&lt;td&gt;0.30&lt;/td&gt;
&lt;td&gt;$0.675&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;openai/gpt-5-nano&lt;/td&gt;
&lt;td&gt;0.05&lt;/td&gt;
&lt;td&gt;0.40&lt;/td&gt;
&lt;td&gt;$0.65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;openai/gpt-5-mini&lt;/td&gt;
&lt;td&gt;0.25&lt;/td&gt;
&lt;td&gt;2.00&lt;/td&gt;
&lt;td&gt;$3.25&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;DeepSeek V4 Flash is roughly 11x cheaper than Sonnet 5 on blended cost. GPT-5 Nano is roughly 30x cheaper. Groq gpt-oss-120b sits in between at 15x cheaper, and it runs on LPUs, so it is fast enough that you barely feel the round trip.&lt;/p&gt;

&lt;p&gt;The question is not whether these numbers are real. They are. The question is how you actually use these cheaper models from inside your Claude Code session without breaking your workflow.&lt;/p&gt;

&lt;p&gt;That is what the rest of this post is about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Was Hard Before
&lt;/h2&gt;

&lt;p&gt;Claude Code talks to Anthropic. That is by design. Anthropic ships the CLI, Anthropic owns the model, Anthropic owns the invoice.&lt;/p&gt;

&lt;p&gt;If you want to route some of that traffic to a different model, you have historically had a few bad options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Manually switch tools. Pop out of Claude Code, run something in Cursor with a different provider, paste the answer back. Slow, breaks your context, kills your flow.&lt;/li&gt;
&lt;li&gt;Run a local proxy. Set up LiteLLM or a Docker container, override &lt;code&gt;ANTHROPIC_BASE_URL&lt;/code&gt;, hope the response format matches. Works, but you are now maintaining infrastructure.&lt;/li&gt;
&lt;li&gt;Live with the bill. What most people do.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The reason none of these are great is that Claude Code was built around one wire format (Anthropic Messages) and one MCP surface. If you want to route to OpenAI, DeepSeek, Groq, xAI, or one of the Chinese labs, you need something in the middle that speaks both wire formats and forwards MCP correctly.&lt;/p&gt;

&lt;p&gt;That thing is a gateway.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;Here is the whole stack once you have a gateway in the middle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude Code
     │
     ▼
Leanroute Gateway
     ├──▶ Anthropic (claude-sonnet-5, opus-5, haiku-4-5, fable-5)
     ├──▶ OpenAI (gpt-5-nano, gpt-5-mini, gpt-5.6-luna, terra, sol)
     ├──▶ DeepSeek (v4-flash, v4-pro, v4-flash-vision-exp)
     ├──▶ Groq (openai/gpt-oss-20b, openai/gpt-oss-120b)
     ├──▶ Google, xAI, Qwen, GLM, Doubao, Kimi
     ├──▶ Sarvam, Krutrim
     └──▶ Meta (Muse Spark, Muse Code)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same Claude Code binary. Same tools, same MCP servers, same prompt cache behaviour. What changes is the endpoint your local &lt;code&gt;claude&lt;/code&gt; is pointed at, and which model string you type.&lt;/p&gt;

&lt;p&gt;Setup is three steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1. Get a Leanroute key.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sign up at &lt;a href="https://leanroute.dev" rel="noopener noreferrer"&gt;leanroute.dev&lt;/a&gt;, top up some credit, mint a runtime key from the dashboard. The key looks like &lt;code&gt;gw_live_...&lt;/code&gt; and it works anywhere the OpenAI or Anthropic wire format works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2. Point Claude Code at Leanroute.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set two environment variables in your shell profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.leanroute.dev/anthropic"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"gw_live_your_key_here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;anthropic&lt;/code&gt; subpath tells Leanroute to speak Anthropic Messages wire format. Everything Claude Code sends, including tool calls, images, MCP &lt;code&gt;mcp_servers&lt;/code&gt; blocks, and system prompts, forwards through unmodified.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3. Install the Leanroute MCP server.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @leanroute/mcp-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in your Claude Code MCP config (&lt;code&gt;~/.config/claude/mcp.json&lt;/code&gt; or the equivalent for your OS), add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"leanroute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"@leanroute/mcp-server"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"LEANROUTE_ADMIN_KEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gw_admin_your_admin_key_here"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The MCP server exposes tools like &lt;code&gt;list_models&lt;/code&gt;, &lt;code&gt;get_pricing&lt;/code&gt;, &lt;code&gt;cheapest_for&lt;/code&gt;, &lt;code&gt;get_usage&lt;/code&gt;, and &lt;code&gt;route_call&lt;/code&gt;. Now Claude Code can ask itself, mid conversation, questions like "what is the cheapest flagship model I can use for this refactor" and route accordingly.&lt;/p&gt;

&lt;p&gt;That is the whole install.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Routes to Savings
&lt;/h2&gt;

&lt;p&gt;Here is where the actual money comes from. Each of these is a real substitution you can make inside a Claude Code session today, along with the cost math and the rough quality tradeoff.&lt;/p&gt;

&lt;h3&gt;
  
  
  Route 1: Small edits go to Groq gpt-oss-20b
&lt;/h3&gt;

&lt;p&gt;Everyone knows Sonnet is overkill for renaming a variable, but everyone uses it anyway because that is what Claude Code opens with. If you switch to Groq gpt-oss-20b for the small stuff, you drop from $20 per 6M tokens to $0.68. That is a 29x reduction on the blended cost, and Groq's LPU inference is fast enough (about 500 to 1000 tokens per second on the 20B) that you get the answer before you would have finished blinking.&lt;/p&gt;

&lt;p&gt;How to do it: at the start of a small-edit request, ask Claude to route to &lt;code&gt;groq/openai/gpt-oss-20b&lt;/code&gt;. The MCP server sees the intent and issues the call. You still see the diff, you still approve it, but the token bill goes to Groq.&lt;/p&gt;

&lt;h3&gt;
  
  
  Route 2: Refactors and multi-file changes go to DeepSeek V4 Flash
&lt;/h3&gt;

&lt;p&gt;This is the big one. DeepSeek V4 Flash sits in the flagship tier on quality benchmarks but costs $0.22 in and $0.66 out per million tokens off-peak. Blended 5:1 that is $1.76 per 6M, versus Sonnet 5 at $20.&lt;/p&gt;

&lt;p&gt;For a typical refactor pass (read 20 files, propose changes to 5, get user feedback, re-read, revise), you can burn through 300k to 500k tokens easily. On Sonnet 5 that is about $1 to $1.60. On DeepSeek V4 Flash it is $0.09 to $0.14.&lt;/p&gt;

&lt;p&gt;Quality tradeoff is real but smaller than the price gap suggests. DeepSeek V4 Flash handles most refactoring, test generation, and boilerplate work without a noticeable step down. Where it slips is nuanced product judgement, ambiguous specs, and long-horizon multi-step reasoning. For those, you route to something better.&lt;/p&gt;

&lt;p&gt;DeepSeek has one gotcha: peak-hour pricing doubles rates during 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays. Weekends are always off-peak. If you are in North America the peak windows are your evenings, which is inconvenient. Leanroute's arbitrage router knows the schedule and will move DeepSeek traffic to a same-tier alternative (Groq gpt-oss-120b, or gpt-5.6-luna) during peak windows if you have arbitrage enabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  Route 3: The hard reasoning stays on Opus 5 or gets swapped to DeepSeek V4 Pro
&lt;/h3&gt;

&lt;p&gt;For the requests that genuinely need premium reasoning (architecture design, tricky concurrency bugs, security review), Claude Opus 5 is $50 per 6M tokens blended. DeepSeek V4 Pro is $5.28. That is a 9.5x reduction and V4 Pro is a legitimate reasoning model, not a distilled downgrade.&lt;/p&gt;

&lt;p&gt;If you trust the swap, keep arbitrage on and let the router pick V4 Pro. If you do not, keep Opus in your explicit route list and use it for the requests where you actually notice the difference.&lt;/p&gt;

&lt;p&gt;A useful discipline: at the start of the session, tell Claude something like "for design questions or bugs that touch concurrency or auth, use Opus 5. For everything else prefer the cheapest available flagship." The MCP server exposes &lt;code&gt;cheapest_for&lt;/code&gt; and &lt;code&gt;route_call&lt;/code&gt; so Claude can make that decision per request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Route 4: Log searches and simple tool calls go to GPT-5 Nano
&lt;/h3&gt;

&lt;p&gt;If your Claude Code session is doing a lot of "grep this repo," "count occurrences of X," "list files matching pattern" style tool work, the LLM is essentially orchestrating shell commands. That does not require a $2/M input model. GPT-5 Nano at $0.05 in / $0.40 out is 40x cheaper on input than Sonnet 5, and easily good enough to decide which grep to run.&lt;/p&gt;

&lt;h3&gt;
  
  
  Route 5: Vision goes to Google Gemini 3.7 Flash, or DeepSeek V4 Flash Vision
&lt;/h3&gt;

&lt;p&gt;When you paste a screenshot into Claude Code to say "why does this button look wrong," Anthropic's vision model is doing the work at Sonnet 5 rates. Google Gemini 3.7 Flash is $0.75 in / $3.75 out (intro pricing through December 31, 2026) and handles UI screenshots and diagram parsing well.&lt;/p&gt;

&lt;p&gt;DeepSeek's new v4-flash-vision-exp is even cheaper but caps images at 384 input tokens per image, which is fine for small icons and bad for full page screenshots. Leanroute keeps it explicit rather than auto-routing there, so you have to ask for it by name. Worth it when you know your images are small.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Playbook
&lt;/h2&gt;

&lt;p&gt;Here is what a real Claude Code session looks like once you have this set up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Session start.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You launch &lt;code&gt;claude&lt;/code&gt; in your project. First message you type includes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For this session, use these routing rules:
- Small edits (renames, single-line fixes): groq/openai/gpt-oss-20b
- Refactors and file-scale changes: deepseek/deepseek-v4-flash
- Design questions or bugs I flag as hard: anthropic/claude-opus-5
- Everything else: cheapest available flagship, prefer non-peak DeepSeek

Confirm and I will start.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude reads the rules, calls the MCP server's &lt;code&gt;list_models&lt;/code&gt; once to confirm they resolve, and acknowledges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;During the session.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Claude handles routing per turn. When it decides a request is a small edit, it calls &lt;code&gt;route_call&lt;/code&gt; targeting the Groq SKU. When it hits a refactor, DeepSeek V4 Flash. You still see the diff, you still see the tool calls, you still approve edits. The only thing that changed is which provider answered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;At the end.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You run one MCP call to see the damage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use the leanroute MCP to show my usage for the last 24 hours, grouped by model.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get back a table showing which SKUs answered what share of your traffic and how much each cost. On a real day of coding work, this typically looks like 70% to 80% of tokens on DeepSeek V4 Flash or Groq, 15% to 20% on Sonnet 5 or Opus 5, and the rest split across GPT-5 Nano and Gemini for tool calls and vision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Numbers on a Real Workload
&lt;/h2&gt;

&lt;p&gt;We ran this on an internal week of Claude Code work (13 developers, roughly 62 hours of active sessions, a mix of refactors, feature work, bug fixing, and code review).&lt;/p&gt;

&lt;p&gt;Without routing, all traffic on Sonnet 5, with occasional Opus escalations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total tokens: 41.8M&lt;/li&gt;
&lt;li&gt;Total cost: $487.90&lt;/li&gt;
&lt;li&gt;Average per developer: $37.53&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With routing, using the rules above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total tokens: 41.8M&lt;/li&gt;
&lt;li&gt;Total cost: $158.20&lt;/li&gt;
&lt;li&gt;Average per developer: $12.17&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is a 67.6% reduction. The split ended up at 68% DeepSeek V4 Flash, 8% Groq gpt-oss-120b, 12% Sonnet 5, 6% Opus 5, 4% GPT-5 Nano, 2% other. No one noticed a quality difference in day to day work. The two people who did notice were both doing algorithm design and stayed on Opus 5 on purpose.&lt;/p&gt;

&lt;p&gt;Your mileage will vary based on how much of your work is genuinely reasoning-hard versus pattern-matching. If most of your Claude Code time is "read this file, propose a fix," you will see the higher end of the savings range. If most of it is "design me a distributed rate limiter for a multi region deploy," you will see the lower end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Guardrails That Make This Safe
&lt;/h2&gt;

&lt;p&gt;Cheaper models are only worth it if the failure modes are bounded. A few things the gateway does by default:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failover.&lt;/strong&gt; If your primary provider returns a 5xx or gets rate limited, the gateway retries on a same-tier alternative before returning an error to Claude Code. So a DeepSeek outage during peak hours does not become a stuck session, it becomes a transparent swap to Groq or Gemini.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explicit routing.&lt;/strong&gt; If you need to pin a request to a specific provider (benchmarking, compliance, tool-call behaviour that only one provider gets right), Claude Code can send &lt;code&gt;x-gateway-routing: explicit&lt;/code&gt; on the request. Arbitrage and cheaper-model swap are both disabled for that call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Per-key spend caps.&lt;/strong&gt; You can mint runtime keys with daily and monthly USD caps in the dashboard. If your team is experimenting with routing, cap the key at $10 a day and you literally cannot lose more than $10 to a bad rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Admin keys are a separate class.&lt;/strong&gt; The key you gave the MCP server (&lt;code&gt;gw_admin_...&lt;/code&gt;) can list, mint, and revoke runtime keys and read your usage, but it cannot dispatch LLM traffic. And the key you gave Claude Code (&lt;code&gt;gw_live_...&lt;/code&gt;) can dispatch traffic but cannot mint keys or touch billing. So even a compromised MCP server cannot burn your account, and a compromised runtime key cannot escalate privileges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vision guardrail.&lt;/strong&gt; Vision-bearing requests never silently swap to a non-vision model. Some vision-capable models with restrictive image size caps (like DeepSeek's v4-flash-vision-exp with its 384 token per image ceiling) are excluded from the silent swap pool, so a "check this screenshot" request never gets truncated to a thumbnail.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Means for You
&lt;/h2&gt;

&lt;p&gt;If you have been using Claude Code every day and paying for it every day, you are probably leaving somewhere between 40% and 90% of your bill on the table. The reason you have not clawed it back is that switching providers used to mean switching tools, breaking your context, and giving up MCP.&lt;/p&gt;

&lt;p&gt;None of that is true anymore. Anthropic wire format works through any OpenAI-compatible gateway that translates. MCP servers forward cleanly. Failover keeps sessions alive. And the models that used to be "the cheap option that is not actually good enough" (DeepSeek V4 Flash, Groq gpt-oss-120b, GPT-5 Mini) crossed the quality threshold for most day to day coding work months ago.&lt;/p&gt;

&lt;p&gt;The blended savings on our own team was 67%. Yours could be more, especially if you are heavier on refactor and test work and lighter on architecture design.&lt;/p&gt;

&lt;p&gt;The install is 5 minutes. The rules go in your first message of the session. And the failure mode, if you pick the wrong split, is that some request is slightly worse than it would have been on Sonnet, and you tweak the rules for tomorrow.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code defaults to Sonnet. Sonnet is $20 per 6M tokens blended.&lt;/li&gt;
&lt;li&gt;DeepSeek V4 Flash is $1.76 per 6M for the same tier of work.&lt;/li&gt;
&lt;li&gt;Groq gpt-oss-120b is $1.35 per 6M and runs on LPUs, so it is fast.&lt;/li&gt;
&lt;li&gt;Point Claude Code at a gateway (set two env vars). Install the Leanroute MCP. Give Claude routing rules at session start.&lt;/li&gt;
&lt;li&gt;Failover, explicit routing, spend caps, and two key classes keep the worst case bounded.&lt;/li&gt;
&lt;li&gt;Real internal test: 67.6% reduction on a real week of coding, no quality complaints.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  About Leanroute
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Leanroute is One Gateway for Models and Tools.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Route Claude Code requests across 13 AI providers through a single OpenAI-compatible and Anthropic-compatible endpoint. MCP forwarding is native. Failover, cost caps, and cheaper-model routing are on by default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leanroute.dev" rel="noopener noreferrer"&gt;Get started at leanroute.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>deepseek</category>
      <category>groq</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Goodbye OpenRouter</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Tue, 18 Aug 2026 15:30:12 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/goodbye-openrouter-4i7p</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/goodbye-openrouter-4i7p</guid>
      <description>&lt;h1&gt;
  
  
  Goodbye OpenRouter: Migrate to Leanroute with flat BYOK, no per-request markup
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Already using OpenRouter and considering a move? Leanroute provides an OpenAI-compatible gateway for multiple LLM providers, with native MCP forwarding built into the same gateway. If your application already uses an OpenAI-compatible client, migration can primarily happen at the gateway layer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Migrate?
&lt;/h2&gt;

&lt;p&gt;If OpenRouter is already working for your application, why change anything?&lt;/p&gt;

&lt;p&gt;That's the right question.&lt;/p&gt;

&lt;p&gt;The answer isn't that you need another way to call LLMs.&lt;/p&gt;

&lt;p&gt;The question is whether your gateway should stop at models.&lt;/p&gt;

&lt;p&gt;Modern AI applications increasingly need both:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Models
   +
Tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're adding MCP to an application already using an LLM gateway, you may end up introducing another piece of infrastructure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
    │
    ├──────► LLM Gateway ──────► Models
    │
    └──────► MCP Infrastructure ──────► Tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With Leanroute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
       │
       ▼
   Leanroute
    /     \
   ▼       ▼
Models    MCP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;One gateway for both.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Migration
&lt;/h2&gt;

&lt;p&gt;The goal is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Change the gateway, not your application.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If your application already uses the OpenAI SDK, the integration pattern remains familiar.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://openrouter.ai/api/v1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;OPENROUTER_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  After
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_LEANROUTE_ENDPOINT&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LEANROUTE_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application can continue using the same OpenAI-compatible interface.&lt;/p&gt;

&lt;p&gt;No new provider SDK.&lt;/p&gt;

&lt;p&gt;No application-wide rewrite.&lt;/p&gt;

&lt;p&gt;No need to rebuild your model integration.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Same SDK. Same application. Different gateway.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Use the exact Leanroute endpoint and authentication values from the current documentation when implementing the migration.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Keep Your Existing Model Integrations
&lt;/h2&gt;

&lt;p&gt;Your application can continue working with the models and providers it already uses.&lt;/p&gt;

&lt;p&gt;The gateway remains the abstraction layer between your application and model providers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Application
       │
       ▼
   Leanroute
       │
   ┌───┼───────────┐
   ▼   ▼           ▼
 OpenAI  Anthropic  Google
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application doesn't need to know how the underlying provider connection is implemented.&lt;/p&gt;




&lt;h2&gt;
  
  
  Then Add MCP
&lt;/h2&gt;

&lt;p&gt;This is where the migration becomes more interesting.&lt;/p&gt;

&lt;p&gt;Instead of adding a separate MCP proxy or changing your application's architecture:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
    │
    ├── LLM Gateway
    │
    └── MCP Proxy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leanroute puts both behind the same gateway:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Application
                  │
                  ▼
              Leanroute
             /         \
            ▼           ▼
       LLM Providers   MCP Servers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add &lt;code&gt;mcp_servers&lt;/code&gt; to the request, and Leanroute handles the MCP connection server-side.&lt;/p&gt;

&lt;p&gt;Your application continues talking to one endpoint.&lt;/p&gt;




&lt;h2&gt;
  
  
  OpenRouter vs Leanroute
&lt;/h2&gt;

&lt;p&gt;The goal isn't to claim that one gateway is universally better than another.&lt;/p&gt;

&lt;p&gt;The important question is what your application needs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;OpenRouter&lt;/th&gt;
&lt;th&gt;Leanroute&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OpenAI-compatible API&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multiple LLM providers&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model routing&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BYOK&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP forwarding&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Models + tools through one gateway&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flat monthly pricing&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zero per-request markup&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The difference becomes more important as your application starts using tools alongside models.&lt;/p&gt;

&lt;p&gt;With Leanroute, MCP forwarding is part of the gateway rather than another piece of infrastructure your application needs to manage.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;The benefit isn't simply replacing one LLM gateway with another.&lt;/p&gt;

&lt;p&gt;It's reducing the number of infrastructure components your application needs to understand.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LLM Gateway
+
MCP Proxy
+
Provider SDKs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Leanroute
          Models + Tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the direction we think AI infrastructure is heading.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Migration in Three Steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Change the endpoint
&lt;/h3&gt;

&lt;p&gt;Point your existing OpenAI-compatible client at Leanroute.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Change the credentials
&lt;/h3&gt;

&lt;p&gt;Use your Leanroute credentials and provider keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Add MCP when you need it
&lt;/h3&gt;

&lt;p&gt;Add &lt;code&gt;mcp_servers&lt;/code&gt; to requests that need tool access.&lt;/p&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;Your application remains focused on the application.&lt;/p&gt;




&lt;h2&gt;
  
  
  Who Should Consider Migrating?
&lt;/h2&gt;

&lt;p&gt;If you're already using OpenRouter and you're happy with it, you don't need to migrate just because another gateway exists.&lt;/p&gt;

&lt;p&gt;But Leanroute may be worth considering if you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Want model routing and MCP behind one gateway&lt;/li&gt;
&lt;li&gt;Don't want to introduce a separate MCP proxy&lt;/li&gt;
&lt;li&gt;Want to keep an OpenAI-compatible integration&lt;/li&gt;
&lt;li&gt;Want BYOK with a predictable flat monthly cost&lt;/li&gt;
&lt;li&gt;Want your application to remain independent of individual provider SDKs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The decision should be about &lt;strong&gt;where you want your AI infrastructure to live&lt;/strong&gt;, not about replacing one API endpoint with another.&lt;/p&gt;




&lt;h2&gt;
  
  
  One Gateway for Models and Tools
&lt;/h2&gt;

&lt;p&gt;AI applications are becoming more than model consumers.&lt;/p&gt;

&lt;p&gt;They use models to reason and tools to act.&lt;/p&gt;

&lt;p&gt;That means the infrastructure layer needs to support both.&lt;/p&gt;

&lt;p&gt;That's why we built Leanroute:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One Gateway for Models and Tools.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And our broader philosophy is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;AI infrastructure should disappear behind a simple interface so developers can focus on building the actual product.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you're already using OpenRouter, you don't need to relearn the gateway model.&lt;/li&gt;
&lt;li&gt;Leanroute provides an OpenAI-compatible interface.&lt;/li&gt;
&lt;li&gt;Migration can primarily happen at the gateway layer.&lt;/li&gt;
&lt;li&gt;Native MCP forwarding lets you add tools without introducing a separate MCP gateway.&lt;/li&gt;
&lt;li&gt;The goal is one infrastructure layer for both models and tools.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  About Leanroute
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Leanroute is One Gateway for Models and Tools.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Route requests across major AI providers and connect to MCP servers through a single OpenAI-compatible endpoint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flat $15/month. BYOK. Zero per-request markup. Singapore-hosted.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leanroute.dev" rel="noopener noreferrer"&gt;Learn more about Leanroute&lt;/a&gt;&lt;/p&gt;

</description>
      <category>openrouter</category>
      <category>aigateway</category>
      <category>llmgateway</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Stop Building Your Own LLM Router</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Fri, 14 Aug 2026 12:56:24 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/stop-building-your-own-llm-router-56be</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/stop-building-your-own-llm-router-56be</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Model routing looks simple until you have to maintain it. For most teams, building and operating a custom router is infrastructure work that doesn't directly improve the product. Pre-built routing lets teams benefit from multiple models without maintaining the machinery behind them. AI infrastructure should disappear behind a simple interface so developers can focus on building the actual product.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  It Starts With One Model
&lt;/h2&gt;

&lt;p&gt;You start here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
     │
     ▼
   GPT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you need a fallback.&lt;/p&gt;

&lt;p&gt;Then a cheaper model.&lt;/p&gt;

&lt;p&gt;Then Claude.&lt;/p&gt;

&lt;p&gt;Then Gemini.&lt;/p&gt;

&lt;p&gt;Then you start thinking about latency and model quality.&lt;/p&gt;

&lt;p&gt;Eventually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 Router
              /    |    \
            GPT  Claude  Gemini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now you've built a router.&lt;/p&gt;

&lt;p&gt;What started as a simple application decision has quietly become another piece of infrastructure your team has to operate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Routing Isn't Just Picking a Model
&lt;/h2&gt;

&lt;p&gt;A production router eventually needs to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cost&lt;/li&gt;
&lt;li&gt;Latency&lt;/li&gt;
&lt;li&gt;Model capability&lt;/li&gt;
&lt;li&gt;Context limits&lt;/li&gt;
&lt;li&gt;Provider availability&lt;/li&gt;
&lt;li&gt;Rate limits&lt;/li&gt;
&lt;li&gt;Errors and retries&lt;/li&gt;
&lt;li&gt;Model quality&lt;/li&gt;
&lt;li&gt;Regional requirements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And these variables keep changing.&lt;/p&gt;

&lt;p&gt;A model that is the best choice today might not be the best choice next month.&lt;/p&gt;

&lt;p&gt;Providers change pricing.&lt;/p&gt;

&lt;p&gt;New models appear.&lt;/p&gt;

&lt;p&gt;Existing models improve.&lt;/p&gt;

&lt;p&gt;Availability changes.&lt;/p&gt;

&lt;p&gt;Traffic patterns change.&lt;/p&gt;

&lt;p&gt;Your router has to keep up with all of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Team Has Better Things to Build
&lt;/h2&gt;

&lt;p&gt;There's an important distinction between &lt;strong&gt;building an AI product&lt;/strong&gt; and &lt;strong&gt;building infrastructure for AI products&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If your competitive advantage is your application, spending engineering time maintaining provider health checks, model benchmarks, routing rules, and failover logic probably isn't where you want your team focused.&lt;/p&gt;

&lt;p&gt;You want to build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Product
     │
     ▼
 AI Gateway
     │
     ▼
Best Model for the Job
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The infrastructure handles the complexity.&lt;/p&gt;

&lt;p&gt;Your application stays focused on the product.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Should You Build Your Own?
&lt;/h2&gt;

&lt;p&gt;There are legitimate reasons to build custom routing.&lt;/p&gt;

&lt;p&gt;If you're operating at enormous scale, have highly specialized workloads, proprietary evaluation systems, or unusual latency and compliance requirements, custom routing can make sense.&lt;/p&gt;

&lt;p&gt;But for most application teams, &lt;strong&gt;routing is infrastructure, not the product&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You probably don't need another internal system to maintain.&lt;/p&gt;

&lt;p&gt;You need a reliable way to access the models your application needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let Infrastructure Disappear
&lt;/h2&gt;

&lt;p&gt;The best infrastructure is the infrastructure developers don't have to think about.&lt;/p&gt;

&lt;p&gt;You shouldn't need to constantly ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Which provider is healthy?&lt;/p&gt;

&lt;p&gt;Which model is cheapest?&lt;/p&gt;

&lt;p&gt;Should I retry somewhere else?&lt;/p&gt;

&lt;p&gt;Did a new model just become better?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your application should express what it needs.&lt;/p&gt;

&lt;p&gt;The infrastructure should handle the rest.&lt;/p&gt;

&lt;p&gt;That's what a good AI Gateway should do.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bigger Picture
&lt;/h2&gt;

&lt;p&gt;This is also why we think AI Gateways are evolving beyond model routing.&lt;/p&gt;

&lt;p&gt;AI applications need models.&lt;/p&gt;

&lt;p&gt;They also need tools.&lt;/p&gt;

&lt;p&gt;They shouldn't need separate infrastructure for both.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Application
                  │
                  ▼
              AI Gateway
             /          \
            ▼            ▼
       Model Routing   MCP Forwarding
            │            │
            ▼            ▼
       AI Providers   MCP Servers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal isn't to add another layer to your stack.&lt;/p&gt;

&lt;p&gt;It's to remove the layers you shouldn't have to build yourself.&lt;/p&gt;

&lt;p&gt;That's the idea behind Leanroute:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One Gateway for Models and Tools.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because ultimately:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;AI infrastructure should disappear behind a simple interface so developers can focus on building the actual product.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Building a model router is easy. Maintaining one is not.&lt;/li&gt;
&lt;li&gt;Models, providers, pricing, latency, and availability constantly change.&lt;/li&gt;
&lt;li&gt;Most application teams should consume routing infrastructure rather than build it.&lt;/li&gt;
&lt;li&gt;Developers should focus on their product, not provider infrastructure.&lt;/li&gt;
&lt;li&gt;AI Gateways can provide a unified layer for both models and tools.&lt;/li&gt;
&lt;li&gt;The goal is simple: &lt;strong&gt;AI infrastructure should disappear.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  About Leanroute
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Leanroute is One Gateway for Models and Tools.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Route requests across major AI providers and connect to MCP servers through a single OpenAI-compatible endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leanroute.dev" rel="noopener noreferrer"&gt;Learn more about Leanroute&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>apigateway</category>
      <category>programming</category>
    </item>
    <item>
      <title>hi guys, I built leanroute.dev, it's One AI Gateway for LLM and Tools. Market is flooded with LLM Gateways, so I wanted to build an AI Gateway for LLM and MCP traffic. Its the next evolution of AI Gateways!
https://www.producthunt.com/products/leanroute</title>
      <dc:creator>Leanroute</dc:creator>
      <pubDate>Tue, 11 Aug 2026 15:39:43 +0000</pubDate>
      <link>https://dev.to/lean_route_b7b5a963c28c97/hi-guys-i-built-leanroutedev-its-one-ai-gateway-for-llm-and-tools-market-is-flooded-with-llm-2fep</link>
      <guid>https://dev.to/lean_route_b7b5a963c28c97/hi-guys-i-built-leanroutedev-its-one-ai-gateway-for-llm-and-tools-market-is-flooded-with-llm-2fep</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.producthunt.com/products/leanroute" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;producthunt.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
  </channel>
</rss>
