@astrosheep/pi-quota 0.12.1 → 0.12.2

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.
@@ -4,7 +4,9 @@ import { QuotaError } from "./types.js";
4
4
  import { safeBaseUrl } from "./url.js";
5
5
  export function sub2ApiUsageUrl(baseUrl) {
6
6
  const url = safeBaseUrl(baseUrl);
7
- url.pathname = `${url.pathname.replace(/\/+$/, '')}/usage`;
7
+ // Anthropic clients use the host root; OpenAI clients include /v1.
8
+ const prefix = url.pathname.replace(/\/+$/, '') || '/v1';
9
+ url.pathname = `${prefix}/usage`;
8
10
  return url.toString();
9
11
  }
10
12
  function currency(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/pi-quota",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,8 +43,12 @@
43
43
  "@earendil-works/pi-tui": "*"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
- "@earendil-works/pi-coding-agent": { "optional": true },
47
- "@earendil-works/pi-tui": { "optional": true }
46
+ "@earendil-works/pi-coding-agent": {
47
+ "optional": true
48
+ },
49
+ "@earendil-works/pi-tui": {
50
+ "optional": true
51
+ }
48
52
  },
49
53
  "devDependencies": {
50
54
  "@types/node": "^22.0.0",
@@ -6,7 +6,9 @@ import type { AccountBalance, QuotaAdapter, QuotaAllowance, QuotaSnapshot, Quota
6
6
 
7
7
  export function sub2ApiUsageUrl(baseUrl: string | undefined): string {
8
8
  const url = safeBaseUrl(baseUrl);
9
- url.pathname = `${url.pathname.replace(/\/+$/, '')}/usage`;
9
+ // Anthropic clients use the host root; OpenAI clients include /v1.
10
+ const prefix = url.pathname.replace(/\/+$/, '') || '/v1';
11
+ url.pathname = `${prefix}/usage`;
10
12
  return url.toString();
11
13
  }
12
14