The Model Providers Panel Sets a Default for New Chats. It Does Not Route Tasks
The Model Providers Panel Sets a Default for New Chats. It Does Not Route Tasks
Since v0.168, the Codex TUI has had a Model providers panel, and the idea going round is that it enables “model routing”: a cheap model for boilerplate, a strong one for architecture, a third for review. Read the panel’s source and you find something narrower and, for teams, more useful. It edits one setting, the provider that new chats start with, and it does so on the app server, not in your local config. This article reads the code to say exactly what it does, what it refuses to do, and where the routing story stops.
A note on sourcing. Everything below is from the Codex source at commit 936ac6d (1 December 2026), the codex-rs/tui/src/app/provider* files.1 The v0.168 release context comes from this knowledge base’s earlier article.2 The third-party release summary named in the backlog idea was not read, and nothing here relies on it.
What the Panel Shows
The panel is a selection list titled “Model providers”.3 Its subtitle reads Current chat: <provider> · Default for new chats: <provider id>. If no chat exists yet, the current chat reads “No active chat”. Each row has a ● (green) next to the default and ○ next to the others, with the provider ID as its description. Enter opens a details pager. Space sets that row as the default. A final row, “Create a custom provider or gateway”, opens a form.
Two different things are on that subtitle line, and they can differ. The current chat’s provider is fixed when the chat starts. The default applies only to chats you start after it changes.
flowchart LR
A[Provider list from app server] --> B{Space on a row}
B --> C[ModelProviderDefaultSet RPC]
C --> D[Server writes default]
D --> E[New chats use it]
D -. untouched .-> F[Running chats keep their provider]
One Default, Written on the Server
Pressing Space sends a ModelProviderDefaultSet request with the provider ID to the connected app server.4 The module’s own comment says the write persists “a provider choice on its originating backend, leaving running threads untouched”.5 A test asserts that the current chat’s model_provider_id is unchanged after a save.6 The footer tells you how to use the result: “Use /new to start a chat with the selected provider.”
So the flow is: change the default, then start a new chat. It is not a per-turn or per-task switch. There is no rule in this panel that maps a kind of work to a provider. If you want planning on one model and review on another, you still start separate chats or sessions, and the panel is the place where you choose what the next one begins with. I did not search the rest of the client for other routing mechanisms, so this is a statement about this panel, not about Codex as a whole.
When you cannot change it
The panel allows changing the default only when the server reports can_change_default and this client has no launch-time override.7 Three footer notes follow from that:
| Situation | What the panel says |
|---|---|
| Server allows changes, no client override | “Use /new to start a chat with the selected provider.” |
| Server configuration fixes the default | “The server configuration fixes the default provider.” |
| This client’s launch settings pick a provider | “This client’s launch settings select <id> for new chats.” The label becomes “Server default”. |
Even when the write succeeds, a higher-priority setting can win. The server reports OkOverridden, and the panel shows “Saved <name>.” followed by the server’s reason, or “A higher-priority setting overrides this choice.” if none is given.8 On success, the message is “New chats now use <name>.”
Compatibility is handled explicitly: against an older server, the panel says “Update the connected app server to change the default model provider.” (or “…to browse model providers”), keyed on the JSON-RPC “method not found” error.9 When the TUI is offline, it will not try: “Reconnect to the app server to browse model providers.”
What the Details Pager Reports
Enter on a row opens a “Model provider details” pager. The fields depend on the provider’s kind, and the server reports them.10
| Provider kind | Fields shown |
|---|---|
| Built-in OpenAI | Provider ID, and “Built-in OpenAI provider” as the type |
| Custom gateway | Name, Base URL, API key variable (or “External authentication” when managed outside) |
| Bedrock | AWS profile, AWS region, plus Base URL if the server reports one |
| GCP | Project ID, Location, “Credential file (server)”, plus Base URL if reported |
Missing values are labelled rather than blank: “Not reported” for URLs, “Managed externally” for externally configured auth, “None” for an unset key variable, “Not set” otherwise.
Two details matter for security. First, the key field is a variable name. The form’s placeholder is TEAM_API_KEY, and the hint says “Enter the environment variable name on the app server.”11 The panel never asks for, stores or displays a key value. Second, the Bedrock and GCP rows describe where the server finds credentials (a profile, a credential file path on the server), not the credentials themselves.
Adding and Editing Providers
“Edit configuration” appears in the pager only when the server says the provider is editable (can_edit) and it is not the built-in OpenAI provider.12 The create form has the placeholders “Team gateway” and https://gateway.example/v1, which show the intended case: a team gateway or proxy in front of one or more models. Whether a particular gateway works with a given model is outside what this code establishes.
The write path is careful about a failure that is easy to get wrong:
- Only one provider write may run at a time. A second attempt reports “A provider change is already saving.”5
- If creating a provider fails with an internal error or a lost reply, the client cannot know whether the server committed it. It does not report plain failure. It says: “Could not confirm the save. Check the provider list before adding it again.”13 That prevents duplicate gateways.
- After any ambiguous failure, or any success, the client invalidates its cached model list, because the available models depend on the provider.5
What to Take From This
- Treat the panel as a default-setter. It changes what
/newstarts with. It does not change running chats and does not route within one. - Decide where the default lives. Because it is written on the app server, the default follows the server, not your laptop. For a shared server, someone with write access changes it for everyone who connects. When the server fixes the default, the panel is read-only by design.
- Check for overrides. If Space reports “Saved” with a reason, your choice is stored but not in effect.
- Keep secrets out of the form. Put the key in the server’s environment and enter only its name.
- Do multi-model workflows with sessions. A plan, code and review split is a convention you build from separate chats. The panel makes the starting point of each one a two-keystroke change.
What This Article Does Not Establish
- It does not establish what the panel looked like in the v0.168.0 stable tag. The source read is the current main branch, and the panel may have changed since.
- It does not test any gateway, OpenRouter, Vertex AI or local-model setup. The code shows the fields exist, not that a given upstream behaves.
- It does not cover config-file provider definitions or CLI flags that choose a provider at launch, beyond the “client launch settings” override the panel reports.
- Cost and quality claims about routing different tasks to different models are not sourced here.
-
openai/codexat commit 936ac6d, committed 1 December 2026. All source references are to this commit. ↩ -
Codex CLI v0.168.0 Stable: Model Provider Selection, Resizable Side Panes, Audio Attachments, GIF Editing, and OSC 777 Notifications, section “Model Provider Selection in TUI”. ↩
-
codex-rs/tui/src/app/provider.rs, functionslist,provider_itemandprovider_hint. ↩ -
codex-rs/tui/src/app/provider/rpc.rs,set_default_provider(ClientRequest::ModelProviderDefaultSet). ↩ -
codex-rs/tui/src/app/provider/write.rs: the module comment, thetry_lock_ownedguard, andCompletion::finish(dismiss_stale_model_picker). ↩ ↩2 ↩3 -
codex-rs/tui/src/app/provider_tests.rs,space_saves_once_retries_and_preserves_the_current_chat. ↩ -
provider.rs, functionlist:can_select = page.can_change_default && client_override.is_none()and the threenotestrings. ↩ -
write.rs,Write::run(WriteStatus::OkandWriteStatus::OkOverridden);rpc.rs,override_reason. ↩ -
write.rsandrpc.rs:unsupported_method(JSON-RPC codes -32601 and -32600 with an “unknown variant” message) andrequest_error;provider.rs,Event::Load(offline message). ↩ -
codex-rs/tui/src/app/provider/fields.rs,provider_fieldsandField::label;provider.rs,details. ↩ -
codex-rs/tui/src/app/provider/editor.rs, the layout function’s placeholders and the hint “Enter the environment variable name on the app server.” ↩ -
provider.rs,Event::Details: the “Edit configuration” action is added only ifprovider.can_editand the settings are notProviderSettings::OpenAi. ↩ -
rpc.rs,write_providerandUNCONFIRMED_CREATE. ↩