Skip to content

Codex API key automatically modified leading to model xxx not found - CC Switch

Quick fix

Upgrade to v3.19.2+ to fix incorrect API Key convergence caused by reading auth.json when multiple suppliers share the same address.

Error output
model xxx not found

When configuring multiple Codex suppliers with the same API request address but different keys in cc-switch, the system often converges the keys into a single one. This causes calls to unauthorized models and results in the "model xxx not found" error.

The root cause is that `~/.codex/auth.json` is a single-slot shared file without supplier identity, always retaining only the most recently activated key. Although each supplier's actual key is stored in the `experimental_bearer_token` field of `config.toml`, the program prioritizes reading `auth.json` when loading live configuration in the edit dialog. This causes the interface to display another (or official login) key, which is then written back to the current supplier's record upon saving, resulting in repeated key overwrites.

  1. Upgrade cc-switch to version v3.19.2 or higher. This version corrects the logic for loading Codex configuration to prioritize promoting `experimental_bearer_token` as the supplier's key, ensuring that displayed and saved keys are correct and independent.

ToolCodex
VersionUnknown
PlatformsmacOSWindowsLinux

This page is distilled from 24 real issues

Why did my API key suddenly change to another supplier's after enabling local proxy?
This is because in older versions, `auth.json` was a single-slot shared file, and loading configuration prioritized it over the independent keys in `config.toml`. After upgrading to v3.19.2+, the program correctly identifies and preserves the independent `experimental_bearer_token` for each supplier.
How do I completely clear Codex configuration?
You can add a preset supplier (such as OpenAI Official) in the top right corner of cc-switch and enable it to invalidate old third-party configurations. Alternatively, disable the Codex takeover feature in settings.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.