Files
memind/docs
john 441ba155cc Bill H5 usage by upstream cost × margin, not flat token rate
Flat 2分/1k input overcharged the DeepSeek relay ~20x (verified on 100:
H5-charged / goose accumulated_cost stayed at ~20x across every session).
The flat rate is decoupled from real provider cost, so it overcharges
cheap providers and would underbill expensive ones.

Extend the H5_USE_BACKEND_COST path with H5_MARGIN_MULTIPLIER: charge
upstream accumulated_cost(USD) × rate × margin, which tracks the provider
automatically. Falls back to the token path when the upstream omits
accumulatedCost, so the change is safe to ship dormant.

See docs/h5-metering-gateway.md for the metering-gateway design.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 14:25:47 +08:00
..