<?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: Manav Shah</title>
    <description>The latest articles on DEV Community by Manav Shah (@manavshaha).</description>
    <link>https://dev.to/manavshaha</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%2F4202709%2F1e2b00f9-f3e7-41ee-a511-6325b731da71.png</url>
      <title>DEV Community: Manav Shah</title>
      <link>https://dev.to/manavshaha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manavshaha"/>
    <language>en</language>
    <item>
      <title>How Indian Startups Can Cut Their OpenAI API Bill — Real Numbers, No Theory</title>
      <dc:creator>Manav Shah</dc:creator>
      <pubDate>Sat, 24 Oct 2026 13:24:00 +0000</pubDate>
      <link>https://dev.to/manavshaha/how-indian-startups-can-cut-their-openai-api-bill-real-numbers-no-theory-2ijl</link>
      <guid>https://dev.to/manavshaha/how-indian-startups-can-cut-their-openai-api-bill-real-numbers-no-theory-2ijl</guid>
      <description>&lt;p&gt;If you are building an AI startup in India, your OpenAI bill hurts twice: once in dollars, once in rupees. Every wasted token is billed in USD and felt in INR.&lt;/p&gt;

&lt;p&gt;I build RRC Gateway, an AI API cost reducer. Last week I ran a live benchmark on our own production proxy — 50 real requests, measured, not estimated. Here is what it showed, and what it means in rupees.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Indian startups overpay
&lt;/h2&gt;

&lt;p&gt;Most Indian AI startups I talk to have the same three leaks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Repeat questions.&lt;/strong&gt; Support bots, internal tools, eval loops — the same questions asked slightly differently, answered from scratch every time. "What is your refund policy?" and "Tell me about your refund policy" are two full-price API calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bloated context.&lt;/strong&gt; System prompts plus retrieved docs mean every request carries far more tokens than the model needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Premium models doing trivial work.&lt;/strong&gt; GPT-4o classifying sentiment, formatting JSON, answering FAQs — work a model 10x cheaper could do identically.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real numbers from a live benchmark
&lt;/h2&gt;

&lt;p&gt;The benchmark: 50 requests through the gateway, three slices — exact repeats, reworded questions, and fresh unique prompts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exact repeats: 10 out of 10 served from cache at $0.00.&lt;/strong&gt; Every single one. 100% savings on those calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reworded questions: 3 out of 10 caught by semantic caching.&lt;/strong&gt; 29.4% savings there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whole mixed workload: 26% savings.&lt;/strong&gt; 1,826 tokens saved across 50 requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No cherry-picking: fresh unique prompts saved 0%, exactly as expected — there is nothing to cache the first time. The honest headline is this: &lt;strong&gt;your savings scale with your repeat rate.&lt;/strong&gt; Support-style traffic with heavy repeats saves far more than a workload where every prompt is brand new.&lt;/p&gt;

&lt;h2&gt;
  
  
  What 26% means in rupees
&lt;/h2&gt;

&lt;p&gt;Illustrative math, clearly labelled: if your startup spends $1,000 a month on OpenAI, 26% is $260 a month — roughly ₹23,000 a month at ~₹88 to the dollar, or about ₹2.7 lakh a year. That is a hire, a marketing budget, or several more months of runway. And that is the &lt;em&gt;mixed&lt;/em&gt; number — if your traffic is support-heavy, the ceiling is far higher.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to reduce OpenAI API costs in India
&lt;/h2&gt;

&lt;p&gt;The levers, in order of impact:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Semantic caching.&lt;/strong&gt; Cache answers by meaning, not exact text, so reworded duplicates never reach the provider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart routing.&lt;/strong&gt; Score each prompt for complexity; send simple work to cheap models automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context trimming.&lt;/strong&gt; Retrieve only the tokens the model actually needs instead of resending your whole knowledge base.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;RRC Gateway does all three behind one OpenAI-compatible URL — change the base URL and you are done:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;redacted&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://gateway.rrcsolutions.me/v1&lt;/span&gt;&lt;span class="sh"&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;It is in free public beta: gateway.rrcsolutions.me. If you point it at a workload, I genuinely want to hear your cache hit rate — that is the number I obsess over.&lt;/p&gt;

</description>
      <category>openai</category>
      <category>llm</category>
      <category>ai</category>
      <category>india</category>
    </item>
    <item>
      <title>I Kept Paying for the Same AI Answers — So I Built a Gateway That Caches Them</title>
      <dc:creator>Manav Shah</dc:creator>
      <pubDate>Fri, 23 Oct 2026 13:30:16 +0000</pubDate>
      <link>https://dev.to/manavshaha/i-kept-paying-for-the-same-ai-answers-so-i-built-a-gateway-that-caches-them-3nf8</link>
      <guid>https://dev.to/manavshaha/i-kept-paying-for-the-same-ai-answers-so-i-built-a-gateway-that-caches-them-3nf8</guid>
      <description>&lt;h1&gt;
  
  
  I Kept Paying for the Same AI Answers — So I Built a Gateway That Caches Them
