npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@christiangalsterer/opencode-requesty-plugin

v1.2.2

Published

opencode TUI plugin: shows Requesty.ai monthly budget, current spend, and per-model cost distribution in the session sidebar, in the session prompt and with a detail dialog via the /requesty command

Readme

GitHub Actions CI Status codecov Coveralls Known Vulnerabilities Socket Badge renovate npm downloads npm version npm license semver Conventional Commits code style: prettier github stars

opencode-requesty-plugin

An opencode TUI plugin that shows your Requesty.ai budget, current monthly spend, and per-model cost distribution right in the session prompt, in the session sidebar, plus a detail dialog via the /requesty slash command.

Features

The plugin surfaces your Requesty.ai budget and usage in three places, each optimized for the space it occupies: a compact sidebar, a full detail dialog, and a minimal prompt-area readout.

Sidebar widget

Sidebar widget

The sidebar gives a quick, at-a-glance view of your current month's Requesty usage:

  • Monthly spend and monthly limit, pulled from GET /v1/manage/apikey/self
  • A color-coded progress bar that turns yellow/red at configurable thresholds
  • Projected month-end spend at the current run rate (~$X EOM), with a pace marker: ↑ over pace, → on pace, ↓ under pace
  • Daily spend trend: today · daily average · 7-day average · 30-day average
  • Optional input/output token breakdown for each spend metric (sidebar.showTokens)
  • API key name in the header, linking to the Requesty analytics dashboard filtered by that key
  • Top models for the current month (up to sidebar.maxModels), each with spend, total tokens, and input (↑) / output (↓) breakdown; click the header to collapse or expand the list
  • Session cost for the current session: today's spend and spend since the session started (from the session's creation timestamp, falling back to a rolling 90-day window when unavailable), each with request count and token breakdown; click the header to collapse or expand (sidebar.showSessionInfo). Shows a "loading…" placeholder until the active session's data has been fetched, so it never displays an incorrect zero while loading. Revisiting a session whose figures were already loaded shows them immediately from a per-session cache.

You can disable the sidebar entirely with "sidebar": { "enabled": false }.

Prompt indicator

Prompt indicator

A compact readout on the right side of the session prompt shows:

  • Today's spend
  • Spend vs. limit with percentage and API key name, colored by the same thresholds as the sidebar
  • Optional total session spend (S $X, including sub-agents) to the left of today's spend when prompt.showSessionInfo is enabled
  • Optional month-end projection (~$X EOM ↑) when prompt.monthlyProjection is enabled

Disable the readout with "prompt": { "budgetIndicator": false }.

Detail dialog

Detail dialog

Open the dialog with /requesty from the command palette for the full breakdown:

  • KPI row: spent, limit, remaining, End of Month projection with a colored pace arrow, and last month's spend with a colored trend chevron
  • Budget Overview card: wide progress bar, budget-health badge, days-to-exhaustion estimate based on your 7-day average, and today/daily avg/7d/30d averages
  • Model Breakdown (Current Month) card: per-model table with spend, share of total spend, tokens, request count, and output/input ratio

Data comes from the Requesty Management API (apikey/self + apikey/self/usage grouped by model_used, current calendar month).

Installation

Global Installation

To install the plugin globally run the following command

opencode plugin -g @christiangalsterer/opencode-requesty-plugin

Project Installation

Global Installation

To install the plugin for the current project run the following command

opencode plugin @christiangalsterer/opencode-requesty-plugin

Configuration

To the configure the plugin add/modify the configuration in either the project .opencode/tui.json or global ~/.config/opencode/tui.json file.

{
  $schema": "https://opencode.ai/tui.json",
  "plugin": [
    [
      "@christiangalsterer/opencode-requesty-plugin",
      {
        "refreshIntervalMs": 300000,
        "warningThreshold": 0.6,
        "errorThreshold": 0.85,
        "sidebar": {
          "enabled": true,
          "maxModels": 5,
          "showTokens": true,
          "order": 50
        }
      }
    ]
  ]
}

Restart opencode after changing the config — plugins are loaded at startup.

Local development install

Point at a local checkout instead:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": [
    [
      "file:///absolute/path/to/opencode-requesty-plugin/dist/tui.tsx",
      {
        "sidebar": { "showKeyName": true },
        "prompt": { "showKeyName": true },
        "dialog": { "showKeyName": true }
      }
    ]
  ]
}

Run bun install && bun run build in the checkout first.

Update

To update the plugin please run the following command.

opencode plugin -f @christiangalsterer/opencode-requesty-plugin

OpenCode does not currently support plugin updates reliably. See OpenCode PRs #35777, #32822, and #37300. To force OpenCode to download the configured plugin versions, clear its plugin cache:

rm -rf ~/.cache/opencode/packages/@christiangalsterer/opencode-requesty-plugin*

API key detection

The plugin reads your Requesty API key from the opencode provider config: provider.requesty.options.apiKey in opencode.json, including {env:VAR} interpolation.

{
  "provider": {
    "requesty": {
      "options": { "apiKey": "sk-..." }
    }
  }
}

Or via an environment variable:

{
  "provider": {
    "requesty": {
      "options": { "apiKey": "{env:REQUESTY_API_KEY}" }
    }
  }
}

