<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anowar Hossain Jeebon on Medium]]></title>
        <description><![CDATA[Stories by Anowar Hossain Jeebon on Medium]]></description>
        <link>https://medium.com/@jeebon?source=rss-15b7de7b06f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NEwwCBlab9W2nEmqxLIESQ.jpeg</url>
            <title>Stories by Anowar Hossain Jeebon on Medium</title>
            <link>https://medium.com/@jeebon?source=rss-15b7de7b06f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:35:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeebon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop paying extra API fees with one premium subscription: one endpoint for Claude, Codex, & Gemini.]]></title>
            <link>https://medium.com/@jeebon/stop-paying-per-token-api-fees-if-you-already-have-a-premium-ai-subscription-ead220decd89?source=rss-15b7de7b06f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ead220decd89</guid>
            <dc:creator><![CDATA[Anowar Hossain Jeebon]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 14:16:46 GMT</pubDate>
            <atom:updated>2026-08-14T14:31:22.298Z</atom:updated>
            <content:encoded><![CDATA[<p>Three coding agents, three subscriptions, three config files, and none of them can see the others.</p><p>Claude Code wants an Anthropic-shaped endpoint. Codex wants an OpenAI Responses endpoint. Cursor wants a base URL in a settings panel. Switching a model means re-authenticating something or editing a dotfile in a directory that you had to look up again. If you pay for more than one of these, you have felt this.</p><p>CLIProxyAPI collapses all of it into one local process listening on port 8317.</p><p><strong>Who this is for.</strong> You already pay for at least one AI coding subscription, you use more than one client, and you’d rather not add per-token API billing on top. You’re comfortable editing a YAML file, though there’s a GUI path if you aren’t.</p><p><strong>What you’ll have at the end.</strong> One endpoint on your machine that speaks four protocols at once (OpenAI, Anthropic, Gemini, and Codex), backed by whichever accounts and keys you connect to it. Claude Code driving a Gemini model. Codex driving Claude. Cursor and your own scripts hitting the same address. All simultaneously, from one process in the background.</p><p>Roughly forty minutes of setup if you read carefully, or ten if you use the desktop client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lensw4wzAsSPjjLO2f6sdg.png" /></figure><h3>Step 1: install it</h3><p>There’s a fast path and a control path.</p><p><strong>Fast path.</strong> Download the EasyCLIProxyAPI desktop client. You get a configuration UI, system tray integration, automatic updates, and a start/stop toggle. If you want to find out whether this tool is useful to you before committing an afternoon, start here and skip to step 3.</p><p><strong>Control path.</strong> Install the binary directly.</p><p>macOS, via Homebrew:</p><pre>brew install cliproxyapi<br>brew services start cliproxyapi</pre><p>One gotcha worth knowing up front. Underbrew services, the config path it is $(brew --prefix)/etc/cliproxyapi.conf, not ~/.cli-proxy-api/config.yaml. If you want to keep using the home directory path, symlink the Homebrew path to it. Make sure the target file exists first, because a dangling symlink makes the service exit immediately with no useful message.</p><p>Linux, via the community installer:</p><pre>curl -fsSL https://raw.githubusercontent.com/router-for-me/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash</pre><p>Arch users can take it from the AUR instead (yay -S cli-proxy-api-bin) and manage it with systemctl --user start cli-proxy-api. Create the config file before you start the service, or it will refuse to come up.</p><p>Windows: <a href="https://github.com/router-for-me/CLIProxyAPI/releases">download</a> the release binary and run it</p><p>Docker:</p><pre>docker run --rm -p 8317:8317 \<br>  -v /path/to/config.yaml:/CLIProxyAPI/config.yaml \<br>  -v /path/to/auth-dir:/root/.cli-proxy-api \<br>  -v /path/to/plugins-dir:/CLIProxyAPI/plugins \<br>  eceasy/cli-proxy-api:latest</pre><p>Mount the plugins directory if you plan to install any; otherwise, they vanish on restart.<br>From the source, if you have Go:</p><pre>git clone https://github.com/router-for-me/CLIProxyAPI.git<br>cd CLIProxyAPI<br>go build -o cli-proxy-api ./cmd/server</pre><h3>Step 2: write a minimal config</h3><p>The example config in the repo is long. Almost all of it is optional. This is enough to get running:</p><pre>host: &quot;127.0.0.1&quot;        # bind locally only; &quot;&quot; binds every interface<br>port: 8317<br>auth-dir: &quot;~/.cli-proxy-api&quot;<br>api-keys:<br>  - &quot;sk-local-pick-your-own&quot;<br>remote-management:<br>  allow-remote: false<br>  secret-key: &quot;something-long-and-random&quot;<br>routing:<br>  strategy: &quot;round-robin&quot;<br>  session-affinity: true<br>request-retry: 3</pre><p>Two of those lines matter more than they look.</p><p>api-keys is the list of keys your clients present to this proxy. They have nothing to do with the upstream vendors. Invent them.</p><p>remote-management.secret-key gates the management API and the web panel. Leave it empty, and every /v0/management route returns 404, which is a reasonable default if you never intend to use the UI.</p><h3>Step 3: connect your accounts</h3><p>This is the part that makes the whole thing work, and it’s two commands.</p><pre>./cli-proxy-api --claude-login   # OAuth callback on port 54545<br>./cli-proxy-api --codex-login    # OAuth callback on port 1455</pre><p>Each opens a browser, you approve, and the credentials land in auth-dir. Add --no-browser if you&#39;re on a headless box and want the URL printed instead. There are equivalent flags for Antigravity, xAI/Grok and AI Studio. In the desktop client, this is a button.</p><p>Plain API keys go in the config instead. Gemini, Codex and Claude keys each get their own block, and anything OpenAI-compatible goes under openai-compatibility:</p><pre>openai-compatibility:<br>  - name: &quot;openrouter&quot;<br>    base-url: &quot;https://openrouter.ai/api/v1&quot;<br>    api-key-entries:<br>      - api-key: &quot;sk-or-v1-...&quot;<br>    models:<br>      - name: &quot;moonshotai/kimi-k2:free&quot;<br>        alias: &quot;kimi-k2&quot;</pre><p>The alias field is more useful than it first appears; see step 8.</p><h3>Step 4: start it and check it actually works</h3><p>Start the server, then ask it what it has:</p><pre>curl -s http://127.0.0.1:8317/v1/models \<br>  -H &quot;Authorization: Bearer sk-local-pick-your-own&quot;</pre><p>The response is the union of every model reachable through every credential you added. Read it carefully and copy the exact IDs. You’ll need them in the next three steps, and a client given a model name that doesn’t exist tends to fail quietly rather than usefully.</p><p>Do not skip this step. Most setup problems from here on are wrong model names.</p><h3>Step 5: point Claude Code at it</h3><p>Five environment variables:</p><pre>export ANTHROPIC_BASE_URL=http://127.0.0.1:8317<br>export ANTHROPIC_AUTH_TOKEN=sk-local-pick-your-own<br>export ANTHROPIC_DEFAULT_OPUS_MODEL=&lt;your-heavy-model&gt;<br>export ANTHROPIC_DEFAULT_SONNET_MODEL=&lt;your-mid-model&gt;<br>export ANTHROPIC_DEFAULT_HAIKU_MODEL=&lt;your-cheap-model&gt;</pre><p>On Claude Code 1.x the last three are instead ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL.</p><p>Note the base URL has no /v1 suffix. Claude Code appends its own path, and adding it yourself is a common way to get a setup that looks right and doesn&#39;t work. The auth token isn&#39;t optional either, even though the proxy is on localhost.</p><p>Fill in the model variables with real IDs from step 4. The interesting part is that they don’t have to be Anthropic models at all. The proxy translates, so you can leave the Claude Code interface exactly as it is and have a Gemini or GPT model answering underneath. That’s a cheap way to compare agents on the same prompt without learning three different TUIs.</p><p>The docs recommend against putting a minimal-reasoning tier in the Haiku slot; a small fast model from another vendor works better there.</p><h3>Step 6: point Codex at it</h3><p>Edit ~/.codex/config.toml:</p><pre>model = &quot;&lt;model-id-from-step-4&gt;&quot;<br>model_provider = &quot;cliproxyapi&quot;<br>model_reasoning_effort = &quot;high&quot;<br><br>[model_providers.cliproxyapi]<br>base_url = &quot;http://127.0.0.1:8317/v1&quot;<br>experimental_bearer_token = &quot;sk-local-pick-your-own&quot;<br>name = &quot;OpenAI&quot;<br>wire_api = &quot;responses&quot;<br>requires_openai_auth = true</pre><p>In this mode you don’t touch auth.json at all. There&#39;s a second API-mode configuration that does use auth.json with a dummy OPENAI_API_KEY and an X-OpenAI-Actor-Authorization header, documented alongside this one.</p><p>Two things to notice. The base URL here does take /v1, unlike Claude Code. And wire_api = &quot;responses&quot; matters: Codex speaks the Responses protocol rather than chat completions, and this line is what tells the proxy to expect it. Setting OPENAI_BASE_URL in your shell does not configure Codex, whatever you may read elsewhere.</p><h3>Step 7: Cursor, and anything else OpenAI-shaped</h3><p>Cursor isn’t in the project’s documented client list, so you’re configuring it as a generic OpenAI-compatible endpoint: base URL and key go in Cursor’s model settings, not in your shell. A shell export won’t reach an app you launched from the dock.</p><p>Worth verifying which Cursor features actually route through a custom endpoint before you rely on it. Some of its functionality has historically depended on Cursor’s own backend regardless of what base URL you set. Test with a plain chat request first.</p><p>Everything else that speaks one of the four protocols works the same way. The OpenAI Python and Node SDKs need base_url to be api_key pointed at the proxy and nothing more, which is the quickest way to reuse a subscription in a script you already wrote. The project also documents OpenCode, Factory Droid, Grok Build, and PI, and there&#39;s a Go SDK if you want to embed the proxy in your own program rather than run it as a service.</p><h3>Step 8: the parts worth setting up once you’re running</h3><p>The basics are done. These are what make it worth keeping.</p><p>Add several credentials for the same provider, and the router spreads requests across them, either round-robin or fill-first. Turn on session-affinity as well, or a long agent session can get shuffled between accounts mid-conversation and lose its prompt cache. It ships off by default, and it&#39;s easy to miss.</p><p>oauth-model-alias renames model IDs at the boundary, per channel. That sounds cosmetic until a client hard-codes a model name you don&#39;t have.</p><p>Payload rules are the feature I’d point at first. You can force parameters on the way through, matched by model and protocol, using gjson paths: pin reasoning.effort to high for everything matching gpt-*, say, or set a thinking budget on a Gemini model. There are default rules that only fill in missing values, override rules that always win, and filter rules that strip parameters out, so you can set a floor without stomping on what the client asked for.</p><p>quota-exceeded handles the unhappy path: it can switch project or drop to a preview model instead of returning an error, which is the difference between a degraded session and a dead one.</p><p>The web panel lives at http://localhost:8317/management.html, gated by your management secret. Read the security note in the docs before you enable plugins: plugin resource pages served from the same origin can read the same localStorage the panel where your management key is kept. Installing one means trusting its browser code with your management session.</p><h3>Step 9: if you put it on a server</h3><p>Running it on a VPS so your laptop stops being the gateway is a reasonable next move, and it’s where the sharp edges live.</p><p>Set host: &quot;&quot; to bind all interfaces, enable TLS with a real certificate, keep api-keys non-empty, and think hard before setting allow-remote: true. An open CLIProxyAPI on a public IP is a set of your subscription credentials with an HTTP interface in front of them.</p><p>If you want your credentials to survive a container rebuild, there are Git, PostgreSQL, and S3-compatible storage backends for the auth directory.</p><h3>Where it bites</h3><p>Built-in usage statistics were removed in v6.10.0. If you want spending visibility, you now bolt on a separate project, either CPA Usage Keeper or CPA-Manager-Plus, both linked from the README. That’s a real regression if cost tracking is why you wanted a gateway in the first place.</p><p>Model IDs drift fast. The docs and any tutorial you read, including this one, will go stale on model names within weeks. Trust /v1/models in the examples.</p><p>And it is a single point of failure that now sits between every agent you use and every model you pay for. When it’s down, everything is down.</p><h3>One thing to settle before you deploy this</h3><p>Wrapping a subscription CLI as a general-purpose API is a grey area, and pooling several accounts to extend rate limits is a good deal greyer. Each provider’s terms govern how their client and credentials may be used, and a local proxy doesn’t change what you agreed to. The project also ships features specifically for making proxied traffic look like native client traffic, which tells you something about where the line is.</p><p>So: read the terms for the accounts you’re connecting, use your own credentials rather than shared or team ones, and don’t put this in the path of client-billed work without asking the client first. Personal projects until you’ve checked. I’m not a lawyer. But it’s the question you want answered before the thing is load-bearing.</p><p>The reason I’d still recommend trying it: the whole thing is one Go binary and one YAML file. If it doesn’t suit you, deleting ~/.cli-proxy-api and unsetting three environment variables puts everything back exactly as it was. <br>It’s a Go binary under the MIT license, currently around 46.6k stars and 7.2k forks on GitHub (as of 2026). <a href="https://github.com/router-for-me/CLIProxyAPI">Repo Link</a> &amp; <a href="https://help.router-for.me/">Docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ead220decd89" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>