<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ModelBridge Blog]]></title><description><![CDATA[ModelBridge Blog]]></description><link>https://modelbridge.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>ModelBridge Blog</title><link>https://modelbridge.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 21:38:15 GMT</lastBuildDate><atom:link href="https://modelbridge.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building an OpenAI-Compatible API Gateway: What I Learned About Multi-Model Routing]]></title><description><![CDATA[I've been building ModelBridge — an OpenAI-compatible API gateway that unifies GPT, Claude, Gemini, DeepSeek, Qwen, and more behind a single SDK.
Here are a few things I wish I knew before I started.
]]></description><link>https://modelbridge.hashnode.dev/building-an-openai-compatible-api-gateway-what-i-learned-about-multi-model-routing</link><guid isPermaLink="true">https://modelbridge.hashnode.dev/building-an-openai-compatible-api-gateway-what-i-learned-about-multi-model-routing</guid><dc:creator><![CDATA[Alan Hart]]></dc:creator><pubDate>Wed, 19 Aug 2026 06:32:51 GMT</pubDate><content:encoded><![CDATA[<p>I've been building <strong>ModelBridge</strong> — an OpenAI-compatible API gateway that unifies GPT, Claude, Gemini, DeepSeek, Qwen, and more behind a single SDK.</p>
<p>Here are a few things I wish I knew before I started.</p>
<h2>1. "OpenAI-compatible" means different things to different providers</h2>
<p>Most providers accept the same request shape. But behavior differs significantly:</p>
<ul>
<li><p><strong>System prompts</strong> — some providers treat them as strict instructions, others as suggestions.</p>
</li>
<li><p><strong>Structured output</strong> — some enforce JSON Schema strictly, others silently fall back to plain text.</p>
</li>
<li><p><strong>Streaming</strong> — chunk formats vary. Finish reasons differ. Error handling is inconsistent.</p>
</li>
</ul>
<p>The takeaway: "compatible" is a spectrum, not a binary.</p>
<h2>2. Routing is not "choose a model"</h2>
<p>Real users don't ask for "many models." They ask for a model that fits a constraint:</p>
<ul>
<li><p>Lower latency</p>
</li>
<li><p>Better reasoning</p>
</li>
<li><p>Lower cost</p>
</li>
<li><p>Longer context</p>
</li>
<li><p>Better at code</p>
</li>
</ul>
<p>So routing becomes a <strong>policy engine</strong>, not a switch statement. You need to know what each model can do, how much it costs, how it behaves under load, and which tasks it's appropriate for.</p>
<h2>3. Latency variance matters more than average speed</h2>
<p>A model that usually responds in 1s but sometimes takes 12s <strong>feels unreliable</strong>, even if the average looks fine.</p>
<p>We started tracking p95 and p99 latency for every provider. That changed how we think about fallback and failover.</p>
<h2>4. Streaming is where the abstraction breaks</h2>
<p>Normal request-response is easy to normalize. Streaming is where you see the real differences:</p>
<ul>
<li><p>Delta semantics</p>
</li>
<li><p>Finish reasons</p>
</li>
<li><p>Heartbeat behavior</p>
</li>
<li><p>Partial failures</p>
</li>
<li><p>Connection endings</p>
</li>
</ul>
<p>Building a stream normalization layer was the most humbling part of the project.</p>
<h2>5. Usage accounting is closer to distributed state than billing</h2>
<p>In a multi-model gateway, usage is part of runtime truth. You need to track:</p>
<ul>
<li>Received → admitted → forwarded → partially streamed → completed → failed → compensated</li>
</ul>
<p>Not a single "token in / token out" record.</p>
<h2>What I'm building</h2>
<p><strong>ModelBridge</strong> — one OpenAI-compatible API, multiple models, pay-as-you-go.</p>
<p>No vendor lock-in. No complex contracts. Just build.</p>
<p><a href="https://zhuocore.com">https://zhuocore.com</a></p>
<h2>What's next</h2>
<p>I'm continuing to improve routing intelligence, cost optimization, and reliability. If you're building in this space too, I'd love to hear what challenges you've run into.</p>
]]></content:encoded></item></channel></rss>