You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenCode provider double-counts Claude Code usage when Claude Code runs through OpenCode (e.g. OpenChamber) #443
When Claude Code is driven through an OpenCode-based wrapper such as OpenChamber, every request is counted twice: once by the Claude Code provider and once by the OpenCode provider.
The wrapper runs OpenCode's session engine with a claude-code provider that delegates the work to Claude Code. So each request ends up in two places:
Claude Code's own logs under ~/.claude/projects/**/*.jsonl, read by the Claude Code provider.
OpenCode's database (opencode.db), where the assistant message is stored with providerID = "claude-code", read by the OpenCode provider.
The OpenCode provider has no way to know that second copy is the same usage Claude Code already logged, so the daily total is inflated by roughly the full Claude Code volume.
Evidence
Measured on one day of mixed use (OpenChamber with the claude-code provider, plus a little native OpenCode):
Source
Tokens
Poke Token Bar, Claude Code
~220M
Poke Token Bar, OpenCode
~216M
Claude Code logs, recomputed (deduped by message id + request id)
~220M
opencode.db assistant rows with providerID = "claude-code"
~218M
opencode.db assistant rows from native OpenCode providers
~3M
About 98% of the "OpenCode" total is the mirror of Claude Code usage that is already counted under Claude Code.
Expected
Claude Code usage is counted once. OpenCode only reports usage that Claude Code's own logs don't already contain.
Proposed fix
Skip OpenCode rows whose providerID is claude-code in the OpenCode reader (both the V2 session_message rows and the legacy message rows). Claude Code is still counted in full by its own provider, so nothing is lost. I'll open a PR with this and a regression test.
Activity
fix(opencode): skip claude-code mirror rows already counted by Claude…
Isolate test runs from every app-support store, plus the SP4 port spe…