@tokenzero/cli 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 ADDED
@@ -0,0 +1,27 @@
1
+ # @tokenzero/cli
2
+
3
+ Command line for [TokenZero](https://tokenzero.sh): audit LLM token waste in a project, connect it to the TokenZero bring-your-own-key gateway, check usage, and verify signed savings receipts.
4
+
5
+ ```sh
6
+ npx -y @tokenzero/cli audit # local static audit; nothing is uploaded
7
+ npx -y @tokenzero/cli audit --json
8
+ npx -y @tokenzero/cli audit --fail-over 30 # CI gate: exit 1 above 30% recoverable
9
+ git diff origin/main | npx -y @tokenzero/cli audit --diff - --format markdown
10
+ ```
11
+
12
+ Audits are **static heuristics**: they read code, not traffic, and report estimates at list prices. Library and SDK repositories are detected and their findings downgraded.
13
+
14
+ ## Connecting to the gateway
15
+
16
+ These commands need a gateway URL (`--url` or `TOKENZERO_URL`).
17
+
18
+ ```sh
19
+ npx -y @tokenzero/cli init # audit, create a workspace, write base URLs to .env (asks first)
20
+ npx -y @tokenzero/cli usage # routed spend vs the free tier, savings
21
+ npx -y @tokenzero/cli verify <request_id> # check a receipt's Ed25519 signature locally
22
+ npx -y @tokenzero/cli rotate-key # new workspace key; rewrites it in .env
23
+ ```
24
+
25
+ **Authentication.** Send your workspace key as the `X-TokenZero-Key` header; this is the recommended form. Your provider key is sent exactly as you would send it to the provider and passes through untouched. For setups where you cannot add headers, `init` can embed the workspace key in the base URL (`<gateway>/w/<key>/v1`). Treat such URLs as secrets, and run `rotate-key` if one leaks into logs.
26
+
27
+ Node >= 18. Single file, no dependencies. Apache-2.0.
package/bin/tokenzero.mjs CHANGED
@@ -501,7 +501,7 @@ function canonical(obj) {
501
501
  }
502
502
 
503
503
  // cli/src/main.ts
504
- var VERSION = "0.1.0";
504
+ var VERSION = "0.1.1";
505
505
  var BAKED_URL = typeof __TOKENZERO_BAKED__ === "string" ? __TOKENZERO_BAKED__ : "__TOKENZERO_DEFAULT_URL__";
506
506
  function parseArgs(argv) {
507
507
  const a = { _: [], flags: {} };
package/package.json CHANGED
@@ -1,13 +1,30 @@
1
1
  {
2
2
  "name": "@tokenzero/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TokenZero CLI: connect a project to the TokenZero BYOK gateway, audit LLM token waste locally, check usage and verify signed savings receipts.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "author": "TokenZero Contributors <support@tokenzero.sh>",
8
8
  "homepage": "https://tokenzero.sh",
9
- "bin": { "tokenzero": "bin/tokenzero.mjs" },
10
- "files": ["bin/tokenzero.mjs"],
11
- "engines": { "node": ">=18" },
12
- "keywords": ["llm", "openai", "anthropic", "gemini", "cost", "finops", "prompt-caching", "mcp"]
9
+ "bin": {
10
+ "tokenzero": "bin/tokenzero.mjs"
11
+ },
12
+ "files": [
13
+ "bin/tokenzero.mjs",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "keywords": [
21
+ "llm",
22
+ "openai",
23
+ "anthropic",
24
+ "gemini",
25
+ "cost",
26
+ "finops",
27
+ "prompt-caching",
28
+ "mcp"
29
+ ]
13
30
  }