# CostLedger

Where the money went, run by run, with measured and estimated costs kept apart and never added together.

- **Use it for**: Cost per run or step over a period, with measured and estimated amounts kept apart.
- **Not for**: One number for the current request. Try [UsageMeter](https://unseenui.com/components/usage-meter/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { CostLedger } from '@stackunseen/ui/conversation-flow';
import '@stackunseen/ui/styles.css';
import '@stackunseen/ui/conversation-flow.css';

<CostLedger variant="table" rows={rows} period="Today" onOpen={openRun} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `label` | `string` |  |
| `locale` | `string` |  |
| `onOpen` | `((row: CostLedgerRow) => void)` |  |
| `period` | `string` | The period or scope the rows cover, such as "Today" or "This run". |
| `rows` (required) | `readonly CostLedgerRow[]` |  |
| `total` | `Measurement<Money>` | The host's own total, when it has one from billing. |
| `variant` | `"table" \| "compact"` |  |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[RunBoard](https://unseenui.com/components/run-board/), [AgentLanes](https://unseenui.com/components/agent-lanes/), [SubagentTree](https://unseenui.com/components/subagent-tree/), [ExecutionTimeline](https://unseenui.com/components/execution-timeline/), [WorkflowGraph](https://unseenui.com/components/workflow-graph/), [AttentionQueue](https://unseenui.com/components/attention-queue/), [RunCompare](https://unseenui.com/components/run-compare/), [ContextBar](https://unseenui.com/components/context-bar/), [Plan](https://unseenui.com/components/plan/), [AgentSteering](https://unseenui.com/components/agent-steering/), [ContextWindowMeter](https://unseenui.com/components/context-window-meter/), [MemoryPanel](https://unseenui.com/components/memory-panel/)

Page: https://unseenui.com/components/cost-ledger/
