mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
- Change provider ID from 'openai-codex' to 'openai-codex-import' to avoid conflict with core's built-in openai-codex provider - Update model prefix from 'openai/' to 'openai-codex/' to match core's namespace convention and avoid collision with standard OpenAI API provider - Use correct Codex models (gpt-5.3-codex, gpt-5.2-codex) instead of generic OpenAI models (gpt-4.1, o1, o3) - Respect CODEX_HOME env var when resolving auth file path, matching core behavior in src/agents/cli-credentials.ts - Validate refresh token presence and throw clear error instead of using empty string which causes silent failures
OpenAI Codex CLI Auth (OpenClaw plugin)
Use OpenAI models with your ChatGPT Plus/Pro subscription via the Codex CLI OAuth tokens.
This plugin reads authentication from the OpenAI Codex CLI and uses those OAuth credentials to access OpenAI models — no separate API key required.
Enable
Bundled plugins are disabled by default. Enable this one:
openclaw plugins enable openai-codex-auth
Restart the Gateway after enabling.
Prerequisites
- ChatGPT Plus or Pro subscription — required for Codex CLI access
- Codex CLI installed and authenticated:
# Install Codex CLI
npm install -g @openai/codex
# Authenticate (opens browser for OAuth)
codex login
This creates ~/.codex/auth.json with your OAuth tokens.
Authenticate with OpenClaw
After Codex CLI is authenticated:
openclaw models auth login --provider openai-codex --set-default
Available Models
The following models are available through Codex CLI authentication:
openai/gpt-4.1,openai/gpt-4.1-mini,openai/gpt-4.1-nanoopenai/gpt-4o,openai/gpt-4o-miniopenai/o1,openai/o1-mini,openai/o1-proopenai/o3,openai/o3-miniopenai/o4-mini
Default model: openai/o3
How It Works
- The plugin reads
~/.codex/auth.jsoncreated bycodex login - OAuth tokens from your ChatGPT subscription are extracted
- OpenClaw uses these tokens to authenticate with OpenAI's API
- Tokens auto-refresh when needed (handled by OpenClaw's credential system)
Why Use This?
- No separate API key — use your existing ChatGPT Plus/Pro subscription
- No usage-based billing — covered by your subscription
- Access to latest models — same models available in ChatGPT
Troubleshooting
"No Codex auth found"
Run codex login to authenticate the Codex CLI first.
Tokens expired
Re-run codex login to refresh your tokens, then re-authenticate:
codex login
openclaw models auth login --provider openai-codex --set-default
Model not available
Some models may require specific subscription tiers (e.g., o1-pro requires ChatGPT Pro).