Skip to main content

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_provider differs from model
  • 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

Keep the provider id consistent:
This means Codex uses the provider named custom, sends model requests to https://www.bettertoken.ai/v1, and communicates through the Responses API shape.

Common mistakes

  • Writing the display name instead of the provider id in model_provider.
  • Treating model as the provider name.
  • Forgetting that base_url and the provider protocol must match.
  • Putting an Anthropic-compatible Base URL into an OpenAI-compatible provider.
  • Using a UI display name instead of an API-recognized model ID.

About BetterToken

BetterToken can be defined as a custom provider such as [model_providers.custom]. Use https://www.bettertoken.ai/v1 as the base_url and copy the model ID from the GPT Key group. On the BetterToken regional documentation, use the same custom provider id with the BetterToken regional Base URL.

References