feat(core): support custom model aliases in config.toml

This adds config.toml-defined model aliases that map to provider model slugs while applying alias-specific context settings for the active session.

- added custom_models config entries plus schema and docs coverage
- taught ModelsManager to resolve aliases to a provider-facing request_model while preserving the user-facing alias slug
- applied alias-specific context_window and model_auto_compact_token_limit overrides during model info resolution
- updated session/test plumbing and added regression coverage for alias resolution with local and remote model catalogs

Model selection and per-session context overrides already flow through ModelsManager and Config. Resolving aliases there keeps the provider slug separate from the user-facing alias while reusing the existing override plumbing.

- just write-config-schema
- just fmt
- cargo test -p codex-app-server -p codex-api -p codex-exec -p codex-mcp-server
- cargo test -p codex-tui
- cargo test -p codex-protocol -p codex-core (same two existing seatbelt failures remained in this environment: create_seatbelt_args_with_read_only_git_pointer_file and create_seatbelt_args_with_read_only_git_and_codex_subpaths)
- just fix -p codex-core -p codex-protocol -p codex-app-server -p codex-api -p codex-exec -p codex-mcp-server -p codex-tui
This commit is contained in:
Friel
2026-03-06 19:42:35 -08:00
parent 22ac6b9aaa
commit 043a059919
25 changed files with 438 additions and 9 deletions
+15
View File
@@ -49,4 +49,19 @@ Plan preset. The string value `none` means "no reasoning" (an explicit Plan
override), not "inherit the global default". There is currently no separate
config value for "follow the global default in Plan mode".
## Custom model aliases
You can add aliases to the model picker via `custom_models` in `~/.codex/config.toml`.
Each alias maps to a provider-facing model slug and can override context settings:
```toml
[custom_models."gpt-5.4 1m"]
model = "gpt-5.4"
model_context_window = 1000000
model_auto_compact_token_limit = 900000
```
When selected, Codex sends `model = "gpt-5.4"` to the backend while using your
alias-specific context overrides for that session.
Ctrl+C/Ctrl+D quitting uses a ~1 second double-press hint (`ctrl + c again to quit`).