@agentoom/pi-spending-guard
Track LLM spending per task and pause when a configurable threshold is reached — continue, refine the prompt, or stop. Pi extension by agentoom.com.
Package details
Install @agentoom/pi-spending-guard from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@agentoom/pi-spending-guard- Package
@agentoom/pi-spending-guard- Version
1.0.2- Published
- Jul 24, 2026
- Downloads
- 51/mo · 51/wk
- Author
- agentoom
- License
- MIT
- Types
- extension
- Size
- 16.1 KB
- Dependencies
- 0 dependencies · 5 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@agentoom/pi-spending-guard
Track LLM spending per task and pause when a configurable threshold is reached for pi by agentoom.com.
When your spending limit is hit, spending-guard pauses the task and asks you to choose: continue (double the limit or reset the counter), refine the prompt, or stop entirely — so you never lose control of your API costs.
Install
pi install npm:@agentoom/pi-spending-guard
Quick start
Out of the box, spending-guard is enabled with a $3.00 default limit. Start pi and spend away — it'll pause automatically at $3.00.
Usage
Commands
| Command | Description |
|---|---|
/spending |
Show current spending, limit, and enabled state |
/spending limit [amount] |
Set or view the spending limit (e.g. /spending limit 5) |
/spending toggle [on|off] |
Enable/disable tracking; no argument toggles |
/spending-limit [amount] |
Shortcut: set or view the limit |
/spending-toggle [on|off] |
Shortcut: enable/disable |
/spending-status |
Shortcut: show current status |
Threshold dialog
When accumulated cost reaches the configured limit, spending-guard pauses and presents a 4-option dialog:
| Option | Behaviour |
|---|---|
| Continue (double the limit) | Raises the cap to 2× the current limit and keeps going |
| Continue (reset counter) | Keeps the same limit, resets accumulated cost to $0.00 |
| Refine the prompt | Opens an input field so you can write a more focused prompt |
| Stop the task | Gracefully shuts down pi |
Cost display
While tracking is enabled, current spending is shown live in the footer status bar:
💵 $1.23 / $3.00
Configuration
Spending-guard reads from these files (project takes priority):
.pi/spending-guard.json— project-local~/.pi/agent/spending-guard.json— global
If neither file exists, it defaults to enabled with a $3.00 limit.
Config format
{
"enabled": true,
"limit": 5.00
}
| Key | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
true |
Whether tracking starts active |
limit |
number |
3.00 |
Spending threshold in USD |
Per-project vs global
- Place the extension globally to track spending across all projects:
pi install npm:@agentoom/pi-spending-guard - Place a
.pi/spending-guard.jsonin a specific project to override the default for that project only.
Development
spending/
├── package.json
├── index.ts # Extension entry point
├── .gitignore
└── README.md
Run against a local path:
pi install ./spending