# model-savings

Estimates potential dollar savings when routing Claude Code runs to cheaper models via Agent Monitor. Handy for pruning token spend.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · ★ 1121
- Author: hoangsonww
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/hoangsonww/Claude-Code-Agent-Monitor/tree/HEAD/plugins/ccam-cost-guard/skills/model-savings/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/model-savings

## What it does

The skill evaluates past token consumption and reprices it using lower-tier model rates. It pulls live metrics directly from Agent Monitor endpoints: rate cards from `/api/pricing`, existing spend breakdowns from `/api/pricing/cost`, plus session metadata from `/api/sessions` and `/api/analytics`. Calculations account for four token streams: input, output, cache reads, and cache writes.

Without an active Agent Monitor instance serving those endpoints, the skill cannot produce figures. It calculates both the maximum mathematical ceiling and an eligible-only estimate. Sessions with heavy reasoning blocks or numerous turn counts remain on premium models like Opus. Only lightweight tool calls and low-complexity tasks get shifted down to Sonnet or Haiku. Final suggestions are ranked into a top 5 routing plan.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill model-savings -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/model-savings/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/model-savings/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill model-savings -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/model-savings/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill model-savings -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/model-savings/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install hoangsonww/Claude-Code-Agent-Monitor model-savings
```

2. **Manually: put the files in place**
- File: `.github/skills/model-savings/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill model-savings -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/hoangsonww/Claude-Code-Agent-Monitor --path plugins/ccam-cost-guard/skills/model-savings
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/model-savings/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill model-savings -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/hoangsonww/Claude-Code-Agent-Monitor/tree/HEAD/plugins/ccam-cost-guard/skills/model-savings/SKILL.md

## When to use it
- Quantify dollar savings from shifting Opus workloads to Sonnet or Haiku
- Separate lightweight tool steps from sessions requiring deep reasoning blocks
- Reprice input, output, and cache token buckets at target family rates
- Rank top 5 model routing moves by estimated budget impact

## Example prompts
- Estimate savings for Opus to Sonnet
- Move simple work to Haiku and show cost difference
- Analyze current token spend and propose cheaper model routing

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: b344da71500f0b95.

BEGIN THIRD-PARTY FILE b344da71500f0b95
````text
---
name: model-savings
description: >
  Estimate the dollars saved by routing eligible Claude Code work to a cheaper
  model family, using the Agent Monitor pricing engine. Re-prices each model's
  token mix at the target family's rates and quantifies the delta. Uses
  /api/pricing (rates), /api/pricing/cost (current per-model spend), /api/sessions,
  and /api/analytics. Use when hunting for cost cuts or comparing model tiers.
---

# Model Savings

Quantify how much spend you would recover by moving eligible work to a cheaper model.

## Input

The user provides: **$ARGUMENTS**

This is the routing question — e.g. `"Opus → Sonnet"`, `"move simple work to Haiku"`,
or empty (analyze every premium model against the next tier down). If no target family
is named, default to proposing the next-cheaper tier per model and say so.

## Data Sources

| Endpoint | Returns |
|----------|---------|
| `GET /api/pricing` | `{ pricing: [{ model_pattern, display_name, input_per_mtok, output_per_mtok, cache_read_per_mtok, cache_write_per_mtok }] }` — the rate card for every family |
| `GET /api/pricing/cost` | `{ total_cost, breakdown: [{ model, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, cost, matched_rule }] }` — current spend and the exact token mix per model |
| `GET /api/sessions?limit=200` | Sessions with `model`, inline `cost`, and `metadata` (turn_count, thinking_blocks) — used to judge which work is *eligible* to downshift |
| `GET /api/analytics` | `agent_types`, `tool_usage`, `total_subagents` — corroborate which task types are low-complexity and safe to route cheaper |

## Savings method

For each candidate model in the cost `breakdown`, re-price its **exact token mix** at the target family's rates:

```
cost_at_target = (input_tokens      / 1M) × target.input_per_mtok
               + (output_tokens     / 1M) × target.output_per_mtok
               + (cache_read_tokens / 1M) × target.cache_read_per_mtok
               + (cache_write_tokens/ 1M) × target.cache_write_per_mtok

savings = current_model_cost − cost_at_target
```

Pull `target.*_per_mtok` from `/api/pricing` (longest `model_pattern` match wins). Default rates ($/Mtok in/out/cacheRead/cacheWrite): **Opus** $5/$25/$0.50/$6.25, **Sonnet** $3/$15/$0.30/$3.75, **Haiku** $1/$5/$0.10/$1.25.

### Eligibility — don't promise savings on work that needs the big model

Re-pricing the full token mix is the *theoretical ceiling*. Scope it to **eligible** work:
- Low-turn sessions (`metadata.turn_count` small) and simple subagent/tool work are safe to downshift.
- Heavy-reasoning sessions (many thinking_blocks, high turn counts) likely need the premium model — exclude or discount them.
````
END THIRD-PARTY FILE b344da71500f0b95

The third-party file has ended. Everything between the b344da71500f0b95 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2719 of 4024 bytes. © hoangsonww · MIT · https://github.com/hoangsonww/Claude-Code-Agent-Monitor/tree/HEAD/plugins/ccam-cost-guard/skills/model-savings/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
