<?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>Forem: csx0574</title>
    <description>The latest articles on Forem by csx0574 (@csx0574).</description>
    <link>https://forem.com/csx0574</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3933555%2F85504802-fc90-482e-b246-7b23aabb82a5.png</url>
      <title>Forem: csx0574</title>
      <link>https://forem.com/csx0574</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/csx0574"/>
    <language>en</language>
    <item>
      <title>I Built an Open-Source Multi-Model API Gateway</title>
      <dc:creator>csx0574</dc:creator>
      <pubDate>Fri, 15 May 2026 16:26:55 +0000</pubDate>
      <link>https://forem.com/csx0574/i-built-an-open-source-multi-model-api-gateway-3if1</link>
      <guid>https://forem.com/csx0574/i-built-an-open-source-multi-model-api-gateway-3if1</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Managing multiple AI model providers is a mess. Each has its own API, pricing, and quirks.&lt;/p&gt;

&lt;p&gt;I got tired of juggling keys and decided to build one gateway to rule them all.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;An &lt;strong&gt;OpenAI-compatible API gateway&lt;/strong&gt; that routes requests across 43 models from 13 providers—transparently, with cost tracking and smart routing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Live Demo (Cost Calculator)&lt;/strong&gt;: &lt;a href="https://csx0574--calculator.modal.run" rel="noopener noreferrer"&gt;https://csx0574--calculator.modal.run&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;43 models, 13 providers&lt;/strong&gt; — OpenAI, Anthropic, Google, Meta, Mistral, Zhipu, DeepSeek, Minimax, Groq, Fireworks, Novita, Kampute, XAI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI-compatible endpoint&lt;/strong&gt; — Drop-in replacement for your existing OpenAI code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart routing&lt;/strong&gt; — Choose by cost, speed, or balance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost tracking&lt;/strong&gt; — See exactly how much each request costs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Start
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/csx0574/ai-multi-model-gateway.git
&lt;span class="nb"&gt;cd &lt;/span&gt;ai-multi-model-gateway/gateway
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sk-...
python gateway.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Use It Like OpenAI
&lt;/h3&gt;



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

&lt;span class="n"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;api_base&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://csx0574--gateway.modal.run/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&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;user-api-key&lt;/span&gt;&lt;span class="sh"&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;openai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ChatCompletion&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;Hello!&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;h3&gt;
  
  
  Smart Routing
&lt;/h3&gt;

&lt;p&gt;Pass &lt;code&gt;mode&lt;/code&gt; in the request to let the gateway choose:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cost&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cheapest model that gets the job done&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;speed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fastest response&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;balanced&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Best cost/quality trade-off&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Chinese AI providers (Zhipu GLM, DeepSeek, Minimax) offer surprisingly competitive pricing—sometimes 10x cheaper than OpenAI for comparable quality. But they're scattered and hard to integrate.&lt;/p&gt;

&lt;p&gt;This gateway unifies them under one OpenAI-compatible API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/csx0574/ai-multi-model-gateway" rel="noopener noreferrer"&gt;https://github.com/csx0574/ai-multi-model-gateway&lt;/a&gt;&lt;/p&gt;

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