<?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: iwasinnam2</title>
    <description>The latest articles on DEV Community by iwasinnam2 (@iwasinnam2).</description>
    <link>https://dev.to/iwasinnam2</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%2F4065989%2F6103471b-53c3-4940-8987-088c2daaca1e.png</url>
      <title>DEV Community: iwasinnam2</title>
      <link>https://dev.to/iwasinnam2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iwasinnam2"/>
    <language>en</language>
    <item>
      <title>Your CI suite is probably re-paying OpenAI for prompts it already sent</title>
      <dc:creator>iwasinnam2</dc:creator>
      <pubDate>Thu, 13 Aug 2026 15:12:35 +0000</pubDate>
      <link>https://dev.to/iwasinnam2/your-ci-suite-is-probably-re-paying-openai-for-prompts-it-already-sent-469a</link>
      <guid>https://dev.to/iwasinnam2/your-ci-suite-is-probably-re-paying-openai-for-prompts-it-already-sent-469a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Disclosure&lt;/strong&gt;: this is my own project (withOhm). Sharing it because the problem is generic enough that if you're building anything agentic or RAG-adjacent, you've probably hit some version of it already.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The problem&lt;/strong&gt;&lt;br&gt;
Two things kept happening in every agent/RAG project I built:&lt;/p&gt;

&lt;p&gt;The same prompt gets sent to the model more than once — retries, self-consistency passes, research loops that re-check the same question — and every single one gets billed at full price, even though the response is byte-for-byte identical to one already paid for.&lt;br&gt;
Anything that fetches web content for context does it raw: no robots.txt check, no PII scrubbing, no protection against the fetch target resolving to an internal IP. Fine in a demo, a liability in production.&lt;br&gt;
Neither problem is hard to solve badly. What's annoying is solving them correctly — structurally exact, not "good enough for a blog post" — while keeping streamed and non-streamed calls indistinguishable to the caller either way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I built&lt;/strong&gt;&lt;br&gt;
withOhm sits in front of the model calls as an OpenAI-compatible endpoint. Point your existing SDK at it, add one header, done.&lt;/p&gt;

&lt;p&gt;Two decisions shaped everything:&lt;/p&gt;

&lt;p&gt;Exact-match caching, never semantic. Requests are canonicalized — transport noise stripped (line endings, outer whitespace), nothing inside a code block touched — then hashed. Identical hash → replay from Redis. "Almost the same prompt" doesn't count, on purpose. Semantic caching reads great in a README and turns into a refunds feature the first time it serves a near-miss as if it were the real answer.&lt;br&gt;
Streaming replays as streaming. If the original call was SSE, the cached replay is reassembled and re-emitted as SSE too — the calling code can't tell a cache hit from a live call just by watching how the tokens arrive.&lt;br&gt;
For the fetch side, there's a second tool that runs any public URL through a compliance pass before the content reaches the model: robots.txt is consulted at fetch time, obvious PII gets redacted before it hits context, and the fetch itself is SSRF-guarded (no sneaking a request to an internal IP through a redirect). It returns a verdict alongside the content — what got redacted, what robots said — so the caller can reason about what it received instead of trusting it blindly.&lt;/p&gt;

&lt;p&gt;Trying it&lt;br&gt;
If you're in Cursor, it's an MCP server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;withohm-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That gives you ohm_chat (cache-replayed chat) and ohm_fetch_web (compliant fetch) as tools, plus a couple of introspection tools (ohm_usage, ohm_savings) so you can see what's actually getting deduped instead of taking it on faith.&lt;/p&gt;

&lt;p&gt;Outside Cursor it's just an HTTP endpoint — point any OpenAI-compatible client at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -s https://api.withohm.dev/v1/chat/completions \
  -H "Authorization: Bearer $OHM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "hi"}]
  }'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Send that exact request again and the second response comes back from cache instead of the provider. It's BYOK — you pass your own OpenAI/Anthropic key via a header (X-Ohm-Upstream-Key); withOhm forwards it for that one call and doesn't persist it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where I'd like pushback&lt;/strong&gt;&lt;br&gt;
Has anyone here made semantic caching work in production without a correctness incident? I ruled it out early and would genuinely like to see a counterexample that's survived real traffic — right now I think "almost the same prompt" is a trap dressed up as an optimization.&lt;/p&gt;

&lt;p&gt;More at &lt;a href="https://www.withohm.dev/" rel="noopener noreferrer"&gt;withohm.dev&lt;/a&gt; — the quickstart is the fastest way to see the cache-miss/cache-hit difference for yourself.&lt;/p&gt;

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