quota-axi 0.1.0 → 0.1.1

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  <h1 align="center">quota-axi</h1>
2
2
 
3
+ <h3 align="center">Your agent needs to be aware of your quota</h3>
4
+
3
5
  <p align="center">
4
6
  <a href="https://www.npmjs.com/package/quota-axi"><img alt="npm" src="https://img.shields.io/npm/v/quota-axi?style=flat-square" /></a>
5
7
  <a href="https://github.com/kunchenguid/quota-axi/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/kunchenguid/quota-axi/ci.yml?style=flat-square&label=ci" /></a>
@@ -8,17 +10,17 @@
8
10
  <a href="https://discord.gg/Wsy2NpnZDu"><img alt="Discord" src="https://img.shields.io/discord/1439901831038763092?style=flat-square&label=discord" /></a>
9
11
  </p>
10
12
 
11
- <h3 align="center">Know your local agent quota headroom without turning it into routing advice.</h3>
13
+ Quota CLI for agents - designed with [AXI](https://axi.md) (Agent eXperience Interface).
12
14
 
13
15
  Agents need quota state before they choose where work can safely run.
14
16
  Vendor dashboards are not shaped for shell automation, and local CLIs expose different windows, resets, and auth files.
15
17
 
16
- quota-axi reports local Claude and Codex quota windows in one AXI-shaped call.
18
+ quota-axi reports local Claude and Codex quota windows in one [AXI](https://axi.md)-shaped call.
17
19
  It is data only: it never routes, recommends, proxies, intercepts, logs in, imports browser cookies, or mutates provider state.
18
20
 
19
- - **Honest comparison ceiling** - quota-axi reports normalized quota windows, reset times, and provider credit balances when available.
20
- - **Local first** - it reads local Claude and Codex auth sources, calls first-party provider endpoints, and can fall back to a read-only Codex app-server probe.
21
- - **Agent shaped** - default stdout is compact TOON, with JSON available for callers that need the normalized model.
21
+ - **Official sources** - quota-axi reads local Claude and Codex auth files and calls the same first-party usage endpoints the vendor CLIs use, with a read-only Codex app-server probe as fallback.
22
+ - **Local first** - everything runs on the machine that holds the credentials; the only network calls are to Anthropic's and OpenAI's own usage endpoints, never a third-party relay.
23
+ - **Token efficient** - default stdout is compact TOON so agents spend fewer tokens parsing quota state, with `--json` available when a caller needs the normalized model.
22
24
 
23
25
  ## Quick Start
24
26
 
@@ -26,23 +28,66 @@ It is data only: it never routes, recommends, proxies, intercepts, logs in, impo
26
28
  $ npx -y quota-axi
27
29
  bin: ~/.npm/_npx/.../quota-axi
28
30
  description: Report local agent-provider quota windows for routing-aware agents
29
- generatedAt: "2026-07-06T18:10:00.000Z"
31
+ generatedAt: "2026-03-15T16:42:00.000Z"
30
32
  providers[2]{provider,plan,source,status,refreshedAt}:
31
- claude,pro,oauth,fresh,"2026-07-06T18:09:55.000Z"
32
- codex,plus,cli-rpc,fresh,"2026-07-06T18:09:58.000Z"
33
- windows[6]{provider,id,label,percentRemaining,resetsAt,state}:
34
- claude,five_hour,session,82,"2026-07-06T22:15:00.000Z",fresh
35
- claude,seven_day,week,64,"2026-07-10T16:00:00.000Z",fresh
36
- claude,seven_day_opus,opus week,93,"2026-07-11T09:30:00.000Z",fresh
37
- claude,extra_usage,extra usage,75,unknown,fresh
38
- codex,five_hour,session,71,"2026-07-06T21:45:00.000Z",fresh
39
- codex,weekly,week,43,"2026-07-11T09:00:00.000Z",fresh
33
+ claude,pro,oauth,fresh,"2026-03-15T16:41:55.000Z"
34
+ codex,plus,cli-rpc,fresh,"2026-03-15T16:41:58.000Z"
35
+ windows[7]{provider,id,label,percentRemaining,resetsAt,state}:
36
+ claude,five_hour,session,82,"2026-03-15T21:15:00.000Z",fresh
37
+ claude,seven_day,week,64,"2026-03-19T15:00:00.000Z",fresh
38
+ claude,seven_day_opus,opus week,93,"2026-03-20T09:30:00.000Z",fresh
39
+ claude,"model:fable",Fable week,71,"2026-03-20T09:30:00.000Z",fresh
40
+ codex,five_hour,session,58,"2026-03-15T20:45:00.000Z",fresh
41
+ codex,weekly,week,47,"2026-03-19T09:00:00.000Z",fresh
42
+ codex,"model:gpt-5.1-codex:5h",GPT-5.1-Codex session,100,"2026-03-16T01:41:58.000Z",fresh
40
43
  help[3]:
41
44
  Run `quota-axi --provider claude --json` for JSON output
42
45
  Run `quota-axi --full` to include account and source-attempt details
43
46
  Run `quota-axi auth` to inspect local auth source availability without printing secrets
44
47
  ```
45
48
 
49
+ `--json` emits the same normalized model as structured JSON instead of TOON:
50
+
51
+ ```sh
52
+ $ quota-axi --provider claude --json
53
+ {
54
+ "generatedAt": "2026-03-15T16:42:03.000Z",
55
+ "schemaVersion": 1,
56
+ "providers": [
57
+ {
58
+ "provider": "claude",
59
+ "label": "Claude",
60
+ "source": "oauth",
61
+ "plan": "pro",
62
+ "windows": [
63
+ {
64
+ "id": "five_hour",
65
+ "label": "session",
66
+ "kind": "session",
67
+ "percentUsed": 18,
68
+ "percentRemaining": 82,
69
+ "resetsAt": "2026-03-15T21:15:00.000Z"
70
+ },
71
+ {
72
+ "id": "model:fable",
73
+ "label": "Fable week",
74
+ "kind": "model",
75
+ "percentUsed": 29,
76
+ "percentRemaining": 71,
77
+ "resetsAt": "2026-03-20T09:30:00.000Z"
78
+ }
79
+ ],
80
+ "state": {
81
+ "status": "fresh",
82
+ "stale": false,
83
+ "sourcesTried": ["oauth"],
84
+ "refreshedAt": "2026-03-15T16:41:55.000Z"
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ ```
90
+
46
91
  ```sh
47
92
  $ quota-axi auth
48
93
  bin: ~/.npm/_npx/.../quota-axi
@@ -60,18 +105,29 @@ help[1]:
60
105
 
61
106
  quota-axi requires Node.js 20 or newer.
62
107
 
63
- **npm**
108
+ **Agent skill (recommended)**
109
+
110
+ Install the skill in the [Agent Skills](https://agentskills.io) format with [`npx skills`](https://github.com/vercel-labs/skills):
64
111
 
65
112
  ```sh
66
- npm install -g quota-axi
113
+ npx skills add kunchenguid/quota-axi --skill quota-axi -g
67
114
  ```
68
115
 
116
+ The skill teaches your agent to run quota-axi through `npx -y quota-axi` on demand, so nothing needs to be installed ahead of time.
117
+ `-g` installs the skill for all projects (e.g. `~/.claude/skills/`); drop it to install for the current project only (`.claude/skills/`).
118
+
69
119
  **Direct use**
70
120
 
71
121
  ```sh
72
122
  npx -y quota-axi
73
123
  ```
74
124
 
125
+ **npm**
126
+
127
+ ```sh
128
+ npm install -g quota-axi
129
+ ```
130
+
75
131
  **From source**
76
132
 
77
133
  ```sh
@@ -82,6 +138,11 @@ pnpm run build
82
138
  pnpm run dev
83
139
  ```
84
140
 
141
+ ## Agent Skill
142
+
143
+ The npm package includes `skills/quota-axi/SKILL.md`, the same installable skill recommended above.
144
+ It is generated from `src/skill.ts`; update it with `pnpm run build:skill` and verify it with `pnpm run build:skill -- --check`.
145
+
85
146
  ## How It Works
86
147
 
87
148
  ```
@@ -128,7 +189,7 @@ pnpm run dev
128
189
  | `--json` | Emit normalized JSON instead of TOON for quota or auth |
129
190
  | `--full` | Include quota account identity and source attempts |
130
191
  | `--allow-keychain-prompt` | Permit macOS Claude Keychain access that could prompt |
131
- | `-h`, `--help` | Print terse AXI help |
192
+ | `-h`, `--help` | Print terse [AXI](https://axi.md) help |
132
193
  | `-v`, `-V`, `--version` | Print version |
133
194
 
134
195
  ## Output Model
@@ -170,15 +231,18 @@ Failed providers, stale providers, account identity, and source attempts are not
170
231
  ## Development
171
232
 
172
233
  ```sh
173
- pnpm install # Install dependencies
174
- pnpm run build # Compile TypeScript to dist/
175
- pnpm test # Run fixture parser and CLI tests
176
- pnpm run dev # Run the CLI with tsx
234
+ pnpm install # Install dependencies
235
+ pnpm run build # Compile TypeScript to dist/
236
+ pnpm run lint # Run ESLint
237
+ pnpm run format:check # Check Prettier formatting
238
+ pnpm test # Run fixture parser and CLI tests
239
+ pnpm run build:skill -- --check # Verify the generated skill is current
240
+ pnpm run dev # Run the CLI with tsx
177
241
  ```
178
242
 
179
- ## Attribution
243
+ ## Contributing
180
244
 
181
- quota-axi is independently implemented from local Baby Menu quota code and public provider behavior references.
245
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the no-mistakes PR workflow, generated-file rules, and release-please conventions.
182
246
 
183
247
  ## License
184
248
 
@@ -0,0 +1,13 @@
1
+ export declare const SKILL_DESCRIPTION: string;
2
+ export declare const SKILL_AUTHOR = "Kun Chen (kunchenguid)";
3
+ export declare const HERMES_TAGS: string[];
4
+ export declare const HERMES_CATEGORY = "observability";
5
+ /**
6
+ * Render the installable SKILL.md for the quota-axi skill. The body uses the
7
+ * same shared CLI description and help text, then adds agent-facing workflow
8
+ * guidance that prefers non-interactive `npx -y quota-axi ...` invocation so
9
+ * the CLI comes along on demand.
10
+ *
11
+ * @returns full SKILL.md contents including YAML frontmatter
12
+ */
13
+ export declare function createSkillMarkdown(): string;
@@ -0,0 +1,84 @@
1
+ import { DESCRIPTION, TOP_HELP } from "./cli.js";
2
+ // Trigger string Claude Code (and other agents) match against to auto-load the skill.
3
+ // Kept terse and outcome-focused so it fires on "check quota/rate limits" intents.
4
+ export const SKILL_DESCRIPTION = "Report local Claude and Codex quota windows via the quota-axi CLI - remaining " +
5
+ "percentages, reset times, and provider status read from local auth files, with no " +
6
+ "routing, recommendation, or provider mutation. Use before deciding whether it is safe " +
7
+ "to keep spending a provider's quota, when the user asks about usage, rate limits, or " +
8
+ "remaining quota, or when comparing Claude and Codex headroom.";
9
+ export const SKILL_AUTHOR = "Kun Chen (kunchenguid)";
10
+ // Extended frontmatter read by Nous Research's Hermes Agent harness
11
+ // (https://hermes-agent.nousresearch.com/docs/user-guide/features/skills).
12
+ // Harnesses that don't know these fields (e.g. Claude Code) ignore them.
13
+ export const HERMES_TAGS = ["quota", "rate-limits", "claude", "codex", "cli"];
14
+ export const HERMES_CATEGORY = "observability";
15
+ function yamlDoubleQuote(value) {
16
+ return JSON.stringify(value);
17
+ }
18
+ /**
19
+ * Render the installable SKILL.md for the quota-axi skill. The body uses the
20
+ * same shared CLI description and help text, then adds agent-facing workflow
21
+ * guidance that prefers non-interactive `npx -y quota-axi ...` invocation so
22
+ * the CLI comes along on demand.
23
+ *
24
+ * @returns full SKILL.md contents including YAML frontmatter
25
+ */
26
+ export function createSkillMarkdown() {
27
+ return `---
28
+ name: quota-axi
29
+ description: ${yamlDoubleQuote(SKILL_DESCRIPTION)}
30
+ user-invocable: false
31
+ author: ${SKILL_AUTHOR}
32
+ metadata:
33
+ hermes:
34
+ tags: [${HERMES_TAGS.join(", ")}]
35
+ category: ${HERMES_CATEGORY}
36
+ ---
37
+
38
+ # quota-axi
39
+
40
+ ${DESCRIPTION}
41
+
42
+ You do not need quota-axi installed globally - invoke it with \`npx -y quota-axi\`.
43
+
44
+ quota-axi is data only: it never routes, recommends, proxies, intercepts, logs in, imports
45
+ browser cookies, or mutates provider state. It reads local Claude and Codex auth files and
46
+ calls first-party provider usage endpoints; it never launches the Claude CLI, so it cannot
47
+ spend the quota it measures.
48
+
49
+ ## When to use
50
+
51
+ Use quota-axi whenever you need local quota headroom before deciding whether it is safe to
52
+ keep working on a provider, when the user asks about usage, rate limits, or remaining quota,
53
+ or when comparing Claude and Codex headroom side by side.
54
+
55
+ ## Workflow
56
+
57
+ 1. Run \`npx -y quota-axi\` for compact TOON output covering both providers' quota windows.
58
+ 2. Scope to one provider with \`--provider claude\` or \`--provider codex\`.
59
+ 3. Pass \`--json\` for the normalized machine-readable model instead of TOON.
60
+ 4. Pass \`--full\` to include account identity and per-source attempt details.
61
+ 5. Run \`npx -y quota-axi auth\` to check local auth-source availability without printing
62
+ secret values.
63
+ 6. On macOS, Claude Keychain reads are skipped by default; pass \`--allow-keychain-prompt\`
64
+ to permit a Keychain prompt.
65
+
66
+ ## Usage
67
+
68
+ \`\`\`
69
+ ${TOP_HELP.trimEnd()}
70
+ \`\`\`
71
+
72
+ ## Tips
73
+
74
+ - Output is TOON-encoded and token-efficient by default; pass \`--json\` only when you need
75
+ the normalized schema.
76
+ - Exit code 0 means at least one provider returned data (fresh or stale); exit code 1 means
77
+ every provider failed; exit code 2 means a usage error.
78
+ - Percentages are not comparable across providers - quota-axi never claims one provider's
79
+ percentage equals another's.
80
+ - The cache at \`~/.cache/quota-axi/quotas.json\` only ever holds normalized non-secret
81
+ snapshots; nothing quota-axi prints or caches reveals credential values.
82
+ `;
83
+ }
84
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEjD,sFAAsF;AACtF,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAC5B,gFAAgF;IAChF,oFAAoF;IACpF,wFAAwF;IACxF,uFAAuF;IACvF,+DAA+D,CAAC;AAElE,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAErD,oEAAoE;AACpE,2EAA2E;AAC3E,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;;eAEM,eAAe,CAAC,iBAAiB,CAAC;;UAEvC,YAAY;;;aAGT,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB,eAAe;;;;;EAK7B,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BX,QAAQ,CAAC,OAAO,EAAE;;;;;;;;;;;;;CAanB,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quota-axi",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "packageManager": "pnpm@11.1.1",
5
5
  "description": "AXI CLI that reports local agent-provider quota windows without routing or mutation",
6
6
  "type": "module",
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "files": [
24
24
  "dist",
25
+ "skills/quota-axi",
25
26
  "LICENSE",
26
27
  "README.md"
27
28
  ],
@@ -35,9 +36,13 @@
35
36
  },
36
37
  "scripts": {
37
38
  "build": "tsc",
39
+ "build:skill": "tsx scripts/build-skill.ts",
38
40
  "test": "vitest run",
39
41
  "test:watch": "vitest",
40
42
  "dev": "tsx bin/quota-axi.ts",
43
+ "lint": "eslint bin src test scripts",
44
+ "format": "prettier --write .",
45
+ "format:check": "prettier --check .",
41
46
  "prepublishOnly": "npm run build"
42
47
  },
43
48
  "license": "MIT",
@@ -48,10 +53,14 @@
48
53
  "@toon-format/toon": "2.1.0"
49
54
  },
50
55
  "devDependencies": {
56
+ "@eslint/js": "10.0.1",
51
57
  "@types/node": "22.0.0",
58
+ "eslint": "10.1.0",
59
+ "globals": "17.7.0",
52
60
  "prettier": "3.8.1",
53
61
  "tsx": "4.0.0",
54
62
  "typescript": "6.0.3",
63
+ "typescript-eslint": "8.58.0",
55
64
  "vitest": "3.0.0"
56
65
  }
57
66
  }
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: quota-axi
3
+ description: "Report local Claude and Codex quota windows via the quota-axi CLI - remaining percentages, reset times, and provider status read from local auth files, with no routing, recommendation, or provider mutation. Use before deciding whether it is safe to keep spending a provider's quota, when the user asks about usage, rate limits, or remaining quota, or when comparing Claude and Codex headroom."
4
+ user-invocable: false
5
+ author: Kun Chen (kunchenguid)
6
+ metadata:
7
+ hermes:
8
+ tags: [quota, rate-limits, claude, codex, cli]
9
+ category: observability
10
+ ---
11
+
12
+ # quota-axi
13
+
14
+ Report local agent-provider quota windows for routing-aware agents.
15
+
16
+ You do not need quota-axi installed globally - invoke it with `npx -y quota-axi`.
17
+
18
+ quota-axi is data only: it never routes, recommends, proxies, intercepts, logs in, imports
19
+ browser cookies, or mutates provider state. It reads local Claude and Codex auth files and
20
+ calls first-party provider usage endpoints; it never launches the Claude CLI, so it cannot
21
+ spend the quota it measures.
22
+
23
+ ## When to use
24
+
25
+ Use quota-axi whenever you need local quota headroom before deciding whether it is safe to
26
+ keep working on a provider, when the user asks about usage, rate limits, or remaining quota,
27
+ or when comparing Claude and Codex headroom side by side.
28
+
29
+ ## Workflow
30
+
31
+ 1. Run `npx -y quota-axi` for compact TOON output covering both providers' quota windows.
32
+ 2. Scope to one provider with `--provider claude` or `--provider codex`.
33
+ 3. Pass `--json` for the normalized machine-readable model instead of TOON.
34
+ 4. Pass `--full` to include account identity and per-source attempt details.
35
+ 5. Run `npx -y quota-axi auth` to check local auth-source availability without printing
36
+ secret values.
37
+ 6. On macOS, Claude Keychain reads are skipped by default; pass `--allow-keychain-prompt`
38
+ to permit a Keychain prompt.
39
+
40
+ ## Usage
41
+
42
+ ```
43
+ usage: quota-axi [auth] [flags]
44
+ commands[2]:
45
+ (none)=quota, auth
46
+ flags[6]:
47
+ --provider <claude,codex>, --json, --full, --allow-keychain-prompt, --help, -v/--version
48
+ examples:
49
+ quota-axi
50
+ quota-axi --provider claude
51
+ quota-axi --json
52
+ quota-axi --full
53
+ quota-axi auth
54
+ ```
55
+
56
+ ## Tips
57
+
58
+ - Output is TOON-encoded and token-efficient by default; pass `--json` only when you need
59
+ the normalized schema.
60
+ - Exit code 0 means at least one provider returned data (fresh or stale); exit code 1 means
61
+ every provider failed; exit code 2 means a usage error.
62
+ - Percentages are not comparable across providers - quota-axi never claims one provider's
63
+ percentage equals another's.
64
+ - The cache at `~/.cache/quota-axi/quotas.json` only ever holds normalized non-secret
65
+ snapshots; nothing quota-axi prints or caches reveals credential values.