मुख्य सामग्री पर जाएँ
Skillpedia
विविध81k · #1598

cost-counterfactual

यह क्या करती है

यह स्किल आपके असली AI खर्च की तुलना करती है कि अगर हर कार्य एक ही मॉडल स्तर पर चलता तो कितना लगता। जो लोग जानना चाहते हैं कि अपने-आप मॉडल चुनना फ़ायदेमंद है या नहीं, उनके लिए यह है।

कब इस्तेमाल करें

  • ✓जब आप जानना चाहें कि मॉडल अपने-आप चुनने से पैसा बच रहा है या नहीं।
  • ✓जब आपको शक हो कि राउटर बहुत बार महँगे मॉडल इस्तेमाल करता है।
  • ✓जब आप अपने खर्च की तुलना सिर्फ़ सबसे सस्ते या सबसे सक्षम मॉडल से करना चाहें।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-counterfactual/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या मॉडल अपने-आप चुनना वाकई पैसा बचा रहा है, बजाय हर बार एक ही मॉडल इस्तेमाल करने के?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल पिछले टोकन उपयोग को हर स्तर की कीमत पर दोबारा गणना करती है और उसमें आपका असली खर्च घटाती है। सकारात्मक नतीजे का मतलब है राउटिंग ने पैसा बचाया, और नकारात्मक का मतलब है उसने ज़्यादा खर्च किया।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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.

अक्सर पूछे जाने वाले सवाल

नकारात्मक बचत का क्या मतलब है?

इसका मतलब है कि राउटिंग ने आधार रेखा से ज़्यादा खर्च किया। अक्सर इसका अर्थ होता है कि कार्य को ज़रूरत से ज़्यादा ताकतवर मॉडल मिला।

किन आधार रेखाओं की तुलना होती है?

हमेशा haiku, हमेशा sonnet और हमेशा opus, हर एक की अपनी कीमत सूची के साथ।

क्या मैं समय सीमा तय कर सकता हूँ?

हाँ। since सेटिंग विश्लेषण को हाल की अवधि तक सीमित करती है, और डिफ़ॉल्ट रूप से पूरा समय लिया जाता है।

जानकारी

लेखक का मूल विवरण

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

लोकप्रियता

GitHub स्टार
81k
रैंकिंग में स्थान
#1598
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

agent-adaptive-coordinator

81k

आपके एजेंट को काम बदलने पर AI एजेंटों के समूह को बाँटने और फिर से संतुलित करने में मदद करती है, और काम के हिसाब से लेआउट चुनती है।

AI और एजेंटएजेंट

agent-agent

81k

आपके एजेंट को बड़े लक्ष्य को क्रमबद्ध कार्यों की योजना में बदलना सिखाती है, और स्थिति बदलने पर योजना फिर से बनाना भी।

AI और एजेंटएजेंट

agent-agentic-payments

81k

AI खरीदारी के लिए खर्च के आदेश मैनेज करने में मदद करती है, जिसमें खर्च की सीमा, समय अवधि, व्यापारी नियम और signed मंज़ूरियाँ शामिल हैं।

AI और एजेंटएजेंट

agent-analyze-code-quality

81k

आपके एजेंट को कोड की गुणवत्ता जाँचने में मदद करती है, बिना फ़ाइलें बदले code smells, technical debt और refactoring के सुझाव खोजकर।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills