> ## Documentation Index
> Fetch the complete documentation index at: https://docs.caged.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cost Intelligence

> AI-powered cost optimization with model swap suggestions and spend analytics

# Cost Intelligence

Cost Intelligence analyzes your LLM spend and provides actionable recommendations to reduce costs without sacrificing quality.

## Insights

The analyzer generates suggestions based on your actual usage patterns:

| Suggestion Type   | Description                                 |
| ----------------- | ------------------------------------------- |
| `model_swap`      | Switch to a cheaper model for simple tasks  |
| `caching`         | Enable prompt caching for repeated patterns |
| `token_reduction` | Reduce prompt length or context window      |
| `batching`        | Batch similar requests together             |
| `timeout`         | Add timeouts to prevent runaway sessions    |
| `budget_guard`    | Set hard budget caps per session            |

## Per-Session Analysis

Break down costs at the step level:

```bash theme={null}
curl -H "Authorization: Bearer $TOKEN" \
  https://api.caged.dev/v1/cost-intel/sessions/{session-id}
```

Returns:

* Step-by-step cost breakdown
* Model used per step
* Token counts (input/output)
* Hotspot detection (which steps cost the most)
* Optimization suggestions

## Model Comparison

Compare cost/quality across providers:

```bash theme={null}
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.caged.dev/v1/cost-intel/models?period=7d"
```

Returns metrics per model:

* Total cost
* Total tokens
* Average cost per 1K tokens
* Call count
* Suggested swaps

## Daily Trends

```bash theme={null}
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.caged.dev/v1/cost-intel/insights?period=week"
```

## Supported Models

Built-in pricing for:

* Claude Sonnet 4 ($3/$15 per MTok)
* Claude Haiku ($0.25/$1.25 per MTok)
* GPT-4o ($2.50/$10 per MTok)
* GPT-4o-mini ($0.15/$0.60 per MTok)
* Claude Opus 4 ($15/$75 per MTok)

## Dashboard

View cost analytics at `/dashboard/costs`:

* Daily spend charts
* Per-model breakdown
* Top spending sessions
* Optimization suggestions