&lt;/h1&gt;

&lt;p&gt;Last month I looked at our OpenAI bill and felt sick. Not because the number was huge — because I recognized the &lt;em&gt;questions&lt;/em&gt;. We were paying full price, every single day, for answers the model had already given us.&lt;/p&gt;

&lt;p&gt;That was the moment &lt;a href="https://gateway.rrcsolutions.me" rel="noopener noreferrer"&gt;RRC Gateway&lt;/a&gt; started.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three leaks in every LLM bill
&lt;/h2&gt;

&lt;p&gt;After digging through our usage, nearly all the waste came from three places:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Duplicate prompts.&lt;/strong&gt; Support bot, internal tools, eval loops — the same questions phrased slightly differently, answered from scratch every time. "What's your refund policy?" and "Tell me about your refund policy" are two full-price API calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Bloated context.&lt;/strong&gt; Our system prompt plus retrieved docs meant every request carried ~100K tokens of context. The model needed maybe 2,000 of them. We paid for all 100K, every call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Premium models doing trivial work.&lt;/strong&gt; GPT-4o was classifying sentiment, formatting JSON, answering FAQs. Work a model 10x cheaper could do identically.&lt;/p&gt;

&lt;p&gt;Individually these look small. Multiplied across thousands of requests a day, they &lt;em&gt;are&lt;/em&gt; the bill.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I didn't just use the existing fixes
&lt;/h2&gt;

&lt;p&gt;Prompt compression (LLMLingua-style) shrinks tokens but you still pay per call. Manual model routing works until someone forgets and hardcodes the expensive model again. Exact-match caching misses every rephrased duplicate. Each fix solves one leak. I wanted one layer that solved all three, without touching application code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built: a drop-in proxy with three layers
&lt;/h2&gt;

&lt;p&gt;RRC Gateway sits between your app and the providers (OpenAI, Claude, Gemini, Mistral, Llama). You change three lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="c1"&gt;# Before
&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sk-...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# After — everything else stays identical
&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rrc_your_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://gateway.rrcsolutions.me/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s your refund policy?&lt;/span&gt;&lt;span class="sh"&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;No SDK changes, no rewrites. Behind that URL, three things happen per request:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Semantic caching.&lt;/strong&gt; The gateway embeds each incoming prompt and compares it against cached ones. "What's your refund policy?" and "Tell me about your refund policy" match at high similarity — the second one never reaches the provider. In live testing, a repeat prompt came back as a cache hit: 116 tokens served, &lt;strong&gt;$0.00 charged&lt;/strong&gt;. A cache hit is the cheapest API call there is — the one you never make.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Virtual memory.&lt;/strong&gt; Instead of resending your whole knowledge base every call, your docs are compressed into vector embeddings once. Each request retrieves only the ~2,000 tokens the model actually needs. Same answers, roughly 95% fewer context tokens billed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Smart routing.&lt;/strong&gt; Every prompt is scored for complexity in real time. Genuinely hard reasoning goes to the frontier model; the FAQ, the classifier, the formatter go to a cheap one automatically. Nobody has to remember to pick — the default stops being the most expensive option.&lt;/p&gt;

&lt;h2&gt;
  
  
  The math
&lt;/h2&gt;

&lt;p&gt;Take a workload doing 50,000 requests/day against GPT-4o with heavy context. Back-of-envelope, illustrative — your numbers will differ:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Leak&lt;/th&gt;
&lt;th&gt;Typical saving on the portion it touches&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Semantic cache hits (30–50% of support-style traffic)&lt;/td&gt;
&lt;td&gt;100% of those calls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Context trimmed 100K → 2K tokens&lt;/td&gt;
&lt;td&gt;~95% of input cost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simple tasks routed to cheap models&lt;/td&gt;
&lt;td&gt;10x per routed call&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Stack them and "up to 90% off the total bill" stops sounding like marketing. It sounds like arithmetic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;RRC Gateway is in free public beta — no credit card, OpenAI-compatible, three lines to wire up: &lt;a href="https://gateway.rrcsolutions.me" rel="noopener noreferrer"&gt;gateway.rrcsolutions.me&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm the founder and I read every piece of feedback. If you point it at a workload, I'd genuinely love to hear what your cache hit rate looks like — that's the number I obsess over.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>openai</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
