Skip to content

Add a Grok usage collector - #6485

Closed
scottjones wants to merge 4 commits into
omacom:quattrofrom
scottjones:model-usage-grok-provider
Closed

scottjones wants to merge 4 commits into
omacom:quattrofrom
scottjones:model-usage-grok-provider

Conversation

@scottjones

@scottjones scottjones commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Adds Grok to the agents panel the way #6603 asked: a collector, the brand marks, and nothing in the plugin. Tokens come from ~/.grok/sessions.

The plan and the weekly allowance come from grok's own ACP _x.ai/billing method, asked over grok agent stdio. Grok owns that call, so the collector never reads auth.json and never talks to an xAI endpoint itself — the same boundary the Codex collector keeps. The reading grok writes to its own log stands in when the ACP call says nothing, since _x.ai/billing is a vendor extension and a renamed method looks the same from here as a signed-out CLI.

A usable reading is a percentage that still belongs to an open period; otherwise the meter is omitted rather than guessed. That omission is not hypothetical — grok 1.0.0 stopped reporting creditUsagePercent entirely, where 0.2.118 had carried it in 100 of 102 readings on the same account. It came back in 1.0.5 and the meter lit up on its own, which is the behaviour to expect the next time the field moves.

The meter and the token chart will not agree when both are present. Transcripts are mostly cache reads, and the allowance is billed per X identity, not per machine.

The same reply carries prepaidBalance, onDemandCap and onDemandUsed as {"val": N} objects. None feed the panel's balance ledger: they read 0 on every account this has been seen on, and nothing names a unit, so credits, dollars and cents are indistinguishable at zero. Guessing the scale would trade a missing balance for a wrong one.

Thanks to @dghelm for the ACP transport, @harrison-wallace for catching that the meter returned in 1.0.5, and @benwyrosdick and @Loafer19 for independent verification.

Test plan

  • test/shell.d/agent-usage-grok-scanner-test.sh — 20 assertions, including the ACP path, the log fallback, and both failing against a build without the fallback
  • bin/omarchy commands --check and shebang-aware syntax sweep
  • Verified live against grok 1.0.5 (5115b46bc9): ACP, the HTTP endpoint and the log all report the same meter
  • Panel verified in a running shell on dark and light themes
  • Untested: an account with non-zero prepaid balance or on-demand cap
  • Subagent child sessions count toward tokens but not totalSessions or totalPrompts (children are read from the parent's subagent_spawned records)

Copilot AI balanced review requested due to automatic review settings August 1, 2026 14:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Grok usage, model breakdowns, subscription tier, and weekly credit limits to the model-usage panel.

Changes:

  • Adds Grok transcript and billing scanners with tests.
  • Integrates Grok into provider selection and synchronization.
  • Adds Grok branding, configuration, and documentation.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/shell.d/model-usage-grok-scanner-test.sh Tests Grok usage and credit scanning.
shell/plugins/model-usage/scripts/grok_usage_scanner.py Scans transcripts, billing logs, and live credits.
shell/plugins/model-usage/README.md Documents Grok behavior and configuration.
shell/plugins/model-usage/providers/Grok.qml Implements the Grok provider.
shell/plugins/model-usage/Panel.qml Adds Grok branding and icon fallback.
shell/plugins/model-usage/manifest.json Enables Grok by default.
shell/plugins/model-usage/Main.qml Integrates Grok into provider orchestration.
shell/plugins/model-usage/assets/grok.svg Adds the dark-background Grok mark.
shell/plugins/model-usage/assets/grok-light.svg Adds the light-background Grok mark.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings August 1, 2026 14:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

@rlimberger rlimberger mentioned this pull request Aug 6, 2026
4 of 7 tasks
@dhh

dhh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Heads up: #6603 just landed on quattro and restructured this whole area, so this PR needs a rework before it can merge.

The model-usage plugin is gone. It's been renamed to omarchy.agents (shell/plugins/agents/), and the panel is now strictly a display: it watches JSON records under ~/.local/state/omarchy/agents/usage/ and draws whatever appears there. All the in-plugin machinery this PR touches — providers/*.qml adapters and scripts/*_usage_scanner.py — no longer exists.

Usage collection now lives in standalone collectors in bin/. One omarchy-agent-usage-<agent> script per agent prints a complete, display-ready usage record (identity, tier, status, rate limits, today/week/all-time stats), and omarchy-agent-usage-update runs every collector it finds and writes the records atomically to the state directory.

The upside: adding an agent no longer touches the panel at all. Ship a collector that prints the record contract, optionally add an assets/<id>.svg mark (with an -light twin if it needs one for light surfaces), and the panel gains a tab on its own. See shell/plugins/agents/README.md for the contract and the claude/codex collectors in bin/ as reference implementations — #6604 (Cursor) is a good example of a provider PR in the new style.

If you'd like to update this PR to the new structure, rebase on quattro and reshape the scanner into a collector. Happy to answer questions here.

— Claude Fable 5, written on behalf of @dhh

Copilot AI review requested due to automatic review settings August 14, 2026 18:02
@scottjones
scottjones force-pushed the model-usage-grok-provider branch from 048fcb2 to b1460f5 Compare August 14, 2026 18:02
@scottjones scottjones changed the title Add Grok as a model-usage provider Add a Grok usage collector Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 7 changed files in this pull request and generated no new comments.

@scottjones

Copy link
Copy Markdown
Contributor Author

Reworked onto the new structure — thanks for the pointer to #6603.

It's now one collector (bin/omarchy-agent-usage-grok) printing the record contract, plus assets/grok.svg and its light twin. The plugin itself is untouched: no providers/*.qml, no scanner script, and the tab appears on its own. Rebased on quattro.

One thing worth flagging up front, because it looks like a bug otherwise: there is currently no weekly meter to draw. Grok 1.0.0 stopped reporting creditUsagePercent. The billing endpoint still answers 200 with the current period; the field is simply gone — 0 of 7 logged readings on 1.0.0, against 100 of 102 on 0.2.118 for the same SuperGrok account. The collector omits the meter rather than guessing at it, and it lights up on its own if xAI publishes the number again. Tokens by day and by model are unaffected.

Verified on an Apple Silicon machine: the tab renders in a running shell on both dark and light themes, and test/shell.d/agent-usage-grok-scanner-test.sh covers turn summing, per-turn dedupe, cache not double-counted, multi-model turns, local-day filing, the live-vs-log fallback order, and an expired period — 16 assertions.

Untested: an account with a non-zero prepaid balance or on-demand cap. Both are 0 on the identity this was built against, so that mapping is deliberately left out; the failure mode is a missing meter, not a wrong number.

@benwyrosdick

Copy link
Copy Markdown

Verified on Omarchy 4.0.0 against a SuperGrok Heavy login.

The collector printed a ready record (weekly meter + local token charts from turn_completed in ~/.grok/sessions). Dropping that JSON into ~/.local/state/omarchy/agents/usage/grok.json made the stock omarchy.agents panel grow a Grok tab — no plugin changes.

This is the collector I’d take over #7200: current Grok sessions store billed tokens on updates.jsonl turn_completed rows, not as a top-level usage object on events/chat history.

@dghelm

dghelm commented Aug 20, 2026

Copy link
Copy Markdown

I opened a narrow PR onto this branch: scottjones#1

It replaces only the limits transport with Grok's own ACP _x.ai/billing method, while preserving this PR's transcript scanner, assets, record mapping, and test structure. The patch removes 91 net lines, avoids reading auth.json or calling a private billing endpoint directly, and follows the same provider-CLI-RPC boundary as the merged Codex collector. I verified it against Grok CLI 1.0.5; the focused collector tests pass.

Why I targeted #6485 instead of opening another Basecamp PR:

So I did not open a competing Basecamp PR. This is a PR-to-PR patch for the author to take, alter, or decline.

@harrison-wallace

Copy link
Copy Markdown

Independent confirmation of the billing endpoint, and one data point that may change the "no meter on 1.0.0" conclusion: creditUsagePercent is back on grok 1.0.5.

I built an equivalent collector separately before finding this PR (not sending it — this one is ahead and has the tests), so the numbers below come from a different implementation hitting the same route.

grok 1.0.5 (5115b46bc9) [stable], SuperGrok account, unified billing:

// GET https://cli-chat-proxy.grok.com/v1/billing?format=credits
{
  "creditUsagePercent": 32.0,
  "period": "USAGE_PERIOD_TYPE_WEEKLY",
  "products": [
    { "product": "GrokBuild",   "usagePercent": 29.0 },
    { "product": "GrokChat",    "usagePercent": 3.0 },
    { "product": "GrokImagine", "usagePercent": null }
  ],
  "prepaid": 0, "onDemandCap": 0, "unified": true
}

Present in 5/5 spot readings just now, and on every poll of a 15-minute timer running since ~18:00 UTC today. So it looks like a 1.0.x regression that has since been fixed, rather than xAI withdrawing the figure — worth re-checking on 1.0.5 before shipping with the meter omitted.

Two other things I can confirm:

  • x-xai-token-auth: xai-grok-cli is load-bearing. Without it the same URL 404s, and /v1/chat/completions answers 426 Upgrade Required, which reads like a client-version problem rather than a missing header. Cost me a while, and I had wrongly concluded no quota endpoint existed.
  • Plan label: /v1/settings → subscription_tier_display: "SuperGrok", while /v1/user?include=subscription → subscriptionTier: "GrokPro" on the same account. Worth preferring the display field.

GrokImagine returning usagePercent: null supports omitting rather than guessing — a product entry can exist with no reading at all.

No help on your last checkbox, unfortunately: prepaid and onDemandCap are both 0 here too, so on-demand overage stays untested.

@Loafer19

Copy link
Copy Markdown

+1 on keeping this as the canonical Grok collector PR (won't open another).

Confirmed on Grok 1.0.5: billed tokens are on updates.jsonl turn_completed
(not events/chat history), with cache split out of inputTokens.

Suggested add before merge: skip session_kind values that start with
subagent so parent+child sessions aren't double-counted. ACP
_x.ai/billing for limits also looks like the right transport.

@scottjones

Copy link
Copy Markdown
Contributor Author

Pushed the ACP switch. Thanks @dghelm and @harrison-wallace — both findings held up here on grok 1.0.5 (5115b46bc9).

The meter is back

@harrison-wallace is right, and the caveat at the top of this PR was stale. I've corrected it. All three transports agree at 3% on the same account:

transport meter plan
ACP _x.ai/billing 3% SuperGrok
GET /v1/billing?format=credits 3% —
~/.grok/logs/unified.jsonl 3% SuperGrok

So 1.0.0 was a regression since fixed, not xAI withdrawing the figure. The collector needed no change to pick it up — only the notes were wrong.

One correction to the body you posted, in case anyone builds on it. The real reply nests the config and wraps the money fields, and carries no products array on this account — which is isUnifiedBillingUser: true, the same condition you credited:

{
  "config": {
    "creditUsagePercent": 3.0,
    "currentPeriod": { "type": "USAGE_PERIOD_TYPE_WEEKLY", "start": "…", "end": "…" },
    "prepaidBalance": { "val": 0 },
    "onDemandCap": { "val": 0 },
    "onDemandUsed": { "val": 0 },
    "isUnifiedBillingUser": true
  },
  "subscription_tier": "SuperGrok"
}

If your products[] reading is verbatim from a different route, I'd like to know which one — per-product meters would be a genuinely nice addition, but I won't build them on a shape I can't reproduce. Your tier advice is already satisfied, incidentally: the ACP reply's subscription_tier gives SuperGrok directly, so the /v1/settings vs /v1/user discrepancy never bites this collector.

prepaidBalance, onDemandCap and onDemandUsed are now documented as the {"val": N} objects they are, along with why they stay unmapped: they read 0 on every account any of us has, and nothing in the reply names a unit, so credits, dollars and cents are indistinguishable at zero. Guessing the scale trades a missing balance for a wrong one.

@dghelm's patch is in, with one change

_x.ai/billing is real on 1.0.5, and it carries the plan as well as the meter — which the private HTTP endpoint does not. So it replaces the endpoint and the log's tier duty in one round-trip, with no auth.json read. Measured cost is +0.2s (0.74s vs 0.51s), against a 900s refresh interval. The boundary argument is right and matches the Codex collector.

The change: I kept grok's log as the fallback rather than removing it. _x.ai/billing is a vendor extension with no stability promise, and from the collector a renamed method looks exactly like a signed-out CLI — so keeping the log means a repeat of the 1.0.0 episode costs nothing. In fairness the log path is the more brittle of the two, since it matches on a log message; that's why it's the fallback and not the source. The plan and the meter are also filled independently now, so a reply carrying one but not the other keeps what it gave.

19 assertions, and the fallback cases fail against the version without the fallback.

@Loafer19 — on the subagent double-count

I dug into this and it's more interesting than it first looks.

There is no session_kind on these records. A turn_completed update carries exactly sessionUpdate, prompt_id, stop_reason, usage, and occasionally agent_result — 333 records here, 331 with usage, no other fields on any of them. Subagents are tracked on their own updates instead: subagent_spawned / subagent_finished, carrying child_session_id, parent_session_id, parent_prompt_id, tokens_used and turns. Each child does get its own session directory with its own turn_completed rows, so the instinct is sound.

But tokens are not double-counted. Across 331 turns, no prompt_id appears in more than one transcript, and in one case the parent's turn (218,712 tokens) is smaller than its child's total (247,034) — which is impossible if the parent folded the child's usage in. Every token is counted exactly once, so skipping child sessions would undercount spend that really happened.

Session and prompt counts are inflated, though, and that part is worth fixing. Six spawns here, five with usage:

  • totalSessions 18 → 13 actually started by me (38% high)
  • totalPrompts 331 → 326 actually typed by me (1.5% high)

The session count is the real distortion. The fix isn't a field on the turn — it's collecting child_session_id from every subagent_spawned record and keeping those sessions out of the session and prompt counts while still counting their tokens.

Happy to add that. Before I do: if you have a transcript where a session_kind actually appears on a turn, I'd like to see it, because that would be a shape I don't have here — and it would change the fix.

@boundsj

boundsj commented Sep 4, 2026

Copy link
Copy Markdown

Independently verified the current head (c7e5d801) on:

  • Omarchy 4.0.2-1, x86_64
  • Grok 1.0.13 (5e9a58528b76, stable)

All 19 focused collector assertions pass. Against a real signed-in Grok installation, the collector produced a valid ready record containing both local statistics and the current quota window. The quota information matched Grok’s own live billing response.

I also fed the record into the stock omarchy.agents panel through a temporary user-space service and visually confirmed that the Grok tab renders correctly. No panel changes were needed.

Thanks! This works well for me.

@cristianuibar

Copy link
Copy Markdown

Verified the current head on Omarchy 4.0.0.r2153.g9c5482c-1 with Grok 1.0.34 (3736acbc8658).

omarchy-agent-usage-grok --force exited 0 in about 2 seconds and printed a ready record the panel can consume: schemaVersion 1, id grok, seven recentDays, per-model cache split, and a weekly limit. Plan came back as SuperGrok Heavy, with a usedPercent inside an open period and a future resetsAt. No stderr.

Two checks against this machine's sessions, not the fixtures:

  • updates.jsonl is the right ledger. Only 54 sessions have usage.json (17 of those are top-level). 303 have updates.jsonl, and 300 of those contain turn_completed usage. A collector that only read usage.json would miss most of the history.
  • Child sessions are not double-counted. 203 subagents/*/meta.json links point at child directories that also have updates.jsonl. None of those children share a prompt_id with the parent file, so the session:prompt_id dedupe is not what saves it: the spend lives in the child file and is counted once. That closes the child-session follow-up for this layout. Parents that only roll children up inside usage.json are irrelevant here, because this collector does not read that file.

Today's row is 0 because nothing completed today. The last non-zero day in the 7-day window is yesterday. Token charts and the weekly meter both populated.

@cristianuibar cristianuibar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Grok collector to merge. The other open Grok collector PRs are duplicates of this one.

Verified head c7e5d801 on Omarchy 4.0.0.r2153.g9c5482c-1 with Grok 1.0.34. Details are in the comment above. Short version for whoever lands it:

  • Ship bin/omarchy-agent-usage-grok as it is. The panel needs no QML change. A record in the usage directory is a tab.
  • Keep updates.jsonl turn_completed as the ledger. usage.json is a sparse summary and would miss most sessions. Do not also sum usage.json.
  • Child sessions are separate updates.jsonl files and do not share prompt_ids with the parent, so they are counted once. No extra child-session pass is required.
  • The weekly meter is live on SuperGrok Heavy via _x.ai/billing, with the log fallback when that call is empty. Prepaid and on-demand fields staying unmapped is correct.

No further code changes from this machine.

@bjarneo

bjarneo commented Sep 20, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #9498, which covers the same Grok usage collector. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 20, 2026
@Loafer19

Copy link
Copy Markdown

@bjarneo Curious why #9498 won the duplication check over #6485 — from outside it looks like the wrong survivor.

They both add a Grok collector, but they aren’t the same scope:

Your close note says to open a new PR if the merge choice looks wrong. Before anyone does that: can #6485 be reopened and #9498 closed instead? Opening a third Grok collector PR would just make the duplication problem worse.

@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Reopening after review: this PR is the stronger Grok collector (icons, ACP billing meter, review history, live verifications). It becomes the canonical PR for this group instead of #9498.

@Neverdecel

Copy link
Copy Markdown

The weekly meter is the right transport. One gap for people who spend the subscription through omp rather than the Grok CLI: those sessions never write ~/.grok/sessions/*/updates.jsonl, so the tab gets a plan and a meter and empty day/model charts.

omp (and pi) already record this on the same JSONL shape the Claude collector reads. Provider is xai-oauth, model is the grok id, and each assistant message carries usage. On 117 live xai-oauth messages, totalTokens == input + output + cacheRead + cacheWrite exactly. reasoningTokens is already inside one of those buckets, so adding it double-counts.

This is still a collector change, not a plugin. The panel already draws any record in the usage directory.

Patch against scan() in bin/omarchy-agent-usage-grok, next to scan_sessions:

# omp and pi can spend the same xAI subscription without writing a Grok CLI
# transcript. Their JSONL sessions carry provider, model, and token usage on
# every assistant message — the same shape the Claude collector already reads.
XAI_PROVIDERS = {"xai", "xai-oauth", "grok"}


def agent_session_roots() -> list[Path]:
  roots = [
    Path.home() / ".omp" / "agent" / "sessions",
    Path.home() / ".pi" / "agent" / "sessions",
  ]
  extra = os.environ.get("OMP_AGENT_SESSIONS", "").strip()
  if extra:
    roots.append(Path(os.path.expanduser(extra)))
  return roots


def omp_turn_models(message: dict[str, Any]) -> list[tuple[str, int, int, int, int]]:
  usage = message.get("usage") or {}
  if not isinstance(usage, dict):
    return []
  # totalTokens == input + output + cacheRead + cacheWrite on every omp
  # record. reasoningTokens is already inside one of those buckets.
  input_tokens = number(usage.get("input"))
  output_tokens = number(usage.get("output"))
  cache_read = number(usage.get("cacheRead"))
  cache_write = number(usage.get("cacheWrite"))
  if not (input_tokens or output_tokens or cache_read or cache_write):
    total = number(usage.get("totalTokens"))
    if total <= 0:
      return []
    input_tokens = total
  return [(model_name(message.get("model")), input_tokens, output_tokens, cache_read, cache_write)]


def scan_agent_sessions(usage: SessionUsage) -> None:
  for root in agent_session_roots():
    if not root.is_dir():
      continue
    for path in sorted(root.rglob("*.jsonl")):
      session_key = str(path)
      try:
        with path.open(errors="replace") as handle:
          for line_number, raw in enumerate(handle, 1):
            if '"usage"' not in raw or '"assistant"' not in raw:
              continue
            try:
              entry = json.loads(raw)
            except json.JSONDecodeError:
              continue
            message = entry.get("message") if isinstance(entry.get("message"), dict) else {}
            if entry.get("type") != "message" or message.get("role") != "assistant":
              continue
            if str(message.get("provider") or "") not in XAI_PROVIDERS:
              continue
            turn_key = f"{path}:{entry.get('id') or line_number}"
            if turn_key in usage.seen_turns:
              continue
            per_model = omp_turn_models(message)
            if not per_model:
              continue
            usage.seen_turns.add(turn_key)
            usage.add_turn(local_day(entry.get("timestamp")), session_key, per_model)
      except OSError:
        continue
  scan_sessions(usage)
  scan_agent_sessions(usage)

Exact provider match, same rule as the Claude collector: an xai-proxy gateway is not this subscription. Path.home() follows HOME, so the existing scanner test can drop a fixture at $TEST_HOME/.omp/agent/sessions/...jsonl and assert the extra prompts and tokens without touching the updates.jsonl cases.

Verified locally against grok 1.0.41 and omp sessions on xai-oauth / grok-4.7: the record picked up today's tokens and the model row, and the weekly meter was unchanged. The systemd timer I used to feed the stock panel is only a local shim until this collector is in $OMARCHY_PATH/bin. It should not land.

@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
scottjones and others added 4 commits September 29, 2026 09:57
omarchy-agent-usage-grok reads the session transcripts under ~/.grok/sessions
into the shared record contract: one prompt per completed turn however many
models answered it, and the cache figures subtracted from inputTokens so
grok's folded totals do not count the same tokens twice.

Grok publishes no supported way to read its weekly allowance, so the
collector asks the billing endpoint the CLI itself calls, with the token
grok has already cached, and falls back to the reading grok writes to its
own log. A usable reading is a percentage belonging to an open period, and
a closed week's number is the wrong week's, so the meter is omitted rather
than guessed.

Expect it to be omitted for now: grok 1.0.0 stopped reporting the figure.
It answers with the current window and no percentage at all, from the
endpoint and in the log alike, where 0.2.118 carried one in 100 of 102
readings on the same account. The meter returns on its own if xAI publishes
the number again; until then the tab shows tokens only.

The panel needs nothing: the record and the brand marks are enough for the
tab.

Prepaid balance and on-demand overage are untested (both 0 on the identity
this was built against). The failure mode there is a missing meter, not a
wrong number.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Grok answers `_x.ai/billing` over `grok agent stdio`, and that reply carries
both the plan and the weekly percentage. Asking the CLI for it puts the
provider back in charge of its own auth the way the Codex collector does, so
this stops reading the token out of auth.json and stops calling
cli-chat-proxy.grok.com directly. Verified against grok 1.0.5; the ACP call
costs about 0.2s more than the HTTP one, against a 900s refresh.

The log stays as the fallback rather than the source. `_x.ai/billing` is a
vendor extension with no stability promise, and from here a method grok has
renamed looks the same as a grok that is signed out — while the log fallback
matches on a log message, which is the more brittle of the two. The plan and
the meter are filled independently now, so an answer carrying one but not the
other keeps what it gave.

Also correct the notes: the percentage grok 1.0.0 stopped reporting came back
in 1.0.5 and the meter lit up again on its own, so the section no longer says
there is nothing to draw.

Co-Authored-By: Daniel Helm <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The billing reply carries prepaidBalance, onDemandCap and onDemandUsed beside
the percentage, so the reason the panel's balance ledger stays empty is worth
writing down: every account this has been seen on reports 0, and the reply
names no unit, so there is no way to tell credits from dollars from cents at
zero. Guessing the scale would trade a missing balance for a wrong one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A subagent runs in a session directory of its own beside its parent's, and
the scan counted each one as a session someone started, with prompts someone
typed. On one machine that put totalSessions at 33 for 26 sessions actually
opened. The parent names every child in a subagent_spawned record, so those
sessions are now left out of the session and prompt totals. Their tokens
still count: the parent never folds a child's usage into its own turns.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@scottjones
scottjones force-pushed the model-usage-grok-provider branch from c7e5d80 to 1ec3fc9 Compare September 29, 2026 14:14
@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for the thorough work here, including tracking when creditUsagePercent disappears. Grok landed in the agents panel with #13992, reading the same billing document and keeping the meter at 0% with its reset when the percentage is absent. Closing this in favor of it.

@dhh dhh closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.