Endpoint
OpenClaw uses the standard OpenAI-compatible
/v1 endpoint.Configuration
Edit your OpenClaw config file at~/.openclaw/openclaw.json:
- Without API Key Auth
- With API Key Auth
Use this configuration when API key authentication is disabled (default):
~/.openclaw/openclaw.json
When API key auth is disabled, OpenClaw still requires an
apiKey field. Any string value works (e.g., "dummy").Configuration Fields
| Field | Description | Required |
|---|---|---|
baseUrl | Codex-LB /v1 endpoint | Yes |
apiKey | API key or ${ENV_VAR} or "dummy" | Yes |
api | Must be "openai-completions" | Yes |
models | Array of model configurations | Yes |
mode | "merge" to combine with other providers | No |
primary | Default model ID | Yes |
Model Configuration
Define all models available in your Codex-LB instance:Provider Modes
OpenClaw supports different provider modes:- Merge Mode (Recommended)
- Replace Mode
Combines Codex-LB with other configured providers:Use
merge to keep access to other providers while adding Codex-LB.Verify Configuration
Test your setup:- Open http://localhost:2455
- Check Dashboard for usage metrics
- Confirm requests are being logged under the correct API key
Troubleshooting
Error: Connection refused
Error: Connection refused
Ensure Codex-LB is running:If using Docker:
Error: 401 Unauthorized
Error: 401 Unauthorized
Error: Invalid API key format
Error: Invalid API key format
If you see this when auth is disabled:
- Ensure
apiKeyis set to any string (e.g.,"dummy") - OpenClaw requires the field even when auth is disabled
Provider doesn't appear
Provider doesn't appear
If
codex-lb doesn’t show up:- Verify JSON syntax is correct (no trailing commas)
- Check OpenClaw logs for config parsing errors:
- Ensure
modeis set correctly (mergeorreplace)
Model not found
Model not found
The requested model isn’t available:
-
Check available models:
- Verify the model ID matches exactly (case-sensitive)
- Ensure at least one account supports the model
-
Update the
modelsarray to include the correct ID
Agent uses wrong provider
Agent uses wrong provider
If agents aren’t using Codex-LB:
- Check the
primarymodel is prefixed withcodex-lb/ - Verify agent-specific configs don’t override with other providers
- Use
openclaw config showto debug resolved configuration
Advanced Configuration
Per-Agent Models
Configure different models for different agent types:Environment-Specific Configs
Use different configs for development vs. production: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
Chat Completions API
Explore the
/v1/chat/completions endpointUsage Tracking
Monitor OpenClaw usage in the dashboard