Set up Claude Code and Codex with one API key (and keep the bill capped) A developer on the RABAH.AI team published a guide for routing both Claude Code and Codex through a single OpenAI- and Anthropic-compatible gateway API key at api.rabah.ai, with spend caps applied per key and per account. The setup requires editing ~/.claude/settings.json with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN entries and adding a Responses-API provider block to ~/.codex/config.toml, then fully restarting each agent so it reads the new configuration. The author said the per-key budget cap is worth enabling even for a single agent because a retry loop can send many requests before anyone notices. 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. 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. This post shows how to point both agents at a single API key, two ways: https://api.rabah.ai . Rabah Desktop Mac with Apple silicon, Windows 10/11 signs in to your account and writes the API settings for your local agents. That's it. Restart the agents once so they read the new settings. Add three entries to the "env" block of ~/.claude/settings.json keep any settings you already have : { "env": { "ANTHROPIC BASE URL": "https://api.rabah.ai", "ANTHROPIC AUTH TOKEN": "YOUR KEY", "CLAUDE CODE DISABLE NONESSENTIAL TRAFFIC": "1" } } To try it in one terminal session first instead: export ANTHROPIC BASE URL="https://api.rabah.ai" export ANTHROPIC AUTH TOKEN="YOUR KEY" export CLAUDE CODE DISABLE NONESSENTIAL TRAFFIC=1 In ~/.codex/config.toml , add a provider that uses the Responses API: model provider = "OpenAI" model = "MODEL NAME" model providers.OpenAI name = "OpenAI" base url = "https://api.rabah.ai/v1" wire api = "responses" requires openai auth = false experimental bearer token = "YOUR KEY" Replace MODEL NAME with a model from the gateway's model list. Keep the top-level lines above the model providers... section, or Codex ignores them. Then quit Codex completely and reopen it. A new conversation isn't enough, because Codex reads the config only at startup. 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. 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. 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. Docs: docs.rabah.ai/en/ https://docs.rabah.ai/en/