Repository navigation
feat(profile): carry Claude Code's modelPicker per account - #185
Merged
Merged
Conversation
added 3 commits
November 15, 2026 00:59
Claude Code's `modelPicker` setting lists the models `/model` offers. An API-key account on a third-party endpoint (silk, for one) needs its own list, and today the only place to put it is the shared `~/.claude/settings.json`, where every account sees it. Add a `[model_picker]` table to the profile's `config.toml`: `replace_built_in` and `[[model_picker.options]]` rows with `model`, `label`, `description` and `behaves_as`. The camelCase spellings Claude Code uses (`replaceBuiltInOptions`, `behavesAs`) load as aliases. A row with a blank `model` is dropped, and a table with no live row counts as unset. clauth reads the table and never edits it, so a save of any other key leaves the hand-written block byte for byte as it was. A freshly rendered `config.toml` ends with a short doc block and a commented example, and an existing file gains neither. `duplicate_profile` copies the picker to the new account. On a switch and on every `clauth start` copy, `build_settings` writes the live rows as top-level `modelPicker`, replacing what the base held, and removes the key for an account with no picker, the same set-or-remove rule `model` follows. A profile whose only setting is a picker still creates a missing `settings.json`. `modelPicker` joins the per-profile top-level keys of the cross-profile settings sync, next to `model` and `advisorModel`, so one account's list is never copied into a sibling's runtime copy or into the base.
The picker is hand-edited in `config.toml`, so the Setup tab had no way to show whether an account has one. Add a read-only `picker` line to the account header, after the session-token lines: `none`, `1 option` or `N options`, followed by `(replaces built-in)` when `replace_built_in` is true. It counts live rows only, the same rule the settings.json writer uses. The line is not a config row, takes no focus stop and opens no editor, and the new-account form does not show it.
Add a `Model picker` subsection under `Model routing`: the `[model_picker]` table and its fields, how each maps onto Claude Code's `modelPicker`, the camelCase aliases, and that blank rows are dropped. Say that an account with no picker strips `modelPicker` on a switch or start, including one set by hand, that Claude Code takes the setting only from managed settings, `--settings` or the SDK, and user settings, with the highest source winning outright, and that a table spelling one field both ways does not load. Note the cases a picker does not follow yet: a session moved by auto-switch keeps the picker it started with, and a switch-off leaves the last account's picker in place. Include the silk example as a `toml` block, add the table to the `config.toml` key table, and add a test that parses the example and pins the wording above so the page cannot drift from the code.
siddicky
pushed a commit
to siddicky/clauth
that referenced
this pull request
Nov 16, 2026
Brings in the per-model effort work from uwuclxdy#173. The four conflicts keep both features: modelPicker and modelSettings effort levels are written side by side, the [model_picker] and [model_effort] doc blocks both render, and the doc-digest and table-set tests list both tables.
uwuclxdy
added a commit
that referenced
this pull request
Nov 27, 2026
uwuclxdy
added a commit
that referenced
this pull request
Nov 27, 2026
A switch removes only the modelPicker clauth recorded writing. refs #185
Owner
|
Thanks for the picker and for testing it against a real Merged with a design change on top: a switch removes Also on top:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a per-account
[model_picker]table that clauth writes as Claude Code'smodelPickersetting, so an API-key account like silk has its own/modellist. Closes #184.It has three commits, plus a merge of
mommythat Testing describes:feat(profile)carries the picker into settings.json.config.tomlgains[model_picker]withreplace_built_inand[[model_picker.options]]rows (model,label,description,behaves_as).replaceBuiltInOptionsandbehavesAsload as aliases. clauth drops rows with a blankmodel, and a table with no live row counts as unset. clauth reads the table and never edits it. The table has nokey_shapearm, so a save of any other key leaves the block byte for byte as written. A switch and everyclauth startcopy write the live rows as top-levelmodelPickerand remove the key for an account without a picker, the same set-or-remove rulemodelfollows.modelPickerjoinsPER_PROFILE_TOP_FIELDSinsettings_sync, next tomodelandadvisorModel, so one account's list never reaches a sibling's runtime copy or the base.duplicate_profilecopies the picker. The profile, writer and sync changes share one commit becauseModelPicker::live_optionshas no caller without the writer and clippy fails the split.feat(tui)shows the picker on the Setup tab. The account header gets a read-onlypickerline that readsnone,1 optionorN options, with(replaces built-in)after it whenreplace_built_inis true. It takes no focus stop and opens no editor, and the new-account form doesn't show it.docs(wiki)adds aModel pickersubsection underModel routingwith the silk example, the field mapping, and theconfig.tomlkey-table row, plus a test that parses the example and checks the exact wording.User-visible changes
[model_picker]table inconfig.toml. A freshly createdconfig.tomlends with a short doc block and a commented example. Existing files gain nothing.clauth startremoves an existingmodelPickerfor an account with no picker, including one set by hand in~/.claude/settings.json. Anyone who keeps a picker there today needs to move it into the account's[model_picker]. The wiki says so.pickerline in the Setup tab's account header.Not in this PR
clauth startsession moved to another account keeps the picker its runtime copy started with, because the swap executor hands over only the effort settings (CLAUDE_CODE_EFFORT_LEVELand themodelSettingslevels). HandingmodelPickerover next to them could be a follow-up.modelPickerin~/.claude/settings.json, as it already doesmodelandadvisorModel.settings.jsononly changes when you switch onto the account again. Every hand-editedconfig.tomlfield behaves this way today.config.tomlfrom loading, as any broken key does. Parsing it leniently could be a follow-up.replace_built_in = truewith no live rows writes nomodelPicker, so the built-ins stay. Theconfig.tomldoc block doesn't say that a row is needed.modelPickerwin over the profile's, by Claude Code's design.Testing
I merged
mommyat 2e5cbbf into the branch (bcebd92), which brings in #173. Four files conflicted:src/claude.rs,src/profile.rs,src/settings_sync.rsandtests/inline/profile.rs. Each resolution keeps both features. The settings writer setsmodelPickerand the per-modelmodelSettingseffort levels side by side, a freshconfig.tomlgets both the[model_picker]and[model_effort]doc blocks, and the doc-digest and table-set tests list both tables. One picker test intests/inline/settings_sync.rsnow passesPerProfileKeys::default()tokey_role, whose argument type #173 changed.cargo fmt --all -- --checkpasses.cargo clippy --locked --all-targets --all-features -- -D warningspasses on the merge.I ran the full suite with
cargo nextest run --no-fail-faston the merge and onmommyat 2e5cbbf, side by side on the same machine. On the merge, 13280 tests ran: 13225 passed, 55 failed and 16 were skipped. Onmommy, 13255 ran: 13198 passed, 57 failed and 16 were skipped. Every test that fails on the merge also fails onmommy. The 55 are:usage::scheduler::tests, each panicking withchild <pid> never finished its exec(tests/inline/scheduler.rs:10109), the same failures this PR showed before the merge.daemon::gateway::tests::every_restart_only_setting_restarts_once_when_it_changes, which gives up after 10s waiting for the slot to readStarting.The two extra failures on
mommyaremcp::teststests that pass on the merge.Every integration test binary passes.
The new tests cover a config table that loads with its aliases and blank rows, a save that leaves a hand-written block byte-identical, the set-or-remove write on switch and in a
clauth startcopy, a picker-only profile creatingsettings.json, sync keeping each member's picker, the duplicate copy, the Setup line for 0, 1, 2 and 5 rows, and the wiki example.The manual checks and screenshots below ran on the branch before the merge (3474f10).
Manual check in a throwaway HOME with three API-key accounts. The Setup tab shows
5 options (replaces built-in)for one holding the silk example,1 optionfor a one-row picker andnonefor an account without one. Moving through the account's rows never stops on the picker line, the new-account form has no picker line, and browsing leaves the silk account'sconfig.tomlbyte-identical.Screenshots
I wrote the
settings.jsonthat clauth builds for the silk example into a throwaway Claude Code 2.1.323 config dir, with a dummy key and a base URL that goes nowhere./modelthen lists Kimi K3.1 Pro, DeepSeek V4.1 Flash 1017, GLM-5.3, GLM-5.3 Flash and Hy4 in place of the built-in models (last screenshot).Only unit tests cover the removal side of that path. A real switch would touch the keychain, so I didn't run one.
Checklist
sk-ant-*, no~/.claude/~/.clauthcontents)cargo fmt --all -- --check,cargo clippy --locked --all-targets --all-features -- -D warningsandcargo test --locked --all-featurespass locally (fmt and clippy pass; 55 tests fail the same way onmommyat 2e5cbbf, see Testing)AI