{"_id":"@1930dev/opencode-usage","_rev":"7-571691ae28e176720d79bc13663f089f","name":"@1930dev/opencode-usage","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@1930dev/opencode-usage","version":"0.1.0","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","_id":"@1930dev/opencode-usage@0.1.0","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"homepage":"https://github.com/agurod42/opencode-usage#readme","bugs":{"url":"https://github.com/agurod42/opencode-usage/issues"},"bin":{"opencode-usage":"dist/cli.js"},"dist":{"shasum":"c59cbcab372393c4f385f493084587972502d10e","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.1.0.tgz","fileCount":4,"integrity":"sha512-cBlyoyxTN9IDZ7pI+SF2HJputGrlPKVucvU951Mm1OEo4oAdy2KQ5CRgrc/TpaYZu2ZVU44dRWzE+MXl+U+Jtw==","signatures":[{"sig":"MEUCIQDFyGKBhFeS9d2AFQlTvb9W4sSBtiC9pmqMBaUyxZAg0AIgbqiChnfg87oMi0sqkfbsNgBjIKEG5j5/of8/jIUhsSI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":63428},"type":"module","exports":{"./tui":{"import":"./dist/tui.js"}},"gitHead":"e69da258b89955c2975efbf482a7b473025f8a30","scripts":{"test":"bun test","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun test && tsc --noEmit"},"_npmUser":{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"},"repository":{"url":"git+https://github.com/agurod42/opencode-usage.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"10.8.2","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@opencode-ai/plugin":"^1.18.26"},"peerDependencies":{"@opentui/core":">=0.5","@opentui/solid":">=0.5","@opencode-ai/plugin":">=1.18"},"_npmOperationalInternal":{"tmp":"tmp/opencode-usage_0.1.0_1788706142500_0.6329763176508256","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@1930dev/opencode-usage","version":"0.1.1","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","_id":"@1930dev/opencode-usage@0.1.1","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"homepage":"https://github.com/agurod42/opencode-usage#readme","bugs":{"url":"https://github.com/agurod42/opencode-usage/issues"},"bin":{"opencode-usage":"dist/cli.js"},"dist":{"shasum":"57bd33c5920df267444c7133c3daa2a95a525495","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.1.1.tgz","fileCount":4,"integrity":"sha512-9p3LMojJag1RWu58nFVzbsbsHg6rUaSLc+79q2qgvJBh11Fxan0EPboRyx+e+Dd1ymWUT27Qel++OIsefME+jQ==","signatures":[{"sig":"MEQCIDz0f35Zsrnyk0wQ/QuR5EqWw0ss9mR4NA4oicCFpZ9DAiAa9AEYNlk6yGBYhcHZuZ4lKY+Kw5gdOsPnCw8ZmkJKKw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":63602},"type":"module","exports":{"./tui":{"import":"./dist/tui.js"}},"gitHead":"1cebc9bd78ee844aba0896a18e00e3c1fccd453d","scripts":{"test":"bun test","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun test && tsc --noEmit"},"_npmUser":{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"},"repository":{"url":"git+https://github.com/agurod42/opencode-usage.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"10.8.2","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@opencode-ai/plugin":"^1.18.26"},"peerDependencies":{"@opentui/core":">=0.5","@opentui/solid":">=0.5","@opencode-ai/plugin":">=1.18"},"_npmOperationalInternal":{"tmp":"tmp/opencode-usage_0.1.1_1788706794318_0.48813193630847573","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@1930dev/opencode-usage","version":"0.1.2","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","_id":"@1930dev/opencode-usage@0.1.2","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"homepage":"https://github.com/agurod42/opencode-usage#readme","bugs":{"url":"https://github.com/agurod42/opencode-usage/issues"},"bin":{"opencode-usage":"dist/cli.js"},"dist":{"shasum":"f0448c54b61828c8fb27a295970994f10417db71","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.1.2.tgz","fileCount":4,"integrity":"sha512-qJ59ng9WCNi57WgnZkv9wilIaQN1+Kv0/EJ9iM6a8oDevCVGQdqVg/Ul2zpqousgvJalTutyLX4hHdnXEFdUAQ==","signatures":[{"sig":"MEQCIGzoEo6dOhfJXVyXI0n057zutUu3Y4ErnC1vadt+P0q4AiBsSdjEEuEMagvw+FClxxMgrM4NCj5igYEPpxR9bFH7Dw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64202},"type":"module","exports":{"./tui":{"import":"./dist/tui.js"}},"gitHead":"9f23eca22a1b7bf3d1f22292f07670310d09fa63","scripts":{"test":"bun test","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun test && tsc --noEmit"},"_npmUser":{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"},"repository":{"url":"git+https://github.com/agurod42/opencode-usage.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"10.8.2","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@opencode-ai/plugin":"^1.18.26"},"peerDependencies":{"@opentui/core":">=0.5","@opentui/solid":">=0.5","@opencode-ai/plugin":">=1.18"},"_npmOperationalInternal":{"tmp":"tmp/opencode-usage_0.1.2_1788707028258_0.06314251520638914","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@1930dev/opencode-usage","version":"0.1.3","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","_id":"@1930dev/opencode-usage@0.1.3","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"homepage":"https://github.com/1930-dev/opencode-usage#readme","bugs":{"url":"https://github.com/1930-dev/opencode-usage/issues"},"bin":{"opencode-usage":"dist/cli.js"},"dist":{"shasum":"ef151d7a318ea05a821d9ead09f6bb5807e9ad4f","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.1.3.tgz","fileCount":4,"integrity":"sha512-+UbTnzv57iK60RJ6EiRVvxKrUdL14YGzB4vD32WXBGBa0aWW/m058KIwt64sU5LUd5f3cMIOeXAz2HCrrAFhlQ==","signatures":[{"sig":"MEUCIQCb1CAUB9Go2eJAX+MPDToFa7B2Nf1nuXGDz4dzK0+xdAIgOwYL0sy8xSqlcywXhRSUsO0QWo+rQAd/9wT43NuZAdo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64349},"type":"module","exports":{"./tui":{"import":"./dist/tui.js"}},"gitHead":"c85d45023b24a683b46f21e9552a96b801921e92","scripts":{"test":"bun test","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun test && tsc --noEmit"},"_npmUser":{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"},"repository":{"url":"git+https://github.com/1930-dev/opencode-usage.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"10.8.2","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@opencode-ai/plugin":"^1.18.26"},"peerDependencies":{"@opentui/core":">=0.5","@opentui/solid":">=0.5","@opencode-ai/plugin":">=1.18"},"_npmOperationalInternal":{"tmp":"tmp/opencode-usage_0.1.3_1788707497741_0.35360170058983553","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@1930dev/opencode-usage","version":"0.1.4","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","_id":"@1930dev/opencode-usage@0.1.4","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"homepage":"https://github.com/1930-dev/opencode-usage#readme","bugs":{"url":"https://github.com/1930-dev/opencode-usage/issues"},"bin":{"opencode-usage":"dist/cli.js"},"dist":{"shasum":"9ce9acf37bccc03ee9c393424d70ef1ba99a169a","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.1.4.tgz","fileCount":4,"integrity":"sha512-H9zM0cZxgfUFNYnSojOLfMz0kAZHIAyp7qr2VonJcDodb36J5MFmv2OGdChgxknzPROUJ5FOPDSSjLzyQ1yIqQ==","signatures":[{"sig":"MEUCIGKeAmRkcHbx26fU5d+88i8lAaQ59tPA07X/WDXYtsUNAiEAioNwYbZ1ItknhEPVQYJ3K16WY0ZXNfVsHoIaWxZ/KPE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@1930dev%2fopencode-usage@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":64314},"type":"module","exports":{"./tui":{"import":"./dist/tui.js"}},"gitHead":"8a154d43aa57d717765eef06b3df9b324505f601","scripts":{"test":"bun test","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun test && tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:05d1fb2d-1368-4006-b8e4-eec0a9733f39"}},"repository":{"url":"git+https://github.com/1930-dev/opencode-usage.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"12.0.2","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","directories":{},"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@opencode-ai/plugin":"^1.18.26"},"peerDependencies":{"@opentui/core":">=0.5","@opentui/solid":">=0.5","@opencode-ai/plugin":">=1.18"},"_npmOperationalInternal":{"tmp":"tmp/opencode-usage_0.1.4_1788708118515_0.36933763500768535","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@1930dev/opencode-usage","version":"0.1.5","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","_id":"@1930dev/opencode-usage@0.1.5","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"homepage":"https://github.com/1930-dev/opencode-usage#readme","bugs":{"url":"https://github.com/1930-dev/opencode-usage/issues"},"bin":{"opencode-usage":"dist/cli.js"},"dist":{"shasum":"3cc32b4ec1e297dcda050631a45c97a3104b49bc","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.1.5.tgz","fileCount":5,"integrity":"sha512-1WcxVoQnZdKMmAIaO1U1/MPHiRHyqRdJc1DJPReNKzSRWwn90W0ti3i4S6gHixMjw6swW6u9ReWgw7nkWPA18w==","signatures":[{"sig":"MEQCIAsJzx1qBs8KTL13pm6gjjrkmgUal66ohr/GyrmI69vmAiBnf1/KN/tGv50bC7NGAO32u01oezE2b7V8habY/Y/JIQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@1930dev%2fopencode-usage@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":67071},"type":"module","exports":{"./tui":{"import":"./dist/tui.js"}},"gitHead":"9941c766b663b8daf668bdf1c658c9d94c3af569","scripts":{"test":"bun test","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","typecheck":"tsc --noEmit","prepublishOnly":"bun run build && bun test && tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:05d1fb2d-1368-4006-b8e4-eec0a9733f39"}},"repository":{"url":"git+https://github.com/1930-dev/opencode-usage.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"12.0.2","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","directories":{},"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@opencode-ai/plugin":"^1.18.26"},"peerDependencies":{"@opentui/core":">=0.5","@opentui/solid":">=0.5","@opencode-ai/plugin":">=1.18"},"_npmOperationalInternal":{"tmp":"tmp/opencode-usage_0.1.5_1788708894309_0.8117453664655843","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@1930dev/opencode-usage","version":"0.2.0","description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","type":"module","bin":{"opencode-usage":"dist/cli.js"},"scripts":{"test":"bun test","typecheck":"tsc --noEmit","build":"bun scripts/build.ts","preview":"bun run build && bun packages/plugin/preview.ts","prepublishOnly":"bun run build && bun test --coverage && tsc --noEmit","coverage":"bun test --coverage"},"repository":{"type":"git","url":"git+https://github.com/1930-dev/opencode-usage.git"},"keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","devDependencies":{"@opencode-ai/plugin":"^1.18.26","@opentui/core":"0.5.10","@opentui/solid":"^0.5.10","@types/bun":"latest"},"workspaces":["packages/*"],"exports":{"./tui":{"import":"./dist/tui.js"}},"publishConfig":{"access":"public"},"peerDependencies":{"@opencode-ai/plugin":">=1.18","@opentui/core":">=0.5","@opentui/solid":">=0.5"},"bugs":{"url":"https://github.com/1930-dev/opencode-usage/issues"},"homepage":"https://github.com/1930-dev/opencode-usage#readme","gitHead":"ce969d80f0822186c0fb4e20f3817e1059a3fa4b","_id":"@1930dev/opencode-usage@0.2.0","_nodeVersion":"22.23.2","_npmVersion":"12.0.2","dist":{"integrity":"sha512-U8DnCihg1A8acM8+Gd595RfrBn0kVH3LwDBUvgbHHEt0weerFYBgGNXEKGou90hcEKNC1CGOrGiZiVzX+UZ6dg==","shasum":"86bae5bc7411c1211d68cc9bb877ccc146ad1581","tarball":"https://registry.npmjs.org/@1930dev/opencode-usage/-/opencode-usage-0.2.0.tgz","fileCount":5,"unpackedSize":68603,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@1930dev%2fopencode-usage@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDRYlabQfbJdxpVsojaxrP0FawfMck5ioe9UjplhoT0vAIgWvdrIBTmgj2dLxnKzxDVkoJ0tAbeTqvp3mV8X4D18LU="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:05d1fb2d-1368-4006-b8e4-eec0a9733f39"}},"directories":{},"maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-usage_0.2.0_1788716285576_0.620557062129476"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-06T14:49:02.263Z","modified":"2026-09-06T17:38:06.046Z","0.1.0":"2026-09-06T14:49:02.656Z","0.1.1":"2026-09-06T14:59:54.446Z","0.1.2":"2026-09-06T15:03:48.399Z","0.1.3":"2026-09-06T15:11:37.893Z","0.1.4":"2026-09-06T15:21:58.653Z","0.1.5":"2026-09-06T15:34:54.521Z","0.2.0":"2026-09-06T17:38:05.710Z"},"bugs":{"url":"https://github.com/1930-dev/opencode-usage/issues"},"author":{"name":"Agu Rodríguez","email":"me@agu.uy"},"license":"MIT","homepage":"https://github.com/1930-dev/opencode-usage#readme","keywords":["opencode","opencode-plugin","usage","cost","budget","quota","tokens","llm"],"repository":{"type":"git","url":"git+https://github.com/1930-dev/opencode-usage.git"},"description":"Usage tracking, budget percentages and model ranking for opencode — CLI plus a /usage TUI plugin","maintainers":[{"name":"the-wise-monkey","email":"agu@thewisemonkey.co.uk"}],"readme":"# opencode-usage\n\nUsage tracking, budget percentages and model ranking for [opencode](https://opencode.ai):\na CLI, and a `/usage` slash command for the TUI.\n\nEvery connected provider in one table, with each one's remaining budget as a\ncomparable percentage — whether the provider bills in tokens, requests, credits or\nneurons.\n\n<!-- Absolute URL so the image also renders on npm, which resolves nothing relative.\n     It also means updating the file on main updates both, with no republish. -->\n![The /usage dialog](https://raw.githubusercontent.com/1930-dev/opencode-usage/main/docs/demo.gif)\n\n[![npm](https://img.shields.io/npm/v/@1930dev/opencode-usage)](https://www.npmjs.com/package/@1930dev/opencode-usage)\n[![license](https://img.shields.io/npm/l/@1930dev/opencode-usage)](./LICENSE)\n\n## Why\n\nopencode talks to many providers at once, and each one meters differently: a weekly\nwindow here, premium requests there, credits, neurons, tokens per day. Nothing tells\nyou which one you are about to exhaust.\n\nThis reads opencode's own SQLite and auth store — no configuration, no account — and\nnormalizes every quota into one percentage, so the answer to \"which provider still has\nroom\" is one glance.\n\n## Install\n\n```bash\nnpm install -g @1930dev/opencode-usage   # the opencode-usage CLI\n```\n\nRequires [Bun](https://bun.sh): the CLI reads opencode's SQLite through `bun:sqlite`.\n\n## Usage\n\n```bash\n# Local usage from opencode's SQLite (all providers, all projects)\nopencode-usage usage                    # last 7 days, grouped by provider\n\n# Window\nopencode-usage usage --today            # today only\nopencode-usage usage --since 30d        # last 30 days\n\n# Grouping\nopencode-usage usage --by agent         # by agent (build/plan/etc)\nopencode-usage usage --by day           # by day\nopencode-usage usage --by model         # by model\nopencode-usage usage --by project       # by project directory\nopencode-usage usage --by provider      # the default; lists every connected\n                                        # provider, idle ones included\n\n# Output\nopencode-usage usage --json             # machine-readable\nopencode-usage usage --pct              # add the % BUDGET column (--by provider only)\n\n# Connected providers + live quota\nopencode-usage providers\nopencode-usage providers --no-net       # cached only\n\n# Model ranking by intelligence per blended dollar\nopencode-usage top\nopencode-usage top --limit 10 --json\n```\n\n## Plugin for opencode\n\nThe package also ships a `/usage` slash command for the opencode TUI. It shows the\nsame table as the CLI, with the % budget column drawn as a progress bar:\n\n```\n Usage — today                                                                      esc\n\n PROVIDER               MSGS   TOK IN  TOK OUT      COST BUDGET\n opencode-go               7        0        0     $0.00 ████████████ 100% weekly\n nvidia                   98    10.9M    19.9K     $0.00\n cloudflare-workers-ai     0        0        0     $0.00\n github-copilot            1     4.2K      830    $12.35 █████░░░░░░░  42% 1M tok/day\n\n TOTAL                   106                      $12.35\n```\n\nThe dialog sizes itself to the terminal: a wide frame spells the budget labels out,\na narrow one shortens them to the window (`wk`, `mo`, `d`).\n\n```bash\nopencode plugin @1930dev/opencode-usage\n```\n\nThat installs the package and writes it into `~/.config/opencode/tui.json`. To do it\nby hand:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/tui.json\",\n  \"plugin\": [\"@1930dev/opencode-usage\"]\n}\n```\n\nTUI plugins go in `tui.json`, not in `opencode.json` and not in\n`~/.config/opencode/plugins/`. Both of those are loaded as *server* plugins, and\nopencode rejects a TUI-only module there with\n`must default export an object with server()`.\n\nTo run it from a clone instead, build first and point `tui.json` at the bundle:\n\n```bash\nbun install && bun run build\n```\n\n```json\n{ \"plugin\": [\"/absolute/path/to/opencode-usage/dist/tui.js\"] }\n```\n\nRestart opencode after a rebuild: the bundle is read once at start.\n\n## % BUDGET (`--pct`)\n\nNormalized percentage of budget consumed per provider, from these sources (in priority):\n\n1. **Live quota** — provider-reported usage:\n   - `github-copilot`: premium requests entitlement (7000/mo)\n   - `opencode-go` (Zen): rolling 5h / weekly / monthly % (binding window)\n   - `openrouter`: credits used / total credits\n   - `zai`: coding plan quota\n\n2. **Documented limits** — published quotas, used when the provider reports none.\n   Each one is read against the period it resets on: a daily limit against today,\n   a monthly one against the calendar month. The window you asked for (`--since`)\n   sizes the table and never the budget.\n   - `cerebras`: 1M tokens/day (free tier)\n   - `digitalocean`: 5M tokens/day (paid)\n   - `google`: 1500 requests/day (free tier)\n   - `groq`: 200k tokens/day (free tier)\n\n   These are documented but not measurable, and show `—`. opencode's database\n   records tokens and requests; a credit and a neuron are the provider's own\n   unit, derived from the model and the request by a rule it does not record.\n   Give them a line in `budgets.json` to get a percentage in USD instead.\n   - `cloudflare-workers-ai`: 100k neurons/day (free tier)\n   - `nvidia`: 1000 credits/month (free tier)\n   - `orcarouter`: undocumented\n   - `snowflake-cortex`: 100 credits/month (paid)\n\n3. **budgets.json** — your monthly USD per provider, read against what the\n   provider cost so far this calendar month:\n   ```json\n   {\n     \"digitalocean\": 5,\n     \"nvidia\": 1\n   }\n   ```\n   Place at `~/.config/opencode-usage/budgets.json`.\n\nProviders without any source show `—`.\n\n## Ranking (`top`)\n\nModels ranked by intelligence index per blended dollar:\n```\nMODEL                    NAME                IQ     CODING   $/M       IQ/$\nglm-5.3-flash            GLM 5.3-Flash       58     72       $0.11     534.9\n...\n```\n\nIntelligence indices from [Artificial Analysis](https://artificialanalysis.ai), pricing\nfrom [models.dev](https://models.dev).\n\n`top` needs an `AA_API_KEY` for the indices. This package ships neither a key nor a copy\nof the data: the free Data API tier is \"internal use only; no redistribution\", and\nattribution is required on every tier — which is why the credit is printed under the\ntable and carried in `--json`.\n\n## Requirements\n\n- [Bun](https://bun.sh) >= 1.0 — the CLI reads opencode's SQLite through `bun:sqlite`\n- [opencode](https://opencode.ai) with existing sessions, at\n  `~/.local/share/opencode/opencode.db`\n- For live quota: provider credentials already configured in opencode, at\n  `~/.local/share/opencode/auth.json`\n\n## Configuration\n\n- `AA_API_KEY` — Artificial Analysis key, used by `top` for the intelligence indices.\n  Optional: without it `top` still prints prices, only without `IQ` and `IQ/$`.\n  A free key is at [artificialanalysis.ai/data-api](https://artificialanalysis.ai/data-api)\n- `OPENCODE_AUTH_PATH` — override the path to opencode's `auth.json`\n- `OPENCODE_DB_PATH` — override the path to opencode's database\n- `OPENCODE_USAGE_BUDGETS` — override the path to `budgets.json`\n- `OPENCODE_USAGE_CACHE` — cache directory (default `~/.cache/opencode-usage`)\n\n## Development\n\n```bash\nbun install          # install workspace deps\nbun run build        # write dist/tui.js and dist/cli.js\nbun run preview      # render the /usage dialog headless, at several widths\nbun test             # run tests\nbun run coverage     # run tests with the coverage gate\nbunx tsc --noEmit    # typecheck\n```\n\nEvery line of every source file is covered, and `bunfig.toml` fails the run if\nthat stops being true. `packages/cli/src/cli.ts` holds no logic for that reason:\nthe commands live in `main.ts`, which a test drives directly.\n\nThe workspace is a Bun monorepo. The packages are listed by dependency order,\nsince `cli` and `plugin` both build on `core`:\n\n- `@opencode-usage/core` — shared data layer (SQLite, quotas, matching, ranking)\n- `@opencode-usage/cli` — the `opencode-usage` binary\n- `@opencode-usage/plugin` — the opencode TUI plugin\n\nOnly the root package is published; `core` is inlined into both bundles.\n\n## License\n\nMIT","readmeFilename":"README.md"}