Short answer
model_provider tells Codex CLI which provider to use. Its value must match a provider id defined under [model_providers.<id>].
base_url is the API endpoint where model requests are sent. For an OpenAI-compatible provider, it usually points to a /v1 style endpoint.
wire_api tells Codex which protocol shape to use when talking to that provider. In the Codex configuration reference, responses is a supported provider protocol value.
When this matters
- You are configuring a custom OpenAI-compatible provider
- Codex says the provider cannot be found or model requests fail
- You are not sure how
model_providerdiffers frommodel - You are putting BetterToken, OpenAI, or another provider in one
config.toml - You need to separate Base URL, API Key, and Model ID
Field relationships
Recommended pattern
Keep the provider id consistent:custom, sends model requests to https://bettertoken.ai/v1, and communicates through the Responses API shape.
Do not put the API Key directly in config.toml. Set it in the terminal that launches Codex:
Verify the setup
- Confirm that
model_provider = "custom"exactly matches[model_providers.custom]. - Confirm that the Base URL is
https://bettertoken.ai/v1, including/v1. - Copy a current Model ID from the GPT provider in the model plaza.
- Fully exit Codex and relaunch it from a new terminal where the environment variable is set.
- Send a small code-explanation task and confirm that Codex returns a complete response.
Troubleshooting
Related docs
- How to configure Codex CLI config.toml
- Codex BetterToken setup guide
- What are Codex CLI sandbox and approval modes?
- OpenAI-compatible API vs Anthropic-compatible API

