Repository navigation
Claude collector: attribute pi usage by provider, not api prefix - #6655
Merged
dhh merged 1 commit intoAug 9, 2026
Merged
Conversation
Pi/omp sessions kept falling into the Claude record when the api field merely started with 'anthropic'. Kimi and other providers that speak the anthropic-messages protocol (kimi-coding) were therefore charged against Claude Code, showing k3 buckets under a Claude tab even for a user without a Claude login. Match the codex collector's provider-only attribution: only sessions whose provider is exactly 'anthropic' count toward Claude usage. Add a test proving a kimi-coding session sharing the anthropic-messages api does not land in the Claude record.
Contributor
There was a problem hiding this comment.
Pull request overview
Restricts Claude usage attribution to sessions explicitly using the Anthropic provider, preventing compatible third-party APIs from appearing as Claude usage.
Changes:
- Removes API-prefix fallback attribution.
- Adds regression coverage for Kimi sessions using the Anthropic protocol.
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 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-agent-usage-claude |
Requires the exact anthropic provider. |
test/shell.d/agent-usage-claude-scanner-test.sh |
Verifies Kimi usage is excluded. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dalmasluca
pushed a commit
to dalmasluca/omarchy
that referenced
this pull request
Aug 9, 2026
Pi/omp sessions were attributed to Codex when the api field merely started with 'openai-codex'. A third-party router that serves the same gpt models behind an openai-codex-style api was therefore charged to this subscription and added its buckets to the Codex record. Keep attribution strict to the provider, matching the codex scanner guidance and the Claude collector fix (omacom#6655): only sessions whose provider is exactly 'openai-codex' count. Add a regression test where a third-party-router session using the openai-codex-responses api must not land in the Codex record.
nick1udwig
pushed a commit
to nick1udwig/omarchy
that referenced
this pull request
Sep 9, 2026
…com#6655) Pi/omp sessions kept falling into the Claude record when the api field merely started with 'anthropic'. Kimi and other providers that speak the anthropic-messages protocol (kimi-coding) were therefore charged against Claude Code, showing k3 buckets under a Claude tab even for a user without a Claude login. Match the codex collector's provider-only attribution: only sessions whose provider is exactly 'anthropic' count toward Claude usage. Add a test proving a kimi-coding session sharing the anthropic-messages api does not land in the Claude record. Co-authored-by: Luca <luca@itwasarch>
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
The Claude usage tab shows buckets for models that are not Claude at all.
On a machine without a Claude login, the bar still appeared with Kimi k3 / k3-256k values under the "Claude Code" label, charged entirely from local pi sessions.
Root cause
omarchy-agent-usage-claude's pi/omp scan included any session whoseapifield merely started withanthropic:Kimi and other providers that speak the
anthropic-messagesprotocol (provider: kimi-coding,api: anthropic-messages) were therefore attributed to Claude Code. Since the panel shows anything wheretotalPrompts > 0, a non-logged-in Claude still rendered a tab full of foreign models.Falling back to
apialso risked counting a third-party router that presents an anthropic-style api but is not this subscription — the same class of bug the codex collector already avoids by matchingprovider == "openai-codex"exactly.Change
Match the codex collector's provider-only attribution: count a pi/omp session toward Claude usage only when
provider == "anthropic".Test
Adds a case to
agent-usage-claude-scanner-test.sh: akimi-coding-provider session usingapi: anthropic-messages(modelk3) must be excluded from the Claude record, keeping.todayTotalTokens == 49and.modelUsagefree of thek3bucket.