Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add Anshin-Health-Solutions/superpai --skill "cost-dashboard"
Install specific skill from multi-skill repository
# Description
Analyze model routing efficiency, task distribution, and performance from the SuperPAI cost logger. Shows how effectively the CCR routes tasks to the right model tier.
# SKILL.md
name: cost-dashboard
description: Analyze model routing efficiency, task distribution, and performance from the SuperPAI cost logger. Shows how effectively the CCR routes tasks to the right model tier.
triggers:
- "cost"
- "spending"
- "token usage"
- "how much"
- "cost dashboard"
- "cost report"
- "cost summary"
- "routing efficiency"
- "model distribution"
Routing & Efficiency Dashboard
Analyze how effectively SuperPAI routes tasks to the optimal model tier.
Why This Matters
For Pro Max subscribers (unlimited usage), the value isn't dollars saved β it's:
- Speed: Haiku responds ~10x faster than opus. Routing simple tasks to haiku means faster iteration.
- Routing accuracy: The right model for the right task. Opus on a typo fix is slow. Haiku on architecture design is under-capable.
- Throughput: More tasks completed per hour when simple work isn't waiting for opus-level processing.
For API users (pay-per-token), the value is direct cost savings:
- Haiku: ~$0.25/MTok input vs Opus: ~$15/MTok input (60x difference)
- Proper routing can reduce monthly API costs by 70-80%
Data Source
Cost data is stored in logs/cost.jsonl at the plugin root. Each line is a JSON object with:
- ts: ISO timestamp
- session: Session designation (WIN1, WSL1, etc.)
- tool: Tool name used
- model: Model tier used (haiku, sonnet, opus) β written by the CCR hook
- type: Entry type (tool_use, session_start, session_end)
For richer data, use the superpai_cost_summary MCP tool which queries the database.
How to Analyze
- Read the log file:
Read logs/cost.jsonlfrom the plugin root - Parse JSONL: Each line is one JSON entry
- Key metrics to calculate:
- Model distribution: % of tasks routed to haiku / sonnet / opus
- Routing efficiency score: Tasks where model matched expected complexity (aim for >80%)
- Speed index: Estimated time saved by routing simple tasks to haiku
- Session comparison: Which sessions use more opus (complex work) vs haiku (maintenance)
- Tool frequency: Which tools are called most (Read, Edit, Bash, Agent)
Output Format
Present results as a clear summary:
SuperPAI Routing Report
=======================
Period: {start_date} to {end_date}
Total agent dispatches: {count}
Model Distribution:
haiku: {count} ({pct}%) β simple tasks, lookups, fixes
sonnet: {count} ({pct}%) β features, bugs, refactoring
opus: {count} ({pct}%) β architecture, research, security
Routing Efficiency:
Estimated correct routes: {pct}%
Speed benefit: ~{X}x faster avg response for {haiku_count} haiku-routed tasks
By Session:
WIN1: {count} dispatches (haiku:{h}% sonnet:{s}% opus:{o}%)
WSL1: {count} dispatches (haiku:{h}% sonnet:{s}% opus:{o}%)
Top Tools:
Agent: {count} (model routing active)
Read: {count}
Edit: {count}
Bash: {count}
Daily Trend:
{date}: {count} dispatches β h:{haiku} s:{sonnet} o:{opus}
{date}: {count} dispatches β h:{haiku} s:{sonnet} o:{opus}
If the user is on the API (not Pro Max), also show estimated cost:
Estimated API Cost (if applicable):
With CCR routing: ~${routed_cost}
Without (all opus): ~${all_opus_cost}
Estimated savings: ~${savings} ({pct}%)
CCR Weight Configuration
Users can adjust the CCR signal weights via superpai_settings:
- SUPERPAI_CCR_WEIGHT_KEYWORDS (default: 40) β keyword pattern matching
- SUPERPAI_CCR_WEIGHT_LENGTH (default: 15) β prompt word count
- SUPERPAI_CCR_WEIGHT_COMPLEXITY (default: 20) β multi-file/single-file scope
- SUPERPAI_CCR_WEIGHT_DEPTH (default: 25) β adaptive depth mode integration
Notes
- Token counts are not available from Claude Code hooks β model distribution is the primary metric
- For actual dollar costs on API plans, cross-reference with Anthropic's usage dashboard
- The CCR logs its routing decision (model + scores) to
additionalContexton every Agent dispatch - Use "cheap mode" / "quality mode" to override automatic routing
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.