← Catalog

@luxass/pi-cost-explorer

Explore a Pi session's cost by model, prompt, tool, and request in a tabbed dialog.

Extension

Install

Install with PiG

pig install npm:@luxass/pi-cost-explorer

Install with Pi

pi install npm:@luxass/pi-cost-explorer
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "image": "https://raw.githubusercontent.com/luxass/agent-extensions/main/packages/pi-cost-explorer/docs/cover.png",
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.0 (README.md). PiG does not review it.

@luxass/pi-cost-explorer

See where a Pi session spent its money. The cost explorer breaks the session down by model, prompt, tool, and request in a tabbed dialog.

Install

pi install npm:@luxass/pi-cost-explorer

To try the extension from this checkout:

pi -e ./packages/pi-cost-explorer

Use

Run /cost in Pi's terminal interface. The dialog has five tabs:

  • Overview shows the total cost, token counts, and the cost split between input, output, cache reads, and cache writes. It also shows the cache hit rate, averages, a cost-over-time sparkline, cost by source, and the most expensive model, prompt, and tool.
  • Models shows requests, tokens, cache hit rate, and cost for each provider and model.
  • Turns lists each prompt you sent with the cost of everything it caused. Press Enter to see the prompt's breakdown and each usage record.
  • Tools shows calls, errors, run time, and cost for each tool.
  • Requests lists every priced event in time order. Press Enter to see its full token and cost breakdown.

The totals use the same sources as Pi's /session command: model responses, usage that tools report for their own model calls, background usage such as cache warming, and compaction and branch summaries.

If you use @luxass/pi-subagents, the totals also include what its agents cost, as the source "Agents". Each agent run is one row, with its own model. Pi's /session command and the cost in Pi's footer do not include agents, so the total here is higher than theirs by that amount. The Overview says how much went to agents.

A Pi session branches when you go back to an earlier message and continue from there. These session branches are not Git branches. By default the dialog covers every session branch, and rows from other branches are dimmed. Press b to show only the current branch. While the dialog is open, it refreshes after each turn.

ControlsAction
Left, Right, Tab, Shift+TabSwitch tabs.
1–5Jump to a tab.
Up, Down, Page Up, Page DownMove the selection or scroll.
Home, EndGo to the first or last row.
EnterOpen the selected prompt or request.
EscGo back from a detail screen, or close.
sSwitch between the two sort orders of a list.
bSwitch between all session branches and the current one.
rRefresh.
qClose.
Click or mouse wheelSwitch tabs, select or open rows, or scroll.

Mouse input works in fullscreen mode only.

Limits

  • Costs come from the prices in Pi's model configuration. If a model has no price, its requests show $0 and the Overview shows a warning.
  • The ≈ Calling column in Tools is an estimate. One request can call several tools, so it splits the request's cost evenly between them. The Nested column is exact: it is usage that a tool reports for its own model calls, for example subagents.