docs(0047): usage & cost stats — metering what a ticket costs #121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "glen/0047-usage-cost-stats"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Design doc only — no code. This is the spec for usage/cost/time metering across a conversation group, for Chad's review before implementation (which will be handed to Cursor per the working session).
What's in it:
GET /platform/v2/models(no auth, verified live 2026-10-17) gives exact per-1M input/output/cache_read/cache_write rates + long-context tiers per model. Cost computed at capture time so price drift never rewrites history. One calibration item: the 6.5% guarded platform fee vs list price on the bare/ai/v2/chat/completionspath — resolved once against Gloo's Usage dashboard.usage_eventsrow per turn) + harness calls (a newonUsagehook in the harness event sink, which currently drops usage chunks). Titles excluded by decision.fresh×input + cached×cache_read + output×output, platform-fee multiplier, long-context tier selection, null cost (plan chip) for subscriptions — GLM/claude/cursor get tokens but no invented dollars.0054_usage_stats.sql—usage_events+model_prices(refreshed by the existing catalog sweep; Gloo fetch needs no key).X-Cache-TTL/prompt_cache_keyin the provider transforms) — the chat path currently pays quadratic full-price input on long threads; the cost model already prices cache segments so the drawer will show the win.Decisions locked with Chad in chat, 2026-10-17: scope = conversation tree + harness calls; Gloo is the accuracy target; titles unmetered; subscriptions token-only; forward-only metering; stats drawer surface; Cursor implements.