Skip to main content
NexoToken
← Back to guide center

NexoToken technical guide center

Codex config.toml and custom models

Understand how model, model_provider, base_url, and environment settings interact without hidden overrides.

Keep model selection separate from the provider definition in config.toml: the top level chooses a model and provider, while the provider declares its Base URL and credential environment-variable name. Never put the real key in TOML or replace a reserved built-in provider ID, and verify both the loaded source and an actual request.

Scope

For local environments that keep a Codex custom provider, model selection, and project override rules in config.toml.

Last verified

Steps

  1. Locate user and project configuration files and record precedence.

  2. Use a distinct provider ID and separate it from the model ID.

  3. Set model_reasoning_effort = "high" at the top level of config.toml, before all [tables]. For one run use codex -c 'model_reasoning_effort="high"'; for CI use codex exec -c 'model_reasoning_effort="high"' "Explain the project structure without editing files".

  4. Store only the environment-variable name in TOML.

  5. Check whether project configuration overrides the user file.

  6. Restart the client, run a minimal task, and confirm the actual model.

Safe example

model = "YOUR_MODEL_ID"
model_provider = "custom_api"
model_reasoning_effort = "high"

[model_providers.custom_api]
name = "Custom API"
wire_api = "responses"
base_url = "https://your-api.example.com/v1"
env_key = "OPENAI_API_KEY"

Common errors and troubleshooting order

  1. No effect: inspect project-level overrides.
  2. Provider conflict: choose a new ID instead of replacing a built-in.
  3. Missing key: env_key must contain a variable name, not its value.
  4. Wrong model: copy the complete current ID and verify again.

Completion checklist

  • The TOML parses without duplicate tables.
  • No real credential appears in the file.
  • Configuration precedence is documented.
  • The actual request uses the intended model.

Limitations and boundaries

  • Example fields must be checked against the current Codex release.
  • Project configuration should be enabled only in trusted repositories and must not store personal credentials.
  • Common levels are low (faster), medium (balanced), and high (deeper); xhigh and other values require support from the selected model and client. Do not apply this reasoning setting to GPT-4o or image models. When omitted, the platform does not impose a universal level; a client may send its own default. Native requests preserve the parameter, with compatibility exceptions: some paths map minimal to none, and specific GPT-5.6 context-compaction requests map max to xhigh. Cross-protocol conversion does not guarantee equivalent reasoning settings. Acceptance alone does not prove model support or effective effort.