I didn't plan to use four AI coding tools.
It started with Claude Code. Then Codex CLI dropped, and it was good enough that I had to try it. Then Gemini CLI became free. Then a friend told me about OpenClaw and its custom provider injection.
Before I realized it, I had:
- 4 different CLIs
- 3 different API key formats
- 2 ChatGPT accounts
- 1 Claude account
- An Azure OpenAI endpoint from work
- A Gemini API key from a free tier
- And a growing dread every time I opened a new terminal tab
Does anyone else live like this?
The Config File Graveyard
Here's what my config situation looked like before I snapped:
Claude Code wanted ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY in my environment.
Codex CLI wanted a ~/.codex/config.toml with chatgpt_base_url and openai_base_url.
Gemini CLI wanted... something patched into its internals.
OpenClaw wanted a ~/.openclaw/openclaw.json with its own provider format.
Four tools. Four config formats. Four places to update when a key expires. And if I wanted to switch which account goes where? Manual surgery.
I tried maintaining this by hand for about two weeks before I lost it.
What I Did Instead
I pointed all four tools at localhost:8081.
That's it. That's the setup.
CliGate is an open-source local gateway that sits between your AI tools and their APIs. Every tool talks to the same address. The gateway figures out who sent the request, what model they need, and which credential to use.
npx cligate@latest start
One command. Dashboard opens. All my accounts and keys live in one place.
The Part That Actually Matters: Routing
Here's where it gets interesting.
I don't want Codex using the same account as Claude Code. Codex hammers the API with rapid-fire completions. Claude Code takes longer, deeper passes. Mixing them on the same account burns through rate limits fast.
So I set up App Routing:
- Claude Code → My Claude account (PKCE OAuth, auto-refreshing tokens)
- Codex CLI → Azure OpenAI endpoint (fastest, corporate budget)
- Gemini CLI → Google Gemini API key (free tier — why pay?)
- OpenClaw → Pool fallback (whatever's available)
Each binding has a fallback chain. If Claude's rate-limited, it drops to the API key pool. If Azure is down, Codex falls back to ChatGPT accounts.
Zero manual switching. Zero config file editing.
The Free Model Trick
Not every request needs GPT-5 or Claude Opus.
Quick lookups, small code questions, "what does this error mean" — those can go to free models. CliGate has a toggle that routes fast-tier requests (anything that maps to haiku/mini/lite) to free providers like DeepSeek, Qwen, or MiniMax.
Flip it on. Watch your API costs drop.
Flip it off when you need the heavy models for complex reasoning.
What My Setup Actually Looks Like
┌─────────────┐ ┌───────────┐ ┌────────────┐ ┌──────────┐
│ Claude Code │ │ Codex CLI │ │ Gemini CLI │ │ OpenClaw │
└──────┬──────┘ └─────┬─────┘ └──────┬─────┘ └────┬─────┘
│ │ │ │
└───────────────┼───────────────┼──────────────┘
▼
CliGate (localhost:8081)
│
┌───────┬───────┼───────┬───────┐
▼ ▼ ▼ ▼ ▼
Anthropic OpenAI Azure Google Free
API API OpenAI Gemini Models
Everything goes through one gateway. The gateway handles:
- Protocol translation — Anthropic format, OpenAI format, Gemini format — doesn't matter
- Account rotation — Multiple ChatGPT/Claude accounts, round-robin or sticky
- Key load balancing — Spreads requests across API keys, routes to least-used first
- Token refresh — OAuth tokens auto-refresh and sync back to source tools
- Usage tracking — Per-account, per-model, per-day cost breakdown
The One-Click Part
Each CLI tool has a "Configure" button in the dashboard. Click it. Done.
No editing .toml files. No setting environment variables. No patching Gemini's internals manually.
The dashboard also installs tools you don't have yet. Don't have Codex CLI? Click "Install." It detects your OS and handles the rest.
Honest Downsides
- It's another process running on your machine (Node.js on port 8081)
- Initial setup takes ~5 minutes to add accounts and configure routing
- If you only use one AI tool with one API key, this is overkill
But if you're juggling 2+ tools or managing multiple accounts? The time savings compound fast.
So... What's Your Setup?
I genuinely want to know:
- How many AI coding tools are you running right now?
- Are you managing configs manually or have you built some system?
- Has anyone else hit the "too many API keys" wall?
Drop your setup in the comments. I'm curious if I'm the only one who went down this rabbit hole — or if there's a whole community of us doing the same thing.
GitHub: github.com/codeking-ai/cligate
CliGate is open-source under AGPL-3.0. Not affiliated with Anthropic, OpenAI, or Google.
Top comments (1)
One surprising insight we've seen is that the biggest challenge isn't juggling multiple AI tools like Claude Code or Codex -it's ensuring they effectively integrate into existing workflows. In our experience with enterprise teams, setting up a token-based access management system often resolves many bottleneck issues by streamlining authentication across platforms. This approach can transform what feels like chaos into a smooth, manageable process. - Ali Muwwakkil (ali-muwwakkil on LinkedIn)