@astrosheep/pi-quota 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/extension.ts +5 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Add bindings in global `~/.pi/agent/settings.json` under `quotaUsage` (not proje
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Use the **exact Pi provider ID**. Built-in providers and explicitly bound providers are queried; explicit bindings replace a built-in adapter with the same ID. Unknown keys or adapter options are rejected. The API key and
|
|
39
|
+
Use the **exact Pi provider ID**. Built-in providers and explicitly bound providers are queried; explicit bindings replace a built-in adapter with the same ID. Unknown keys or adapter options are rejected. The API key comes from Pi's provider auth, and the endpoint comes from the provider's registered model; do not put model API keys in `quotaUsage`.
|
|
40
40
|
|
|
41
41
|
| Adapter | Endpoint | Result |
|
|
42
42
|
|---|---|---|
|
package/package.json
CHANGED
package/src/extension.ts
CHANGED
|
@@ -85,8 +85,11 @@ export function createQuotaExtension(options: QuotaExtensionOptions = {}) {
|
|
|
85
85
|
if (typeof value === 'string') headers[name] = value;
|
|
86
86
|
}
|
|
87
87
|
const auth: ProviderAuth = { ...resolved.auth, headers };
|
|
88
|
-
//
|
|
89
|
-
|
|
88
|
+
// Provider auth often has no endpoint. /usage also queries providers other
|
|
89
|
+
// than the selected model, so resolve their configured model URL as well.
|
|
90
|
+
const model = ctx.model?.provider === provider ? ctx.model
|
|
91
|
+
: ctx.modelRegistry.getAll().find(model => model.provider === provider);
|
|
92
|
+
if (model?.baseUrl) auth.baseUrl = model.baseUrl;
|
|
90
93
|
return auth;
|
|
91
94
|
};
|
|
92
95
|
|