<?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: sami</title>
    <description>The latest articles on DEV Community by sami (@badaoui).</description>
    <link>https://dev.to/badaoui</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%2F4102347%2F2af65ebf-0e50-49b8-9a61-8fad5ddc6920.png</url>
      <title>DEV Community: sami</title>
      <link>https://dev.to/badaoui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/badaoui"/>
    <language>en</language>
    <item>
      <title>Why we open-sourced cachegate, the LLM router we built for our own product</title>
      <dc:creator>sami</dc:creator>
      <pubDate>Mon, 31 Aug 2026 08:11:00 +0000</pubDate>
      <link>https://dev.to/badaoui/why-we-open-sourced-cachegate-the-llm-router-we-built-for-our-own-product-3mnj</link>
      <guid>https://dev.to/badaoui/why-we-open-sourced-cachegate-the-llm-router-we-built-for-our-own-product-3mnj</guid>
      <description>&lt;p&gt;cachegate started as a completely unglamorous internal fix. Our own product was burning money calling LLM APIs directly, mostly on requests that were exact or near-duplicates of something we'd already paid for and answered minutes earlier. So we built a small proxy that sat in front of Anthropic and OpenAI: cache what we can, route the rest to whichever provider was actually cheapest and healthy at that moment.&lt;/p&gt;

&lt;p&gt;It worked well enough internally that it stopped feeling like plumbing and started feeling like a real, small project on its own - so we pulled it out, cleaned it up, and open-sourced it under MIT as cachegate.&lt;/p&gt;

&lt;p&gt;What it is: a self-hosted, OpenAI-compatible proxy. Point an existing client's baseURL at it and nothing else about your integration changes. Behind that one endpoint:&lt;/p&gt;

&lt;p&gt;Two kinds of cache, reported honestly. An exact-match cache (same request, same everything - guaranteed-correct hit) and a semantic cache for near-duplicates (a paraphrase, reordered context) that scores above a similarity threshold. We report cache_hit_rate.exact, .semantic, and .combined as three separate numbers in /stats, because blending them into one headline hit-rate is exactly the kind of vendor-marketing figure that doesn't survive contact with real production traffic - a thing we ran into ourselves while shopping for a caching layer before deciding to just build one.&lt;/p&gt;

&lt;p&gt;Routing that doesn't pretend to be smarter than it is. You define capability tiers (router:fast-cheap, router:frontier, whatever fits your workload) and pick one of three plain strategies: cheapest healthy candidate, fastest healthy candidate, or cheapest-with-a-latency-guardrail. No blended score inventing a tradeoff on your behalf.&lt;/p&gt;

&lt;p&gt;Real savings numbers instead of inflated ones. Caching alone typically saves 20-45% of spend; adding routing on top of well-tuned traffic can reach 47-90%. Some vendors will tell you 90%+ is normal. It isn't, and we didn't want to be the next tool making that claim.&lt;/p&gt;

&lt;p&gt;What it deliberately isn't: a hosted service, a 140-provider gateway, or (yet) a vector-indexed semantic cache - the current implementation is a brute-force cosine scan over a capped Redis list per model, which is fine at single-instance self-hosted volume and not built to scale past it. All three limitations are stated plainly in the README, not buried.&lt;/p&gt;

&lt;p&gt;Try it:&lt;br&gt;
npx cachegate                                            (zero-clone)&lt;br&gt;
docker run -p 4000:4000 --env-file .env ghcr.io/idebunk/cachegate:latest&lt;br&gt;
or clone it directly: &lt;a href="https://github.com/iDebunk/cachegate" rel="noopener noreferrer"&gt;https://github.com/iDebunk/cachegate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's MIT licensed and has no relationship to any future hosted product we might build on top of it - the engine stays open regardless of what we do next. If you're fighting the same LLM-cost problem we were, we'd like to hear whether this actually helps, and where it doesn't.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>opensource</category>
      <category>ai</category>
      <category>node</category>
    </item>
  </channel>
</rss>
