cost-verification-auditor — скилл для Claude Code
Скилл cost-verification-auditor для Claude Code сверяет оценку стоимости токенов с фактическими расходами по API. Запускается для поиска причины расхождения прогноза и счёта.
MIT 175 установок ★ 274 обновлён 2026-10-30
npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a claude-codeЧто делает cost-verification-auditor
Скилл проверяет, укладывается ли разница между оценкой и фактическим расходом в ±20% — отдельно по входным токенам, по выходным и по итоговой стоимости. Формула простая: (actual - estimated) / estimated.
Внутри — набор правил калибровки и дерево решений. Скилл знает типичные ловушки: например, добавление 500 токенов накладных расходов при прямом вызове API, где реальные издержки около 10 токенов. Коэффициент символов на токен зависит от типа текста: для английской прозы это 4.0, для кода — 3.0–3.5, для JSON — 3.0. Разрешённые инструменты — Read, Write, Bash.
Скилл не заменяет таблицы цен и не строит бюджеты — он только аудирует точность существующего эстиматора. Если оценок ещё нет, сначала нужно их построить: скилл прямо указывает, что оценка должна делаться до вызова API, иначе результат окажется подогнанным и бесполезным на новых промптах.
Какие задачи решает
- проверить, укладывается ли эстиматор токенов в допуск ±20%
- найти причину неожиданно высокого счёта от API
- отладить систему оценки стоимости после её реализации
- выявить дрейф расчётов при периодическом аудите
- откалибровать коэффициенты символов на токен под конкретный тип текста
Примеры запросов агенту
- Запусти аудит точности оценки токенов для последних трёх вызовов API
- Проверь расхождение между расчётной и фактической стоимостью — подозреваю, что коэффициент накладных расходов завышен
- Выполни
cost verificationпо логам изlogging-observabilityза эту неделю
Как установить cost-verification-auditor
1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a claude-code2Вручную: положить файлы
~/.claude/skills/cost-verification-auditor/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/cost-verification-auditor/
1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a codex2Вручную: положить файлы
.agents/skills/cost-verification-auditor/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a cursor2Вручную: положить файлы
.cursor/skills/cost-verification-auditor/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install curiositech/some_claude_skills .claude/skills/cost-verification-auditor2Вручную: положить файлы
.github/skills/cost-verification-auditor/SKILL.md1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a gemini-cli2Командой платформы
gemini skills install https://github.com/curiositech/some_claude_skills --path .claude/skills/cost-verification-auditorВручную: положить файлы
.devin/skills/cost-verification-auditor/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о cost-verification-auditor
Как установить cost-verification-auditor в Claude Code?
Выполни npx skills add curiositech/some_claude_skills --skill cost-verification-auditor -a claude-code. После этого скилл будет доступен по пути ~/.claude/skills/cost-verification-auditor/SKILL.md.
Что делает скилл cost-verification-auditor?
Он сравнивает расчётное количество токенов с реальными данными API и считает отклонение по формуле (actual - estimated) / estimated. Если оба показателя — по входу и по выходу — укладываются в ±20%, аудит проходит успешно.
Чем отличается аудит по отдельным вызовам от аудита по совокупности?
Скилл целится в точность суммарной стоимости DAG, а не каждого узла в отдельности. Отклонение на уровне узла до ±40% считается нормой из-за недетерминированности вывода LLM; важно, чтобы общий итог держался в пределах ±20%.
Исходный текст
SKILL.md · MIT
---
name: cost-verification-auditor
description: Audit LLM token cost estimates against actual API usage. Activate on 'cost verification', 'token estimate accuracy', 'API cost audit', 'estimation variance'. NOT for pricing lookups, budget
planning, or cost optimization strategies.
allowed-tools: Read,Write,Bash
metadata:
tags:
- cost
- verification
- auditor
pairs-with:
- skill: cost-accrual-tracker
reason: Compares tracked estimates against actual API invoices to find estimation drift
- skill: cost-optimizer
reason: Audit findings calibrate the optimizer prediction models for future runs
- skill: logging-observability
reason: Token usage logs provide the raw data needed for cost verification analysis
---
# Cost Verification Auditor
Verify that token cost estimates are within ±20% of actual Claude API usage.
## When to Use
✅ **Use for**:
- Validating token estimation systems after implementation
- Pre-deployment cost accuracy checks
- Debugging unexpected API bills
- Periodic estimation drift detection
❌ **NOT for**:
- Looking up model pricing (use pricing docs)
- Budget planning or forecasting
- Cost optimization strategies
- Comparing models by price
## Core Audit Process
### Decision Tree
```
Has estimator? ──No──→ Build estimator first (see Calibration Guidelines)
│
Yes
↓
Define 3+ test cases (simple/medium/complex)
↓
Estimate BEFORE execution (no peeking!)
↓
Execute against real API
↓
Calculate variance: (actual - estimated) / estimated
↓
Variance ≤ ±20%? ──Yes──→ PASS ✓
│
No
↓
Apply fixes from Anti-Patterns section
↓
Re-run verification
```
### Variance Formula
```typescript
const inputVariance = (actual.inputTokens - estimate.inputTokens) / estimate.inputTokens;
const outputVariance = (actual.outputTokens - estimate.outputTokens) / estimate.outputTokens;
const costVariance = (actual.totalCost - estimate.totalCost) / estimate.totalCost;
// PASS if both input AND output within ±20%
const passed = Math.abs(inputVariance) <= 0.20 && Math.abs(outputVariance) <= 0.20;
```
## Common Anti-Patterns
### Anti-Pattern: The 500-Token Overhead Myth
**Novice thinking**: "Claude Code adds ~500 tokens overhead, so add that to every estimate."
**Reality**: Direct API calls have ~10 token overhead. The 500+ overhead is ONLY when using Claude Code's full context (system prompts, tools, conversation history).
**Timeline**:
- Pre-2025: Many tutorials used 500+ token estimates
- 2025+: Direct API overhead is minimal (~10 tokens)
**What to use instead**:
| Context | Overhead |
|---------|----------|
| Direct API call | ~10 tokens |
| With system prompt | 50-200 tokens |
| With tools/functions | 100-500 tokens |
| Claude Code full context | 500-2000 tokens |
**How to detect**: Consistent 40-90% overestimation = overhead too high.
---
### Anti-Pattern: Per-Node Accuracy Obsession
**Novice thinking**: "Every node must be within ±20% or the estimator is broken."
**Reality**: LLM output length is non-deterministic. Per-node output variance of 30-50% is normal. What matters is **aggregate cost accuracy**.
**What to use instead**:
- Focus on total DAG cost variance (should be ±20%)
- Accept per-node output variance up to ±40%
- Use constrained prompts ("list exactly 3") to reduce variance
**How to detect**: Input estimates accurate, output varies wildly = normal LLM behavior.
---
### Anti-Pattern: Peeking Before Estimating
**Novice thinking**: "Let me run the API call first to see what tokens we get, then build the estimator."
**Reality**: This produces perfectly-fitted estimates that fail on new prompts. Estimation must happen BEFORE execution.
**Correct approach**:
1. Estimate based on prompt length and heuristics
2. Execute API call
3. Compare variance
4. Adjust heuristics if needed
## Calibration Guidelines
### Input Token Estimation
```typescript
// Calibrated 2026-01-30
const inputTokens = Math.ceil(prompt.length / CHARS_PER_TOKEN) + OVERHEAD;
```
| Text Type | CHARS_PER_TOKEN | Notes |
|-----------|-----------------|-------|
| English prose | 4.0 | Most consistent |
| Code | 3.0-3.5 | Symbols tokenize differently |
| Mixed | 3.5 | Balanced (recommended default) |
| JSON/structured | 3.0 | Punctuation heavy |
### Output Token Estimation
| Prompt Constraint | Multiplier | Notes |
|-------------------|------------|-------|
| "List exactly N items" | 0.8x input | Highly constrained |
| "Brief summary" | 1.0x input | Moderate |
| "Explain in detail" | 2-3x input | Expansive |
| Unconstrained | 1.5x input | Variable |
**Always**: Minimum 100 output tokens for any meaningful response.
### Model Behavior
| Model | Output Tendency |
|-------|-----------------|
| Claude Opus | Longer, more detailed |
| Claude Sonnet | Balanced |
| Claude Haiku | Concise, efficient |
## Quick Fixes
| Symptom | Cause | Fix |
|---------|-------|-----|
| Overestimating by 40%+ | Overhead too high | Reduce from 500 → 10 |
| Underestimating inputs | Chars/token too high | Reduce from 4.0 → 3.5 |
| Output wildly varies | LLM non-determinism | Use constrained prompts |
| Total cost accurate but per-node off | Normal aggregation | Accept it, focus on totals |
## Verification Checklist
- [ ] 3+ test cases (simple, medium, complex)
- [ ] Estimates run BEFORE API calls
- [ ] Variance formula: `(actual - estimated) / estimated`
- [ ] Target: ±20% for input AND output
- [ ] Report includes actionable recommendations
## References
See `/references/calibration-data.md` for detailed calibration tables and historical data.
© curiositech · MIT · curiositech/some_claude_skills