← Zurück zu KI-Automatisierung und Kostenkontrolle

Skill · Version 1.0.0

Verbrauchsmessung überprüfen

Testet Kostenmessung auf Summenerhaltung, genaue Aufsummierung, Duplikate und unveränderte historische Preise.

metering-verification

Teammitglieder mit diesem Skill

Entdecke, wie der Skill hilft

Wann ist der Skill hilfreich?

Nutze diesen Skill bei verbrauchsabhängigen Kundenguthaben oder Kontingenten.

Wobei hilft er dir?

  • Prüft, dass Aufschlüsselungen den ursprünglichen Gesamtbetrag ergeben.
  • Verhindert doppelte Buchung wiederholter oder präzisierter Verbrauchsbelege.
  • Testet Preisgrenzen und anbieterspezifische Mengeninterpretation.

Das könntest du fragen

Prüfe kleinste Tokenbeträge, doppelte Streamereignisse und Schätzkorrekturen ohne historische Neubewertung durch neue Preise. Wende den neuen Preis nur auf spätere Nutzung an und gleiche den Bericht ab. Alte Abrechnungen bleiben unverändert; wiederholte Belege erzeugen keine Zusatzgebühr.

Ausführliche Dokumentation

Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.

Details…Weniger anzeigen

Metering Verification

A metering bug silently corrupts financial visibility, unit economics, or customer quota enforcement. Every metering pipeline, price calculator, and attribution query must be verified with deterministic tests covering edge cases and failure modes.

Workflow

  1. Verify accounting invariants and conservation laws:
    • Assert that the sum of drill-down slices across any dimension (SUM(cost) GROUP BY tenant_id, GROUP BY agent_role, GROUP BY model) equals the grand total ledger cost (100% conservation, zero dropped or duplicated rows from join fan-out).
    • Assert sub-cent precision: verify that 100,000 micro-events of 10 cached tokens each accumulate to the exact expected microdollar total with zero floating-point drift.
  2. Test deduplication and out-of-order ingestion:
    • Replay the exact same usage event payload 5 times (and under concurrent workers) and assert that ledger count and total quantity increase only once.
    • Test upgrade transitions: ingesting an 'estimated' event followed by a 'provider_reported' event with the same idempotencyKey must supersede or adjust the estimate without double-counting.
  3. Test rate card boundaries and version transitions:
    • Test events with occurredAt 1 ms before effectiveFrom, at effectiveFrom, and 1 ms after effectiveTo.
    • Verify that inserting a new price version does not alter the computed cost of historical events unless an explicit repricing command is run.
  4. Test provider-specific LLM usage normalization:
    • Include fixtures for OpenAI (cached_tokens inside prompt_tokens, reasoning_tokens inside completion_tokens), Anthropic (input_tokens disjoint from cache_creation_input_tokens and cache_read_input_tokens), and Gemini (cachedContentTokenCount inside promptTokenCount, thoughtsTokenCount).
    • Verify that normalized billable buckets never double-charge cached or reasoning tokens.
  5. Test failure, timeout, and reservation lifecycle:
    • Verify that failed upstream calls that consumed tokens still emit usage events.
    • Verify that pre-execution budget reservations (reserve -> settle -> release or expire) never leak locked quota under concurrency.

Verification Checklist

  • Idempotent replay of identical events produces zero duplicate ledger entries.
  • Sub-cent microdollar / nanodollar arithmetic matches exact reference calculations.
  • Provider token fixtures (OpenAI, Anthropic, Gemini) normalize without double-counting.
  • Historical queries use occurredAt rate versions and remain invariant when today's prices change.
  • Sum of tenant + system buckets equals total ingested cost with no join fan-out.

Enthaltene Dateien 1

  • SKILL.md