Repository navigation
feat(fork): show Oh My Pi spend on the usage page - #10
Merged
Merged
Conversation
Usage had no Oh My Pi source, so OMP spend never reached the daily/hourly history, model breakdown, or cache savings. Read OMP's native session JSONL: per-message usage carries the same cost OMP reports over ACP, and each file's session header supplies the session identity that resume needs. Subagent transcripts are separate sessions beside the session file, so they are counted from their own files; the parent's task aggregate is ignored to avoid counting that spend twice. Records keep the bare model id as rateModel, because the rate table keys on it, while the provider-prefixed id stays the display model. Zero-cost records fall back to T3's model pricing like the other providers. Store resolution follows OMP's own precedence: --session-dir, PI_CODING_AGENT_SESSION_DIR, profile (--profile / OMP_PROFILE / PI_PROFILE), PI_CODING_AGENT_DIR, an XDG root, then PI_CONFIG_DIR and the default root. The OMP adapter also gains a regression test that its end-of-turn usage_update cost reaches the provider thread.
Coriou
force-pushed
the
feat/omp-cost-tracking
branch
from
October 27, 2026 20:27
b08522a to
1c3fcc4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Usage had no Oh My Pi source. OMP spend never appeared in the daily/hourly history, the model
breakdown, cache savings, or the provider split, even though the composer already shows the live
session cost OMP reports over ACP.
Fix
apps/server/src/provider/Drivers/ompUsage.ts) over OMP's nativesession JSONL: per-message
usage.cost.total, the file'ssessionheader for resume state, and adedupeKeythat collapses the verbatim entries a fork copies.own files; the parent's
taskaggregate is ignored to avoid counting that spend twice. This is thesame rule OMP's own
omp-statsuses.rateModelcarries the bare model id OMP stores (the rate table keys on it) while theprovider-prefixed id stays the display model. Zero-cost records fall back to T3's model pricing.
--session-dir,PI_CODING_AGENT_SESSION_DIR, profile(
--profile/OMP_PROFILE/PI_PROFILE),PI_CODING_AGENT_DIR, an existing XDG root, thenPI_CONFIG_DIRand the default root."omp"added toUsageProviderKind, web/mobile label and colour,and a
docs/user/usage.mdline.usage_updatecost reaches theprovider thread (no production change for that part).
Evidence
Usage page in a dev server reading this machine's real OMP history:
Captures:
t3code-docs/media/omp-usage-before.webpandomp-usage-after.webp(kept outside thisrepo, as PR assets are not committed).
Reader against real data, in review:
still growing)
$4.912741, identical to the cumulative cost T3 already stored forthat provider thread
14.6 MB line
vp run check:changed: format, lint, knip ×2, graphql, typecheck (30 packages) and the affectedtests are green.
Notes
ompbuckets and sources while still decoding the summary, soUSAGE_CONTRACT_VERSIONdoes not need a bump (upstream added"muse"the same way).PI_CODING_AGENT_DIRcounts those sessions under bothproviders; documented in the user guide.
Model: openrouter/deepseek/deepseek-v4.1-flash-1017 · Harness: Oh My Pi (Tx Code)
Review: Opus 5.5 via Claude Code, effort medium — mergeable.