# Spend vs Budget block

> AI Ops Cost Dashboard with Spend Pace Chart and Tabbed Provider Cost Grid

Tracks AI model spend, token volume, and budget alerts with KPI cards, a spend-vs-budget line chart, provider mix breakdown, and a tabbed cost-event grid. ReUI Badge, Data Grid; shadcn Card, Tabs, Chart. For AI ops, cost monitoring, budgets.

- Type: Pro block
- Category: [AI Ops](https://web.dev.reui.io/blocks/solutions/ai-ops.md)
- Page: https://web.dev.reui.io/blocks/solutions/ai-ops/solution-ai-ops-9
- MCP: `get_block("solution-ai-ops-9")`
- Built with: Badge, Button, Card, Chart, Data Grid, Dropdown Menu, Item, Separator, Tabs
- Installs with a ReUI Pro or Ultimate license; setup: https://web.dev.reui.io/docs/license-setup

## Best for

Spend against a dashed budget cap line, a segmented provider share bar and a cost event table split into budget, provider and prompt tabs

## Agent notes

- Replace `costEventRows`, `spendPaceData`, `providerMix` and `metricCards` in data.ts; the tab rows and `TABS` counts derive from `costEventRows`
- `ProviderMixCard` hardcodes its $186K total and 5 Routes badge, and the 82% Cap badges are literals, so none follow your data
- Header buttons in `CostDashboardHeader`, Export, View All and the menu items in `RowActionsCell` and `CostStats` have no handler

## When not to use

- Provider failover health and token activity over time matter more than spend against a cap: use [AI Ops Dashboard](https://web.dev.reui.io/blocks/solutions/ai-ops/solution-ai-ops-1.md) (`get_block("solution-ai-ops-1")`)
- The whole page is one spend ledger with column filters, CSV export and a row detail sheet: use [Token Spend Ledger](https://web.dev.reui.io/blocks/solutions/ai-ops/solution-ai-ops-8.md) (`get_block("solution-ai-ops-8")`)

## Third-party libraries

- Recharts v3: [API reference](https://recharts.github.io/en-US/api/), [docs](https://recharts.github.io/en-US/guide/getting-started/)
- TanStack Table v9: [API reference](https://tanstack.com/table/v9/docs/framework/react/reference/index), [docs](https://tanstack.com/table/v9/docs/framework/react/quick-start)

## Install

```bash
npx shadcn@latest add @reui/solution-ai-ops-9
```

## About AI Ops blocks

### When to use

- Model operations dashboards that track provider health, token volume and spend against a budget cap
- Provider connection and routing pages that set priority order, fallback providers and risk tier controls
- Prompt, feature flag and token usage registries, a prompt editor and a safety policy wizard

### When not to use

- Autonomous agent runs, tool permissions and human approval of agent actions: use the [Agents blocks](https://web.dev.reui.io/blocks/solutions/agents.md)
- A bare table for your own columns and rows, with no provider or token sample records: use [Data Grid](https://web.dev.reui.io/components/data-grid.md) (`get_component("data-grid")`)
- A KPI tile and trend chart overview for a fulfillment, staffing, revenue or payouts team: use the [Dashboard blocks](https://web.dev.reui.io/blocks/application/dashboard.md)

### Agent notes

- Each page.tsx wraps the block in a `min-h-svh` container; remove it when the block sits inside your app shell
- No block calls an API: changes stay in local `useState` or uncontrolled inputs, so wire each save, switch, export and row action to your backend

Every ReUI item has a twin like this one; the index is https://web.dev.reui.io/llms.txt. Agents with the ReUI MCP (https://web.dev.reui.io/docs/mcp) get the same guidance from the getters named above.