If no key is found, the widget shows a short setup hint instead of failing.

Configuration

Configuration options

| Option | Type | Default | Description | | ------ | ---- | ------- | ----------- | | refreshIntervalMs | number | 300000 (5 min) | Periodic refresh interval (safety net) | | warningThreshold | number | 0.7 (70%) | Budget usage ratio at which the bar turns yellow (accepts 0–1 or 0–100) | | errorThreshold | number | 0.9 (90%) | Budget usage ratio at which the bar turns red (accepts 0–1 or 0–100) | | sidebar.enabled | boolean | true | Show the sidebar widget | | sidebar.maxModels | number | 5 | Number of models shown in the compact sidebar list | | sidebar.showTokens | boolean | true | Show input/output token breakdown alongside spend in the sidebar averages block | | sidebar.showKeyName | boolean | false | Show the API key nickname in the sidebar header | | sidebar.showSessionInfo | boolean | true | Show the per-session cost collapsible section (today + since session start) | | sidebar.order | number | 50 | Slot order for the sidebar widget; lower numbers appear first | | prompt.enabled | boolean | true | Show the prompt widget | | prompt.budgetIndicator | boolean | true | Show spend/limit readout on the right side of the session prompt | | prompt.todaySpend | boolean | true | Show today's spend (T $X) in the session prompt averages block | | prompt.dailyAvg | boolean | false | Show the current month's daily average (D $X) in the prompt averages block | | prompt."7dAvg" | boolean | false | Show the 7-day average (7d $X) in the prompt averages block | | prompt."30dAvg" | boolean | false | Show the 30-day average (30d $X) in the prompt averages block | | prompt.showTokens | boolean | true | Show today's input/output token breakdown (↑X↓Y) next to today's spend in the session prompt | | prompt.showKeyName | boolean | false | Show the API key nickname in the session prompt readout | | prompt.showSessionInfo | boolean | true | Show total session spend (S $X, incl. sub-agents) left of today's spend in the prompt averages block | | prompt.monthlyProjection| boolean | true | Show a month-end projection (~$X EOM ↑) in the session prompt, red when the estimated spend exceeds the budget | | prompt.order | number | 50 | Slot order for the prompt indicator; lower numbers appear first | | dialog.showKeyName | boolean | false | Show the API key nickname in the detail dialog title |

warningThreshold must be lower than errorThreshold; if the ordering is invalid, both fall back to the defaults (70%/90%). Values above 1 are treated as percents, e.g. 80 means 80%.

Using Requesty with multiple API keys

If you utilize different API keys for various projects, it is highly recommended to enable showKeyName in your configuration. This allows you to easily identify which Requesty API key is currently active in the sidebar, session prompt, and detail dialog.

Example for enabling key identification:

{
  "sidebar": { "showKeyName": true },
  "prompt": { "showKeyName": true },
  "dialog": { "showKeyName": true }
}

Complete configuration example

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": [
    [
      "@christiangalsterer/opencode-requesty-plugin",
      {
        "refreshIntervalMs": 300000,
        "warningThreshold": 0.7,
        "errorThreshold": 0.9,
        "sidebar": {
          "enabled": true,
          "maxModels": 5,
          "showTokens": true,
          "showKeyName": true,
          "order": 50
        },
        "prompt": {
          "enabled": true,
          "budgetIndicator": true,
          "todaySpend": true,
          "dailyAvg": false,
          "7dAvg": false,
          "30dAvg": false,
          "showTokens": true,
          "showKeyName": true,
          "showSessionInfo": true,
          "monthlyProjection": true,
          "order": 50
        },
        "dialog": {
          "showKeyName": true
        }
      }
    ]
  ]
}

Data is refreshed on startup, on a configurable periodic interval, when a new session is created, and when messages are updated.

Metrics

All amounts are in USD and dates are evaluated in UTC.

  • Today — spend and tokens for the current calendar day.
  • Daily avg — current month's total spend and tokens divided by the number of days elapsed so far this month.
  • 7d avg — average spend and tokens over the previous 7 completed calendar days (excluding today). Days without usage count as $0 / 0 tokens. Uses a rolling window to ensure accuracy across month boundaries.
  • 30d avg — average spend and tokens over the previous 30 completed calendar days (excluding today). Days without usage count as $0 / 0 tokens. Uses a rolling window to ensure accuracy across month boundaries.
  • End of Month projection — current spend projected forward at the current daily run rate through the end of the month.
  • Session cost — spend, request count, and tokens for the currently active opencode session: Today and Since . The window starts at the session's creation timestamp; if that is unavailable it falls back to the last 90 days. Attribution uses Requesty's extra.X-Session-Affinity metadata, so values are exact per session (not estimates). While a session's data is still loading the section shows a "…" placeholder rather than a misleading zero; a previously-loaded session is served from a per-session cache so its figures appear immediately on revisit.

Requirements

Development

bun install
bun run format:fix
bun run typecheck
bun run test
bun run build

The project is fully typed TypeScript (strict mode). Sources live in src/ (.ts/.tsx), tests in test/. The opencode host transforms TSX at load time via @opentui/solid/preload (Bun); no bundler is used.

License

MIT