Codex with AnyRouter — free models, one API key

Run Codex through AnyRouter with anyrouter/free or any model on one sk-ar- key.

Run Codex through AnyRouter with one sk-ar- key, request logs and no code changes. Flags, profiles and --dry-run are in the Codex CLI setup.

Set it up

curl -fsSL https://anyrouter.dev/cli.sh | bash
anyr codex

First run: paste an sk-ar- key or log in at anyrouter.dev. The config is saved to ~/.anyrouter/config.yaml and also powers anyr claude. Anything after -- goes to Codex:

anyr codex --model auto --effort xhigh -- exec

Check request logs: the call appears within a second or two with model, tokens and cost.

Model ids

Model idWhat it does
anyrouter/freeBest free model available now, with fallback. No credits. Needs Go ($2/mo, or free when you donate one working provider key); no daily cap. See Free Tier.
anyrouter/autoTop models (free and paid) with health-aware failover. Paid members use credits.
anyr codex --model anyrouter/free

Own provider keys (BYOK) are billed by your provider: see Use your own provider keys.

MCP tools

anyr codex connects the AnyRouter MCP gateway when Auto-connect in coding agents is on in the dashboard. Turn it off with --no-mcp, anyr mcp auto off, or the dashboard.

Troubleshooting

SymptomFix
401 or 403Key inactive, or OPENAI_API_KEY is not a valid sk-ar- key. Check Keys.
Model not foundUse an exact id from Chat-Completions-compatible models.
400 no_eligible_modelsPrivacy or routing settings (Zero Data Retention, blocked providers) excluded every candidate. Relax them or pick a specific model.

AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer