Besides your user file, Codex reads .codex/config.toml files inside projects. They hold the team settings. But there are keys Codex does not accept there, and the provider is one of them.
What Codex ignores in a project
According to the official documentation, a project .codex/config.toml cannot change model_provider or model_providers. Codex ignores them and shows a warning at start. The same goes for openai_base_url, profile, profiles, notify and otel, among others.
The provider and the authentication are settings of each computer. That way, a repository you cloned cannot send your requests, or your key, to another address.
Where each thing goes
| File |
What it can hold |
| ~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml) |
The Interweb provider, with base_url, env_key and wire_api, and the starting model. |
| .codex/config.toml, in the project |
The model and other project settings. No provider and no key. |
Choosing the model for a project
The project can choose the model, and Codex uses it with the provider from your user file. At the project root, create .codex/config.toml with just this line:
model = "zai-org/glm-5.2"
Codex looks for .codex/config.toml from the project root down to the folder you are in. If there is more than one, the closest wins. And it only reads these files in a project marked as trusted.
The Codex order
When the same key is in several places, Codex follows this order, from the one that counts most to the one that counts least:
| 1 |
Command-line options, such as -m and -c.
|
|
| 2 |
The project .codex/config.toml files, the closest first.
|
|
| 3 |
The profile chosen with --profile.
|
|
| 4 |
Your ~/.codex/config.toml.
|
|
|
Did you see the warning that Codex ignored model_provider? The provider is in the wrong file. Move the [model_providers.api] block and the model_provider line to ~/.codex/config.toml and leave only model in the project.
|