Overview
| Artifact ID: | 09baa87fee38f50c8704eb1a5c9cf26c77fff5ad4a4d0a233b6485898fc2ea89 |
|---|---|
| Page Name: | checkin/6b85612d46257df0bc0a4d97d6c3dd3657908bfaa434f8141820646c6e5e3229 |
| Date: | 2026-11-24 18:06:38 |
| Original User: | dmestas |
| Mimetype: | text/x-markdown |
Content
/auth step 4 (#73): rules give a model family its own key
A rule is the setting keyFor:PATTERN, whose value is a key label. PATTERN is a model id
(provider/id) with * for any part. The models it matches use that key of their own provider.
The rest of the provider keeps its key. A rule never sends a model to another provider.
Which key a request uses, in order:
- the per-process label:
--key, the conversation's own key (step 1), or RPCset_credential - the rule for the request's model: an exact pattern first, then the longest pattern that matches
activeKey:PROVIDER, and the rest of the existing lookup order
Where
- cred.c (core):
pic_cred_model(model)tells cred which model the next requests are for.pic_cred_rules,pic_cred_rule_forandpic_cred_rule_setread, match and save rules;cred_rule_ofis one new step incred_choose.pic_cred_usedgainsrule. A rule as long as an existing one that could match the same models is refused, naming the existing one. - provider_http.c sets the model just before a request fetches its key, and main.c
model_providersets it too. - Shell:
pic auth use P L --for PATTERN [--json]andpic auth use P --for PATTERN --clear.pic auth statuslists the rules. - JSON:
bindingsinget_credentialsandpic auth status --json. Eachpic models --jsonrow gainscredential,bound_byandrule. - RPC:
set_model_credential {pattern, label|null}, saved. - TUI: the model picker's key column (tui_mrow.key) reads "second" or "work by rule". In /auth,
bon a key takes a pattern, and Enter saves it, or removes it when the key already has that rule. Each row says which families its rules give it.
For the MCP work: cred.c gained new functions and one branch in cred_choose; no existing
function changed shape.
Not here
The proposal's scope session for set_model_credential (a rule for one process) is not
implemented: rules are always saved.
Tests
- test/pic/authcmd.sh: a rules section covering the shell, RPC, which key is actually sent, that
--keystill wins, the conflict refusal, and thepic models --jsonfields. - test/tui/auth.sh:
band the picker's key column.
Tier: core (cred.c, provider_http.c), root (main.c), client (tui); no new file. Clock: pi. Record:
settings keyFor:PATTERN. Default: no rules.