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://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:
On Windows PowerShell:

Verify the setup

  1. Confirm that model_provider = "custom" exactly matches [model_providers.custom].
  2. Confirm that the Base URL is https://bettertoken.ai/v1, including /v1.
  3. Copy a current Model ID from the GPT provider in the model plaza.
  4. Fully exit Codex and relaunch it from a new terminal where the environment variable is set.
  5. Send a small code-explanation task and confirm that Codex returns a complete response.

Troubleshooting

References