You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(budget-model): rewrite README and JSDoc for nested auth shape
- README usage examples updated from `{ model, apiKey }` to `{ model, auth }`
with `{ ...auth }` spread idiom.
- New section documenting both forms of `modelOverride` (string vs object),
including the auth-bypass use case.
- Restored JSDoc on `BudgetModel` interface explaining the spread pattern.
- Expanded `findBudgetModel` JSDoc to describe override semantics.
- Added auth.test.ts case for object form with empty auth (`auth: {}`),
confirming SDK-resolved-credentials use case isn't rejected.
Align `@mariozechner/pi-coding-agent` (and `@mariozechner/pi-tui` for `pi-no-soft-cursor`) `devDependency` to `^0.63.0`.
11
+
12
+
`devDependency`-only update; no runtime change. Published `dist/*.d.ts` may reference newer upstream types from pi 0.63 (e.g. the `signal` property on `ExtensionContext`), so consumers writing extensions against these packages should be on pi ≥ 0.63 to match. Required to keep `tsup --dts` working alongside `pi-budget-model`, which now depends on the 0.63 registry API.
@@ -67,7 +82,7 @@ When the active model is already the cheapest (like Haiku 4.5), you can widen th
67
82
68
83
| Option | Type | Default | Description |
69
84
|--------|------|---------|-------------|
70
-
|`modelOverride`|`"provider/model-id"`| — | Pin a specific model, bypassing auto-selection entirely |
85
+
|`modelOverride`|`"provider/model-id"`\|`{ model, auth }`| — | Pin a specific model, bypassing auto-selection entirely |
71
86
|`strategy`|`"same-provider"`\|`"any-provider"`|`"same-provider"`| Where to search for budget models |
72
87
|`costRatio`|`0`–`1`|`0.5`| Max cost as fraction of active model (0 = free only) |
73
88
|`majorVersions`|`0`, `1`, `2`, ... |`1`| How many major versions to search (1 = latest, 2 = latest + previous, 0 = all) |
@@ -76,9 +91,12 @@ Options are validated at runtime with [valibot](https://valibot.dev). Invalid va
76
91
77
92
### `modelOverride`
78
93
79
-
When set, **all other options are ignored**. The model is resolved directly from the registry by provider and ID — no strategy, cost ratio, or version filtering applies. Throws `NoBudgetModelError` if the model doesn't exist or has no API key.
94
+
When set, **all other options are ignored**. The model is resolved directly from the registry by provider and ID — no strategy, cost ratio, or version filtering applies. Throws `NoBudgetModelError` if the model doesn't exist in the registry.
95
+
96
+
Two forms:
80
97
81
-
This is useful for pinning a known-good model in config files, or for testing.
98
+
-**String**`"provider/model-id"`: registry resolves both the model metadata and the auth credentials. Use this for pinning a known-good model in config files or for testing.
99
+
-**Object**`{ model: "provider/model-id", auth: { apiKey?, headers? } }`: registry resolves the model metadata via `find()`, but auth is taken straight from the option — the registry's auth pipeline (`getApiKeyAndHeaders`) is not invoked. Use this as an escape hatch when the registry's auth resolution misbehaves for your provider, or to inject credentials from a non-pi source.
82
100
83
101
### Reusable options schema
84
102
@@ -104,7 +122,7 @@ For `same-provider` (default):
104
122
3. Find the cheapest model(s) by input cost
105
123
4. Verify the cheapest is within the cost ratio vs the active model
106
124
5. Among ties: higher version numbers win, aliases preferred over dated snapshots
107
-
6. Return the first candidate with an available API key
125
+
6. Return the first candidate the registry can authenticate (any `ok: true` result, including header-only and SDK-resolved auth)
108
126
109
127
For `any-provider`: same steps but across all providers, grouped independently per provider then merged.
110
128
@@ -114,7 +132,7 @@ Throws `NoBudgetModelError` when no suitable model is found. The error includes
0 commit comments