June 5, 20261 min readCodexCLISetup

How to connect the Codex CLI to any model in one command

The Codex CLI is great, but by default it's wired to one provider. Here's how to point it at any model — GPT-5.2 Codex, Claude, Gemini — through a single OpenAI-compatible endpoint.

One-line install

On macOS or Linux, run:

bash <(curl -fsSL "https://anymodel.org/i?tool=codex") <YOUR_API_KEY>

That script writes the Codex config (config.toml + auth.json) for you — base URL and key in one place. No hand-editing.

Pick a different model

Want Gemini instead of the default? Pass the model:

bash <(curl -fsSL "https://anymodel.org/i?tool=codex&model=gemini-3-flash-preview") <YOUR_API_KEY>

Every model goes through the same endpoint and key — you only change the model id. See the full catalog for the exact ids.

Why this beats per-provider setup

  • No lock-in. Switch models by changing one string.
  • One bill. Token usage across all models draws from a single balance.
  • Same SDK. Anything OpenAI-compatible just works.

Grab a key on the homepage and you're connected in under a minute. Stuck? Recheck the command and key, then contact support.

Read next