@metyatech/ai-quota 0.3.0 → 0.9.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.
- package/README.md +122 -45
- package/dist/amazon-q.d.ts +13 -4
- package/dist/amazon-q.d.ts.map +1 -1
- package/dist/amazon-q.js +16 -5
- package/dist/amazon-q.js.map +1 -1
- package/dist/claude.d.ts +6 -2
- package/dist/claude.d.ts.map +1 -1
- package/dist/claude.js +6 -2
- package/dist/claude.js.map +1 -1
- package/dist/cli.d.ts +0 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +64 -376
- package/dist/cli.js.map +1 -1
- package/dist/codex.d.ts +7 -6
- package/dist/codex.d.ts.map +1 -1
- package/dist/codex.js +13 -8
- package/dist/codex.js.map +1 -1
- package/dist/copilot.d.ts +20 -3
- package/dist/copilot.d.ts.map +1 -1
- package/dist/copilot.js +71 -3
- package/dist/copilot.js.map +1 -1
- package/dist/gemini.d.ts +7 -5
- package/dist/gemini.d.ts.map +1 -1
- package/dist/gemini.js +26 -23
- package/dist/gemini.js.map +1 -1
- package/dist/index.d.ts +33 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +206 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +25 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +134 -0
- package/dist/mcp.js.map +1 -0
- package/dist/types.d.ts +105 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +39 -0
- package/dist/utils.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -21,24 +21,73 @@ npx @metyatech/ai-quota
|
|
|
21
21
|
### Commands
|
|
22
22
|
|
|
23
23
|
```
|
|
24
|
-
ai-quota [agent]
|
|
25
|
-
ai-quota
|
|
26
|
-
ai-quota --
|
|
27
|
-
ai-quota --
|
|
28
|
-
ai-quota --
|
|
29
|
-
ai-quota --
|
|
24
|
+
ai-quota [agent] Show quota for all agents, or a single named agent
|
|
25
|
+
ai-quota record [agent] Record usage for agents with local tracking (e.g. amazon-q)
|
|
26
|
+
ai-quota --json Machine-readable JSON output
|
|
27
|
+
ai-quota --mcp Start as an MCP server
|
|
28
|
+
ai-quota --quiet Suppress non-error output (useful in scripts)
|
|
29
|
+
ai-quota --verbose Print debug info to stderr
|
|
30
|
+
ai-quota --help Show usage information
|
|
31
|
+
ai-quota --version Show version
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
Supported agent names: `claude`, `gemini`, `copilot`, `amazon-q`, `codex`
|
|
33
35
|
|
|
36
|
+
### Usage Examples
|
|
37
|
+
|
|
38
|
+
**Check all quotas:**
|
|
39
|
+
```bash
|
|
40
|
+
ai-quota
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Record Amazon Q usage (+1 request):**
|
|
44
|
+
```bash
|
|
45
|
+
ai-quota record amazon-q
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Model Context Protocol (MCP)
|
|
49
|
+
|
|
50
|
+
`ai-quota` can act as an MCP server, allowing AI agents (like Claude Desktop) to check your
|
|
51
|
+
remaining quota automatically.
|
|
52
|
+
|
|
53
|
+
### Setup for Claude Desktop
|
|
54
|
+
|
|
55
|
+
Add the following to your `claude_desktop_config.json`:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"ai-quota": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["-y", "@metyatech/ai-quota", "--mcp"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This exposes the `get_quota` tool to Claude, which it can use to stay aware of its own usage
|
|
69
|
+
limits across different models and providers.
|
|
70
|
+
|
|
71
|
+
### MCP Resources
|
|
72
|
+
|
|
73
|
+
`ai-quota` also provides an MCP resource:
|
|
74
|
+
- **URI:** `quota://current`
|
|
75
|
+
- **Description:** A live, auto-updating Markdown table of all current AI agent quotas.
|
|
76
|
+
|
|
77
|
+
AI agents can "subscribe" to this resource to keep the quota information in their context
|
|
78
|
+
without needing to explicitly call a tool.
|
|
79
|
+
|
|
80
|
+
**Tool: `get_quota`**
|
|
81
|
+
- `agent` (optional): Specific agent to check (`claude`, `gemini`, etc.). If omitted, returns quota for all agents in a Markdown table.
|
|
82
|
+
|
|
34
83
|
### Human-readable output example
|
|
35
84
|
|
|
36
85
|
```
|
|
37
|
-
claude:
|
|
38
|
-
gemini:
|
|
39
|
-
copilot:
|
|
40
|
-
amazon-q:
|
|
41
|
-
codex:
|
|
86
|
+
claude: 5h: 8% (resets in 1h 39m), 7d: 22% (resets in 140h 39m)
|
|
87
|
+
gemini: Pro: 4% (resets in 14h 14m), Flash: 40% (resets in 14h 18m)
|
|
88
|
+
copilot: 72% used (resets in 9d 11h)
|
|
89
|
+
amazon-q: 0/50 requests used
|
|
90
|
+
codex: 5h: 65% (resets in 3h), Weekly: 21% (resets in 6d)
|
|
42
91
|
```
|
|
43
92
|
|
|
44
93
|
### JSON output example
|
|
@@ -49,35 +98,63 @@ ai-quota --json
|
|
|
49
98
|
|
|
50
99
|
```json
|
|
51
100
|
{
|
|
52
|
-
"claude": { "usedPercent":
|
|
53
|
-
"gemini": { "usedPercent":
|
|
54
|
-
"copilot": { "usedPercent":
|
|
55
|
-
"amazon-q": { "used":
|
|
56
|
-
"codex": { "usedPercent":
|
|
101
|
+
"claude": { "usedPercent": 8, "resetsAt": "2026-02-19T14:00:00Z", "five_hour": { ... }, "seven_day": { ... } },
|
|
102
|
+
"gemini": { "usedPercent": 4, "resetsAt": "2026-02-20T02:34:17.000Z", "gemini-3-pro-preview": { ... }, "gemini-3-flash-preview": { ... } },
|
|
103
|
+
"copilot": { "usedPercent": 72, "resetsAt": "2026-03-01T00:00:00Z" },
|
|
104
|
+
"amazon-q": { "used": 0, "limit": 50, "percentRemaining": 100, "resetsAt": "2026-03-01T00:00:00Z" },
|
|
105
|
+
"codex": { "usedPercent": 65, "resetsAt": "2026-02-19T14:50:56Z", "fiveHour": { ... }, "weekly": { ... } }
|
|
57
106
|
}
|
|
58
107
|
```
|
|
59
108
|
|
|
60
109
|
### Credential lookup
|
|
61
110
|
|
|
62
|
-
| Agent
|
|
63
|
-
|
|
64
|
-
| Claude
|
|
65
|
-
| Gemini
|
|
66
|
-
| Copilot
|
|
67
|
-
| Amazon Q
|
|
68
|
-
| Codex
|
|
111
|
+
| Agent | Source |
|
|
112
|
+
| -------- | ------------------------------------------------------------------- |
|
|
113
|
+
| Claude | `~/.claude/.credentials.json` |
|
|
114
|
+
| Gemini | `~/.gemini/oauth_creds.json` |
|
|
115
|
+
| Copilot | `GITHUB_TOKEN` env var, `gh auth token` CLI, or `hosts.yml` |
|
|
116
|
+
| Amazon Q | `AMAZON_Q_STATE_PATH` env var (defaults to `~/agent-runner/state/`) |
|
|
117
|
+
| Codex | `~/.codex/sessions/` JSONL files, or `~/.codex/auth.json` |
|
|
69
118
|
|
|
70
119
|
Exit code is `0` on success. Exit code `1` if any agent fetch fails.
|
|
71
120
|
|
|
121
|
+
### Advanced usage (SDK)
|
|
122
|
+
|
|
123
|
+
To fetch quota for all agents at once:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { fetchAllRateLimits } from "@metyatech/ai-quota";
|
|
127
|
+
|
|
128
|
+
const all = await fetchAllRateLimits();
|
|
129
|
+
console.log("Overall status:", all.summary.status); // "healthy", "warning", or "critical"
|
|
130
|
+
console.log("Summary message:", all.summary.message);
|
|
131
|
+
console.log("Claude status:", all.claude.display);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
To fetch only specific agents (more efficient):
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { fetchAllRateLimits } from "@metyatech/ai-quota";
|
|
138
|
+
|
|
139
|
+
// Only fetch Claude and Copilot
|
|
140
|
+
const results = await fetchAllRateLimits({
|
|
141
|
+
agents: ["claude", "copilot"]
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
console.log(results.claude.display);
|
|
145
|
+
console.log(results.copilot.display);
|
|
146
|
+
console.log(results.gemini.display); // "skipped"
|
|
147
|
+
```
|
|
148
|
+
|
|
72
149
|
## Supported agents
|
|
73
150
|
|
|
74
|
-
| Agent
|
|
75
|
-
|
|
76
|
-
| Claude
|
|
77
|
-
| Gemini
|
|
78
|
-
| Copilot
|
|
79
|
-
| Amazon Q
|
|
80
|
-
| Codex
|
|
151
|
+
| Agent | Source | API type |
|
|
152
|
+
| -------- | ----------------------------------------- | ---------------------- |
|
|
153
|
+
| Claude | `~/.claude/.credentials.json` | REST (Anthropic OAuth) |
|
|
154
|
+
| Gemini | `~/.gemini/oauth_creds.json` | REST (Google OAuth) |
|
|
155
|
+
| Copilot | GitHub token (caller-provided) | REST (GitHub API) |
|
|
156
|
+
| Amazon Q | Local JSON counter file | Local state (see note) |
|
|
157
|
+
| Codex | JSONL session files / ChatGPT backend API | Local files + REST |
|
|
81
158
|
|
|
82
159
|
> **Amazon Q limitation:** Amazon Q Developer (free tier) does not provide a public API for
|
|
83
160
|
> querying usage or quota programmatically as of February 2026. There is no official AWS SDK
|
|
@@ -140,12 +217,12 @@ if (usage) {
|
|
|
140
217
|
|
|
141
218
|
Options:
|
|
142
219
|
|
|
143
|
-
| Option | Type | Default
|
|
144
|
-
|
|
145
|
-
| `token` | `string` | required
|
|
146
|
-
| `timeoutSeconds` | `number` | `20`
|
|
147
|
-
| `apiBaseUrl` | `string` | `https://api.github.com`
|
|
148
|
-
| `apiVersion` | `string` | `2025-05-01`
|
|
220
|
+
| Option | Type | Default | Description |
|
|
221
|
+
| ---------------- | -------- | ------------------------ | ---------------------------- |
|
|
222
|
+
| `token` | `string` | required | GitHub personal access token |
|
|
223
|
+
| `timeoutSeconds` | `number` | `20` | Request timeout in seconds |
|
|
224
|
+
| `apiBaseUrl` | `string` | `https://api.github.com` | Override GitHub API base URL |
|
|
225
|
+
| `apiVersion` | `string` | `2025-05-01` | GitHub API version header |
|
|
149
226
|
|
|
150
227
|
### Amazon Q
|
|
151
228
|
|
|
@@ -182,11 +259,11 @@ if (snapshot) {
|
|
|
182
259
|
|
|
183
260
|
Options for `fetchCodexRateLimits`:
|
|
184
261
|
|
|
185
|
-
| Option | Type | Default
|
|
186
|
-
|
|
187
|
-
| `codexHome` | `string` | `~/.codex`
|
|
188
|
-
| `timeoutSeconds` | `number` | `20`
|
|
189
|
-
| `timingSink` | `function` | none
|
|
262
|
+
| Option | Type | Default | Description |
|
|
263
|
+
| ---------------- | ---------- | ---------- | ------------------------------------ |
|
|
264
|
+
| `codexHome` | `string` | `~/.codex` | Path to the Codex home directory |
|
|
265
|
+
| `timeoutSeconds` | `number` | `20` | HTTP API fallback timeout in seconds |
|
|
266
|
+
| `timingSink` | `function` | none | Callback for per-phase timing (ms) |
|
|
190
267
|
|
|
191
268
|
## Dev commands
|
|
192
269
|
|
|
@@ -201,10 +278,10 @@ npm run verify # lint + test + build (full CI suite)
|
|
|
201
278
|
|
|
202
279
|
## Environment variables
|
|
203
280
|
|
|
204
|
-
| Variable
|
|
205
|
-
|
|
206
|
-
| `AGENT_RUNNER_GEMINI_OAUTH_CLIENT_ID`
|
|
207
|
-
| `AGENT_RUNNER_GEMINI_OAUTH_CLIENT_SECRET` | Gemini
|
|
281
|
+
| Variable | Used by | Purpose |
|
|
282
|
+
| ----------------------------------------- | ------- | ----------------------------------------------- |
|
|
283
|
+
| `AGENT_RUNNER_GEMINI_OAUTH_CLIENT_ID` | Gemini | Override OAuth client ID when Gemini CLI absent |
|
|
284
|
+
| `AGENT_RUNNER_GEMINI_OAUTH_CLIENT_SECRET` | Gemini | Override OAuth client secret |
|
|
208
285
|
|
|
209
286
|
## SemVer policy
|
|
210
287
|
|
package/dist/amazon-q.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { AmazonQUsageSnapshot } from "./types.js";
|
|
2
2
|
export type { AmazonQUsageSnapshot } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default monthly request limit for the Amazon Q Developer free tier.
|
|
5
|
+
* As of February 2026, this is 50 requests per month.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_AMAZON_Q_MONTHLY_LIMIT = 50;
|
|
3
8
|
/**
|
|
4
9
|
* NOTE: Amazon Q Developer (free tier) does not provide a public API for
|
|
5
10
|
* querying usage or quota programmatically (as of February 2026). There is
|
|
@@ -44,11 +49,15 @@ export declare function saveAmazonQUsageState(statePath: string, state: AmazonQU
|
|
|
44
49
|
*/
|
|
45
50
|
export declare function recordAmazonQUsage(statePath: string, count?: number, now?: Date): AmazonQUsageState;
|
|
46
51
|
/**
|
|
47
|
-
* Reads the local counter and returns a quota snapshot.
|
|
52
|
+
* Reads the local counter and returns a quota snapshot for Amazon Q Developer.
|
|
53
|
+
*
|
|
54
|
+
* Since Amazon Q does not provide a public usage API, this function relies
|
|
55
|
+
* on a local JSON state file updated by the calling application.
|
|
48
56
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
57
|
+
* @param statePath - Path to the local usage state JSON file
|
|
58
|
+
* @param monthlyLimit - The configured monthly request limit (e.g., 50)
|
|
59
|
+
* @param now - Reference date for parsing (default: current system time)
|
|
60
|
+
* @returns A snapshot of the current local usage counter
|
|
52
61
|
*/
|
|
53
62
|
export declare function fetchAmazonQRateLimits(statePath: string, monthlyLimit: number, now?: Date): AmazonQUsageSnapshot;
|
|
54
63
|
//# sourceMappingURL=amazon-q.d.ts.map
|
package/dist/amazon-q.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amazon-q.d.ts","sourceRoot":"","sources":["../src/amazon-q.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;;;GAaG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GAAG,IAAI,CAGvF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,MAAU,EACjB,GAAG,GAAE,IAAiB,GACrB,iBAAiB,CAUnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,GAAG,GAAE,IAAiB,GACrB,oBAAoB,CAetB"}
|
package/dist/amazon-q.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Default monthly request limit for the Amazon Q Developer free tier.
|
|
5
|
+
* As of February 2026, this is 50 requests per month.
|
|
6
|
+
*/
|
|
7
|
+
export const DEFAULT_AMAZON_Q_MONTHLY_LIMIT = 50;
|
|
3
8
|
function resolveMonthlyPeriodKey(now) {
|
|
4
9
|
const year = now.getUTCFullYear();
|
|
5
10
|
const month = now.getUTCMonth() + 1;
|
|
@@ -82,16 +87,22 @@ export function recordAmazonQUsage(statePath, count = 1, now = new Date()) {
|
|
|
82
87
|
return updated;
|
|
83
88
|
}
|
|
84
89
|
/**
|
|
85
|
-
* Reads the local counter and returns a quota snapshot.
|
|
90
|
+
* Reads the local counter and returns a quota snapshot for Amazon Q Developer.
|
|
91
|
+
*
|
|
92
|
+
* Since Amazon Q does not provide a public usage API, this function relies
|
|
93
|
+
* on a local JSON state file updated by the calling application.
|
|
86
94
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
95
|
+
* @param statePath - Path to the local usage state JSON file
|
|
96
|
+
* @param monthlyLimit - The configured monthly request limit (e.g., 50)
|
|
97
|
+
* @param now - Reference date for parsing (default: current system time)
|
|
98
|
+
* @returns A snapshot of the current local usage counter
|
|
90
99
|
*/
|
|
91
100
|
export function fetchAmazonQRateLimits(statePath, monthlyLimit, now = new Date()) {
|
|
92
101
|
const state = loadAmazonQUsageState(statePath, now);
|
|
93
102
|
const used = Math.max(0, state.used);
|
|
94
|
-
const percentRemaining = monthlyLimit <= 0
|
|
103
|
+
const percentRemaining = monthlyLimit <= 0
|
|
104
|
+
? 0
|
|
105
|
+
: Math.min(100, Math.max(0, ((monthlyLimit - used) / monthlyLimit) * 100));
|
|
95
106
|
return {
|
|
96
107
|
used,
|
|
97
108
|
limit: monthlyLimit,
|
package/dist/amazon-q.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amazon-q.js","sourceRoot":"","sources":["../src/amazon-q.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"amazon-q.js","sourceRoot":"","sources":["../src/amazon-q.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAK7B;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAuBjD,SAAS,uBAAuB,CAAC,GAAS;IACxC,MAAM,IAAI,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACpC,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAS;IAC1C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC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,SAAS,EAAE,GAAG,CAAC,WAAW,EAAE;KAC7B,CAAC;IACF,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,YAAoB,EACpB,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,KAAK,GAAG,qBAAqB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,gBAAgB,GACpB,YAAY,IAAI,CAAC;QACf,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAE/E,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,YAAY;QACnB,gBAAgB;QAChB,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC;QACvC,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC;AACJ,CAAC"}
|
package/dist/claude.d.ts
CHANGED
|
@@ -3,8 +3,12 @@ export type { ClaudeUsageData, ClaudeUsageBucket } from "./types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Fetches Claude usage data from the Anthropic OAuth usage API.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* This function attempts to read credentials from the Claude desktop application's
|
|
7
|
+
* local storage (`~/.claude/.credentials.json`) and calls the Anthropic usage API.
|
|
8
|
+
*
|
|
9
|
+
* @param timeoutMs - Request timeout in milliseconds (default: 5000ms)
|
|
10
|
+
* @returns A promise resolving to ClaudeUsageData or null if credentials are
|
|
11
|
+
* missing, expired, or the API request fails.
|
|
8
12
|
*/
|
|
9
13
|
export declare function fetchClaudeRateLimits(timeoutMs?: number): Promise<ClaudeUsageData | null>;
|
|
10
14
|
//# sourceMappingURL=claude.d.ts.map
|
package/dist/claude.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../src/claude.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAiCrE
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../src/claude.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAiCrE;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,GAAE,MAAa,GACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAkEjC"}
|
package/dist/claude.js
CHANGED
|
@@ -35,8 +35,12 @@ function readClaudeCredentials() {
|
|
|
35
35
|
/**
|
|
36
36
|
* Fetches Claude usage data from the Anthropic OAuth usage API.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* This function attempts to read credentials from the Claude desktop application's
|
|
39
|
+
* local storage (`~/.claude/.credentials.json`) and calls the Anthropic usage API.
|
|
40
|
+
*
|
|
41
|
+
* @param timeoutMs - Request timeout in milliseconds (default: 5000ms)
|
|
42
|
+
* @returns A promise resolving to ClaudeUsageData or null if credentials are
|
|
43
|
+
* missing, expired, or the API request fails.
|
|
40
44
|
*/
|
|
41
45
|
export async function fetchClaudeRateLimits(timeoutMs = 5000) {
|
|
42
46
|
try {
|
package/dist/claude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sour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-quota [agent] Show quota for all agents, or a specific agent
|
|
7
|
-
* ai-quota --json Output machine-readable JSON
|
|
8
|
-
* ai-quota --help Show help
|
|
9
|
-
* ai-quota --version Show version
|
|
10
|
-
*
|
|
11
|
-
* Agents: claude, gemini, copilot, amazon-q, codex
|
|
12
4
|
*/
|
|
13
5
|
export {};
|
|
14
6
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG"}
|