Skip to content

Codex CLI /model menu overwrites custom provider v2 profile with OpenAI model #35487

Description

@frank1Zhang

Summary

In Codex CLI v0.142.2 on Windows, the /model menu does not appear to handle custom provider models in a v2 profile. When launched with a custom provider profile, opening /model only shows OpenAI models. Selecting one overwrites the profile file with an OpenAI model name while keeping the custom model_provider, making the profile invalid/unusable until it is manually edited again.

Environment

  • Codex CLI: v0.142.2
  • OS: Windows
  • Profile command: codex --profile thirdparty
  • Base config: C:\Users\33702\.codex\config.toml
  • Profile config: C:\Users\33702\.codex\thirdparty.config.toml

Relevant configuration

Base config contains the custom provider:

[model_providers.thirdparty]
name = "Third Party"
base_url = "https://new-api.jointpilot.com/v1"
env_key = "THIRDPARTY_API_KEY"
wire_api = "responses"

Profile config initially contains:

model_provider = "thirdparty"
model = "kimi-k3"

Steps to reproduce

  1. Configure the custom provider in ~/.codex/config.toml.
  2. Configure a v2 profile in ~/.codex/thirdparty.config.toml:
model_provider = "thirdparty"
model = "kimi-k3"
  1. Launch Codex:
codex --profile thirdparty
  1. Open the /model menu.
  2. Select/confirm one of the listed models.

Actual behavior

The /model menu only shows OpenAI models such as gpt-5.5, gpt-5.4, etc. After selecting one, thirdparty.config.toml is rewritten to something like:

model_provider = "thirdparty"
model = "gpt-5.5"
model_reasoning_effort = "xhigh"

[tui.model_availability_nux]
"gpt-5.5" = 3

This leaves model_provider = "thirdparty" but changes the model to an OpenAI model name, so the custom provider profile no longer points to the intended third-party model.

Expected behavior

Either:

  1. /model should preserve custom provider models and include the current custom model, or
  2. /model should not overwrite a custom-provider profile with an OpenAI model, or
  3. Codex should clearly warn that the model picker only supports OpenAI models and will modify the active profile file.

Workaround

Manually restore ~/.codex/thirdparty.config.toml to:

model_provider = "thirdparty"
model = "kimi-k3"

Then launch again with:

codex --profile thirdparty

Avoid using /model while using the custom provider profile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't workingconfigIssues involving config.toml, config keys, config merging, or config updatescustom-modelIssues related to custom model providers (including local models)windows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions