Zum Inhalt springen
Skillpedia
Sonstiges81k · #1598

cost-counterfactual

Was er macht

Dieser Skill vergleicht deine echten KI-Ausgaben mit dem, was es gekostet hätte, wenn jede Aufgabe eine einzige Modellstufe genutzt hätte. Er richtet sich an Menschen, die wissen wollen, ob die automatische Modellwahl sich lohnt.

Wann du ihn nutzt

  • ✓Wenn du wissen willst, ob die automatische Modellwahl dir Geld spart.
  • ✓Wenn du vermutest, dass der Router zu oft teure Modelle nutzt.
  • ✓Wenn du deine Ausgaben mit der ausschließlichen Nutzung des günstigsten oder des leistungsstärksten Modells vergleichen willst.

Link zum Skill

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-counterfactual/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-counterfactual/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Spart meine automatische Modellwahl tatsächlich Geld im Vergleich dazu, immer ein Modell zu nutzen?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Skill berechnet die früheren Token-Mengen zum Preis jeder Stufe neu und zieht deine echten Kosten ab. Ein positives Ergebnis heißt, dass das Routing Geld gespart hat, ein negatives, dass es mehr ausgegeben hat.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Multi-baseline counterfactual cost analysis. Pairs with the existing observability surface:

  • cost-budget-check — "have we crossed a threshold?" (reactive)
  • cost-projection — "when will we cross a threshold?" (predictive)
  • cost-counterfactual — "is the routing earning its keep?" (comparative) ← this one

Algorithm

  1. Read all session-* records from the cost-tracking namespace.
  2. Apply --since window filter (default all-time).
  3. Sum tokens across byModel[*] entries for each session.
  4. For each requested baseline (default: all three):
    • counterfactualUsd = (input × tier.input + output × tier.output + cache_write × tier.cache_write + cache_read × tier.cache_read) / 1M
  5. Compute savings = counterfactualUsd − actualUsd.
  6. Emit per-baseline totals + savings % across the comparison set.

Smoke transcript (2 sessions: 50K haiku tokens + 50K sonnet tokens)

| Sessions considered | 2 |
| Total input tokens  | 100,000 |
| Actual spend        | $0.162500 |

| Baseline           | Hypothetical | Actual    | Savings    | %       |
| `always-haiku`     | $0.025000    | $0.162500 | -$0.137500 | -550.00% |
| `always-sonnet`    | $0.300000    | $0.162500 | +$0.137500 |   45.83% |
| `always-opus`      | $1.500000    | $0.162500 | +$1.337500 |   89.17% |

How to read negative savings

A negative always-haiku result means the router chose more-expensive models than haiku on tasks haiku could have handled. That's an over-escalation signal:

  • Maybe qualityBar is set too high
  • Maybe the sonnet/opus session was warranted by complexity but the baseline doesn't know that
  • Run cost optimize (or inspect specific sessions via cost conversation) to investigate

Positive savings quantify the router's win against that baseline. The most informative number is usually always-sonnet — it's the standard "safe default" baseline most teams would pick if they didn't have routing.

When to use

  • Quarterly cost review: "We saved $X vs always-Sonnet — here's the proof."
  • CI gate: cost counterfactual --format json | jq '.baselines[1].savingsPct > 30' — fail builds if routing isn't saving ≥30% vs sonnet baseline (workload-shift detector).
  • Routing-config validation: When introducing a new qualityBar or cost-ceiling, re-run counterfactual to confirm savings didn't regress.

Stationarity caveat

Like all counterfactual analyses, this assumes the same tokens at the same complexity would have produced the same outcome from the baseline model. That's an upper bound — the baseline might have failed and required retries, which the math doesn't capture. Treat the numbers as a quality-blind ceiling.

Häufige Fragen

Was bedeuten negative Einsparungen?

Sie bedeuten, dass das Routing mehr ausgegeben hat als die Basis. Oft wurden Aufgaben an ein stärkeres Modell geschickt, als sie brauchten.

Welche Basislinien werden verglichen?

Immer Haiku, immer Sonnet und immer Opus, jeweils mit eigener Preistabelle.

Kann ich den Zeitraum begrenzen?

Ja. Eine since-Einstellung begrenzt die Analyse auf ein jüngeres Fenster. Standardmäßig wird die gesamte Zeit verwendet.

Details

Originalbeschreibung des Autors

Multi-baseline counterfactual cost analysis. Compares actual session spend to hypothetical always-haiku / always-sonnet / always-opus routing baselines. Answers "is the routing earning its keep?" Negative savings flag over-escalation; positive savings quantify the router's win.

repo: ruvnet/ruflo

Beliebtheit

GitHub-Sterne
81k
Platz im Ranking
#1598
Lizenz
MIT
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills