Endpoint
Codex CLI uses the
/backend-api/codex endpoint, not /v1. This endpoint supports the Codex wire API format with /responses/compact support.Configuration
Edit your Codex CLI config file at~/.codex/config.toml:
- Without API Key Auth
- With API Key Auth
Use this configuration when API key authentication is disabled (default):
~/.codex/config.toml
The
name = "OpenAI" field is required for proper wire API detection.Configuration Fields
| Field | Description | Required |
|---|---|---|
model | Model ID to use (e.g., gpt-5.3-codex) | Yes |
model_reasoning_effort | Reasoning effort level: low, medium, high, xhigh | No |
model_provider | Provider identifier (use codex-lb) | Yes |
name | Must be "OpenAI" for wire API compatibility | Yes |
base_url | Codex-LB backend API endpoint | Yes |
wire_api | Must be "responses" for Codex wire format | Yes |
env_key | Environment variable name for API key | Only if auth enabled |
Migrating from Direct OpenAI
If you were previously using OpenAI directly, old sessions won’t appear incodex resume because they’re tagged with a different model_provider.
Re-tag your existing sessions to make them appear:
Verify Configuration
Test your setup:- Connection to Codex-LB successful
- Model responses from your pooled accounts
- Usage tracked in the Codex-LB dashboard
Troubleshooting
Error: Connection refused
Error: Connection refused
Ensure Codex-LB is running:If using Docker:
Error: 401 Unauthorized
Error: 401 Unauthorized
Error: Model not found
Error: Model not found
The requested model isn’t available:
-
Check available models:
- Verify at least one account supports the model
-
Update your
modelfield inconfig.tomlto an available model
Sessions don't appear in codex resume
Sessions don't appear in codex resume
This happens when
model_provider doesn’t match. See Migrating from Direct OpenAI above.Wire API errors
Wire API errors
If you see wire format errors:
- Ensure
name = "OpenAI"is set (enables wire API detection) - Verify
wire_api = "responses"is configured - Check Codex CLI version supports the wire API format
IDE Extensions
Codex IDE extensions (VS Code, JetBrains, etc.) typically read from the same~/.codex/config.toml file. The configuration above should work for both CLI and IDE usage.
If your IDE extension uses a separate config:
- Locate the extension’s config file (check extension settings)
- Apply the same
model_providerconfiguration - Restart your IDE
Advanced Configuration
Multiple Providers
You can configure multiple providers and switch between them:Remote Access
If Codex-LB is running on a different machine:Next Steps
API Keys
Create and manage API keys for authentication
Rate Limiting
Configure rate limits per key or account
Codex API
Explore the Codex backend API endpoints
Dashboard
Monitor usage and costs in real-time