Agent skill · data analytics · erichowens
cost-optimizer
Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget. Downgrades models, skips optional nodes, or stops early when cost exceeds thresholds. Use
Why this skill is useful
Adds a comprehensive budget enforcement mechanism with real-time decision-making scripts for optimizing LLM costs during DAG execution.
What it needs
Requires grep, read installed locally. About 3k tokens when loaded. Last updated 2026-07-14. 180 stars on the source repository.
What this skill does
Cost Optimizer Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget: downgrade models, skip optional nodes, or stop early. --- When to Use ✅ Use for: Setting and enforcing cost budgets for DAG executions Real-time cost monitoring during execution Deciding when to downgrade model tiers mid-execution Identifying which nodes are most expensive and why Post-execution cost analysis and optimization recommendations ❌ NOT for: Choosing which model to use per node (use llm-router) Provider pricing comparisons (static data, not a skill) Billing or invoicing features --- Budget Enforcement Process Budget Tiers Budget Remaining Action ----------------- -------- >50% Execute at planned model tier 20-50% Log warning. Continue at planned tier. 10-20% Downgrade remaining Tier 2 nodes to Tier 1 (Haiku) 5-10% Downgrade ALL remaining nodes to Tier 1. Skip optional nodes. <5% Stop execution unless next node is critical path 0% Stop. Return partial results with cost breakdown. Cost Estimation Per Node Before each node executes, estimate its cost: Use historical averages for this skill + model combination. If no history, use defaults: Tier 1 (Haiku): ~800 input + 400 output = ~$0.001 Tier 2 (Sonnet): ~2000 input + 1000 output = ~$0.012 Tier 3 (Opus): ~3000 input + 1500 output = ~$0.16 Post-Execution Report --- Anti-Patterns No Budget at All Wrong: Running DAGs without any cost tracking until the API bill arrives. Right: Every DAG execution has a budget, even if generous. Track spend per node. Aggressive Downgrading Wrong: Downgrading Opus nodes to Haiku at 50% budget remaining, causing quality failures that trigger expensive retries. Right: Only downgrade when the alternative is stopping execution. Retries cost more than the original model tier. Ignoring Retries in Cost Wrong: Budgeting for one attempt per node. Right: Budget for avgretries × costperattempt. A node with 3 retries on Sonnet costs $0.036, not $0.012.
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills erichowens/cost-optimizer