Repository navigation
feat(kin): the Usage page shows the day's cache read share and cost per turn - #1096
Conversation
Count completed turns, fresh starts and upkeep on the owner's local day. Price the metered totals with Usage's settings and rate table, expose the figure only to the owner, and log yesterday's figure once per day. T3-file: apps/server/src/ws.ts: Supply the existing Usage service to the Kin handler. T3-file: apps/server/src/usage/UsageService.ts: Share the live pricing settings and rate cache without starting a transcript scan. T3-file: apps/server/src/usage/UsageService.test.ts: Verify changing the Usage price changes the aggregated estimate by the same amount. T3-file: apps/server/src/usage/usagePricing.ts: Reuse the request rate arithmetic for aggregated ledgers without treating a day as one request. People-change: The owner host records daily cache reads, fresh starts and upkeep costs. No screen changes yet. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Today's and yesterday's Kin cache figure sits at the top of Usage on web, desktop and phone, for the owner only. One shared function turns the host's figure into words: the read share, cost per turn, turns, fresh starts with their reasons in plain words, and what keeping the cache warm cost. A missing figure reads "not available", an unknown reason counts as "other". People-change: The owner sees two lines on the Usage page: how much of Kin's input came from the cache today and yesterday, what a turn cost, and why sessions started fresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… they happened A wake-up that finished before starting a model run (routine content with nothing new, dropped events) was counted as a turn and, having no ledger, made the whole day's cost per turn unavailable. A turn that ran and then failed or timed out was dropped entirely, though its spend was charged. Every cache write was priced at the five-minute rate although Kin's owner seat and its keep-warm requests write the one-hour cache (2x input, not 1.25x). And a day whose midnight is skipped by a clock change ran an hour into the next day, so that hour counted twice. Turns are now completed wake-ups that started a run; a failed run's tokens and charges count toward spend and the share but not the turn count; writes the adapter recorded with an hour's lifetime, and every keep-warm write, are priced at the hour's rate; and a day ends where the next one starts. People-change: the owner's Usage line no longer reads "cost per turn not available" on days with a routine that had nothing new, and its "about $X a turn" now includes failed turns' spend and the one-hour write price. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The session carry branch stores five reasons the Usage line had no label for (summary, cold_large, unseen, rules_overflow, no_file), so they would read as "other". Each now has a short plain label, with the table test extended. People-change: the owner's Usage line names these fresh starts instead of counting them as "other". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…urn on web and phone Joins feat/kin-cache-daily-figure and feat/kin-cache-daily-line as one step. People-change: none Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
People-change: none Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Ein is commenting on behalf of Nishchay. Server 4 is red at |
The owner sets two rules for Kin's agents: turns read at least 98% of their input from the model's cache, and the cost per turn is always known. Neither number is visible anywhere.
kin.host.cacheDaily:People-change: The owner sees two lines on the Usage page: how much of Kin's input came from the cache today and yesterday, what a turn cost, and why sessions started fresh.
Checked as part of train 18's one check at the tip.
An independent review by Claude Opus 5.5 found it LANDS AFTER FIXES, and its fixes are on this branch.
🤖 Generated with Claude Code