Adds a new authentication provider that reads OAuth tokens from the OpenAI Codex CLI (~/.codex/auth.json) to authenticate with OpenAI's API. This allows ChatGPT Plus/Pro subscribers to use OpenAI models in OpenClaw without needing a separate API key - just authenticate with 'codex login' first, then enable this plugin. Features: - Reads existing Codex CLI credentials from ~/.codex/auth.json - Supports all Codex-available models (gpt-4.1, gpt-4o, o1, o3, etc.) - Automatic token expiry detection from JWT - Clear setup instructions and troubleshooting docs Usage: openclaw plugins enable openai-codex-auth openclaw models auth login --provider openai-codex --set-default
2.1 KiB
2.1 KiB
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).