<?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: Rajiv Prasad </title>
    <description>The latest articles on DEV Community by Rajiv Prasad  (@rajivpsd13).</description>
    <link>https://dev.to/rajivpsd13</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%2F4107112%2Fa0c88ed4-a94a-4361-af5e-244210e25fd5.png</url>
      <title>DEV Community: Rajiv Prasad </title>
      <link>https://dev.to/rajivpsd13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rajivpsd13"/>
    <language>en</language>
    <item>
      <title>Building OmniCache: A sub-millisecond Python proxy that cuts LLM bills by 50%</title>
      <dc:creator>Rajiv Prasad </dc:creator>
      <pubDate>Thu, 03 Sep 2026 02:49:59 +0000</pubDate>
      <link>https://dev.to/rajivpsd13/building-omnicache-a-sub-millisecond-python-proxy-that-cuts-llm-bills-by-50-14mo</link>
      <guid>https://dev.to/rajivpsd13/building-omnicache-a-sub-millisecond-python-proxy-that-cuts-llm-bills-by-50-14mo</guid>
      <description>&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/13manmayarai-hash/omnicache-proxy" rel="noopener noreferrer"&gt;https://github.com/13manmayarai-hash/omnicache-proxy&lt;/a&gt; (MIT Licensed)&lt;/p&gt;

&lt;h2&gt;
  
  
  What My Project Does
&lt;/h2&gt;

&lt;p&gt;OmniCache is an open-source, zero-dependency reverse proxy and semantic caching engine written in pure Python. It sits between client applications and model backends (OpenAI, Anthropic, Google Gemini, local vLLM / Ollama) to serve cached responses in under 1 millisecond.&lt;/p&gt;

&lt;p&gt;Key Technical Components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sub-Millisecond Vector Caching (&amp;lt;0.8ms): In-memory 512-d feature projection embedder executing in CPU cache without remote embedding overhead.&lt;/li&gt;
&lt;li&gt;Dynamic Intent Gating: Adaptive similarity thresholds (Code: 0.98, JSON Schema: 1.0, Creative: Auto-Bypass, FAQ: 0.92) to prevent syntax and logic hallucinations.&lt;/li&gt;
&lt;li&gt;Agent Tool-Loop Accelerator: Caches idempotent tool executions (read_file, git status, grep) for coding agents like Claude Code and Cursor, reducing agent turnaround from 15s to 350ms.&lt;/li&gt;
&lt;li&gt;Adaptive Cost Cascade: Evaluates prompt complexity in &amp;lt;0.2ms to route simple classification queries to high-speed economy models.&lt;/li&gt;
&lt;li&gt;Multi-Modal Vision Cache: 64-bit Perceptual Hashing (dHash) for visual screenshot and document deduplication.&lt;/li&gt;
&lt;li&gt;Zero-Knowledge Privacy Vault: Reversible tokenized masking of sensitive credentials and identifiers prior to upstream forwarding.&lt;/li&gt;
&lt;li&gt;Token Jitter SSE Replayer: Poisson-distributed streaming playback (~65 tok/s, &amp;lt;10ms TTFT) for natural streaming UI rendering.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Target Audience
&lt;/h2&gt;

&lt;p&gt;OmniCache is designed for production infrastructure and local developer workflows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI Infrastructure Engineers: Teams seeking to optimize upstream API token volume without modifying core application code.&lt;/li&gt;
&lt;li&gt;Autonomous Coding Agents: Developers running multi-turn reasoning loops (Claude Code, Cursor, AutoGen) with repetitive file inspection cycles.&lt;/li&gt;
&lt;li&gt;Real-Time Voice Pipelines: Voice agent architectures (LiveKit, Pipecat, Vapi) where &amp;lt;1ms LLM lookup latency eliminates telephone conversational delay.&lt;/li&gt;
&lt;li&gt;Self-Hosted AI Deployments: Environments requiring local zero-network data persistence.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Versus LiteLLM / Portkey: Those tools require external vector databases (Redis, Qdrant) which introduce 30ms to 80ms network latency. OmniCache executes local in-memory cosine matching in &amp;lt;0.8ms with zero external services.&lt;/li&gt;
&lt;li&gt;Versus Native Provider Prompt Caching: Provider prompt caching only covers exact input prefixes over 1024 tokens and does not optimize output generation latency. OmniCache serves full cached completions in under 1ms.&lt;/li&gt;
&lt;li&gt;Versus Redis Semantic Cache: Traditional semantic caches apply a static global threshold that can corrupt structured JSON or code syntax. OmniCache applies dynamic intent gating based on payload semantics.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup and Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/13manmayarai-hash/omnicache-proxy.git
&lt;span class="nb"&gt;cd &lt;/span&gt;omnicache-proxy
pip &lt;span class="nb"&gt;install &lt;/span&gt;starlette uvicorn httpx
python3 main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Integration via standard client SDK:&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;your-backend-api-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;http://localhost:8000/v1&lt;/span&gt;&lt;span class="sh"&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;Explain binary search trees&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The web metrics dashboard runs locally at &lt;a href="http://localhost:8000/dashboard" rel="noopener noreferrer"&gt;http://localhost:8000/dashboard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Licensed under MIT. Technical feedback, benchmarks, and pull requests are welcome.&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>opensource</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
