<?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: Rabah AI</title>
    <description>The latest articles on DEV Community by Rabah AI (@_880ce54cf16efabc4d42b).</description>
    <link>https://dev.to/_880ce54cf16efabc4d42b</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%2F4273715%2F16a57d2e-c41f-4617-856e-5277138be6ef.png</url>
      <title>DEV Community: Rabah AI</title>
      <link>https://dev.to/_880ce54cf16efabc4d42b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_880ce54cf16efabc4d42b"/>
    <language>en</language>
    <item>
      <title>Set up Claude Code and Codex with one API key (and keep the bill capped)</title>
      <dc:creator>Rabah AI</dc:creator>
      <pubDate>Mon, 30 Nov 2026 08:38:28 +0000</pubDate>
      <link>https://dev.to/_880ce54cf16efabc4d42b/set-up-claude-code-and-codex-with-one-api-key-and-keep-the-bill-capped-1793</link>
      <guid>https://dev.to/_880ce54cf16efabc4d42b/set-up-claude-code-and-codex-with-one-api-key-and-keep-the-bill-capped-1793</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I'm on the team that builds RABAH.AI, the gateway used in this post. The manual steps below work with any OpenAI- or Anthropic-compatible gateway.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you run more than one coding agent, you know the routine: one key for Claude Code, another for Codex, two dashboards, two bills, and a small worry that an agent stuck in a loop will burn through your budget overnight.&lt;/p&gt;

&lt;p&gt;This post shows how to point both agents at a single API key, two ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One click&lt;/strong&gt; with a desktop app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;By hand&lt;/strong&gt;, editing the config files yourself.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code and/or Codex installed.&lt;/li&gt;
&lt;li&gt;An API key from a gateway that speaks both the OpenAI API (Codex uses the Responses endpoint) and the Anthropic Messages API (Claude Code uses it). I'll use RABAH.AI, where the base URL is &lt;code&gt;https://api.rabah.ai&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Option 1: one click with Rabah Desktop
&lt;/h2&gt;

&lt;p&gt;Rabah Desktop (Mac with Apple silicon, Windows 10/11) signs in to your account and writes the API settings for your local agents.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download it from &lt;a href="https://www.rabah.ai/en/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=setup_tutorial" rel="noopener noreferrer"&gt;rabah.ai/en/&lt;/a&gt; and sign in.&lt;/li&gt;
&lt;li&gt;Pick a key. The app applies it to Claude Code and Codex.&lt;/li&gt;
&lt;li&gt;Check the Overview page. Each agent should say &lt;strong&gt;Rabah API configured&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp641y4wf1u2wwe7ekv85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp641y4wf1u2wwe7ekv85.png" alt="Rabah Desktop overview: Codex and Claude Code both show &amp;quot;Rabah API configured&amp;quot;" width="799" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. Restart the agents once so they read the new settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2: configure it by hand
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;

&lt;p&gt;Add three entries to the &lt;code&gt;"env"&lt;/code&gt; block of &lt;code&gt;~/.claude/settings.json&lt;/code&gt; (keep any settings you already have):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"ANTHROPIC_BASE_URL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://api.rabah.ai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"ANTHROPIC_AUTH_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&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;p&gt;To try it in one terminal session first instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.rabah.ai"&lt;/span&gt;
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_KEY"&lt;/span&gt;
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Codex
&lt;/h3&gt;

&lt;p&gt;In &lt;code&gt;~/.codex/config.toml&lt;/code&gt;, add a provider that uses the Responses API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="na"&gt;model_provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"OpenAI"&lt;/span&gt;
&lt;span class="na"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"MODEL_NAME"&lt;/span&gt;

&lt;span class="k"&gt;[model_providers.OpenAI]&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"OpenAI"&lt;/span&gt;
&lt;span class="na"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://api.rabah.ai/v1"&lt;/span&gt;
&lt;span class="na"&gt;wire_api&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"responses"&lt;/span&gt;
&lt;span class="na"&gt;requires_openai_auth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;experimental_bearer_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_KEY"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;MODEL_NAME&lt;/code&gt; with a model from the gateway's model list. Keep the top-level lines &lt;em&gt;above&lt;/em&gt; the &lt;code&gt;[model_providers...]&lt;/code&gt; section, or Codex ignores them.&lt;/p&gt;

&lt;p&gt;Then &lt;strong&gt;quit Codex completely&lt;/strong&gt; and reopen it. A new conversation isn't enough, because Codex reads the config only at startup.&lt;/p&gt;

&lt;h3&gt;
  
  
  If something fails
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401 errors:&lt;/strong&gt; the key is incomplete, disabled, expired or out of quota.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changes don't apply:&lt;/strong&gt; you didn't fully restart the agent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Empty model list in Codex:&lt;/strong&gt; update Codex, or check whether the key is limited to certain models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cap the spend
&lt;/h2&gt;

&lt;p&gt;This is the part I'd do even if you only run one agent. An agent in a retry loop can send a lot of requests before you notice.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Per key:&lt;/strong&gt; create a separate key for each agent or script, and give each its own quota and rate limits (for example, a cap per 5 hours, per day and per 7 days). If a key leaks or an agent misbehaves, the damage stops at that cap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per account:&lt;/strong&gt; RABAH.AI plans start at $5 and come with daily, weekly and monthly caps, so the total can't run away either.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bonus: keep agents running while you're away
&lt;/h2&gt;

&lt;p&gt;Rabah Desktop also connects your computer to the Rabah phone app. From your phone you can send tasks, check progress, approve steps, or pause and resume the agents running on your machine. Remote sessions are end-to-end encrypted, and the computer needs to stay online and awake.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fak3f6dv7orlvf6d337pd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fak3f6dv7orlvf6d337pd.png" alt="Rabah Desktop Claude page: Remote Agent lets you continue Claude Desktop and terminal conversations on your phone" width="800" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;One key, two agents, spend capped per key and per account. If you set this up a different way, or hit a snag, tell me in the comments. I'd like to hear what's missing.&lt;/p&gt;

&lt;p&gt;Docs: &lt;a href="https://docs.rabah.ai/en/" rel="noopener noreferrer"&gt;docs.rabah.ai/en/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
