# Cost Management

> SecondStack cost management — per-user, per-team, and per-API-key LLM budgets with threshold alerts and request-level usage analytics, enforced by SecondGate.

Canonical: <https://docs.secondstack.ai/features/cost-management/>
Updated: 2026-07-07

---

Cost Management keeps consumption-based AI spend predictable. SecondStack tracks usage down to the individual request and enforces budgets at multiple levels, so overages are caught before they become invoices — the safety net that makes pay-for-what-you-use pricing workable at scale.

<p class="ss-mock-caption">Budgets roll up across the platform, per team, and per user, with a breakdown by key.</p>

## Budgets at every level

Budgets can be set and enforced for:

- **Per user** — each person's total consumption.
- **Per team** — a department or group's shared allowance, with per-member limits.
- **Per API key** — each virtual API key, so a single integration cannot drain the whole budget.

Enforcement happens in the [SecondGate gateway](/features/api-routing/) at request time. When a request would exceed **any** applicable budget, it is blocked rather than billed — the limit is a hard stop, not just a report.

## Self-service allocation

Users allocate their own budget across SecondChat, [SecondAgent](/features/ai-agent/), and any custom API keys, keeping an explicit unallocated reserve. This lets people manage their own consumption without an admin in the loop, while hard limits keep the total safe.

## Threshold alerts

Configurable threshold alerts warn before a budget is exhausted. When spend crosses a set percentage of a budget (for example, 70%), the platform notifies the user through an in-app banner, a browser notification, and email. Alerts are de-duplicated within each budget period so a single threshold does not generate repeated noise.

## Usage analytics

[ControlTower](/features/controltower/) surfaces usage analytics over the gateway's spend logs and SecondChat's request logs:

- KPI cards for total requests, total spend, latency, and error rate, with period-over-period comparison.
- Usage over time, broken down by user, team, or model.
- Top users and model mix.
- Request-level logs — model, user, token counts, duration, and status per call.

Analytics are scoped by role: administrators see the whole deployment, team supervisors see their teams, and users see their own consumption on the [User Dashboard](/features/user-dashboard/).

:::note
Budgets are currency-agnostic — the display currency is configurable and not locked to USD.
:::

## Related

- [API Routing](/features/api-routing/) — where budgets are enforced.
- [User Dashboard](/features/user-dashboard/) — personal budgets and usage.
- [ControlTower](/features/controltower/) — team budgets and analytics.
