← Zurück zu Meter
AgentMeter
Verbrauchsmessung überprüfen
Testet Kostenmessung auf Summenerhaltung, genaue Aufsummierung, Duplikate und unveränderte historische Preise.
metering-verification
Entdecke, wie der Skill hilftWann 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.
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
- 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
10cached tokens each accumulate to the exact expected microdollar total with zero floating-point drift.
- Assert that the sum of drill-down slices across any dimension (
- 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 sameidempotencyKeymust supersede or adjust the estimate without double-counting.
- Test rate card boundaries and version transitions:
- Test events with
occurredAt1 ms beforeeffectiveFrom, ateffectiveFrom, and 1 ms aftereffectiveTo. - Verify that inserting a new price version does not alter the computed cost of historical events unless an explicit repricing command is run.
- Test events with
- Test provider-specific LLM usage normalization:
- Include fixtures for OpenAI (
cached_tokensinsideprompt_tokens,reasoning_tokensinsidecompletion_tokens), Anthropic (input_tokensdisjoint fromcache_creation_input_tokensandcache_read_input_tokens), and Gemini (cachedContentTokenCountinsidepromptTokenCount,thoughtsTokenCount). - Verify that normalized billable buckets never double-charge cached or reasoning tokens.
- Include fixtures for OpenAI (
- 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 -> releaseorexpire) 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
occurredAtrate 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
