fix(analytics): report shows lower spending than Claude Code /statusline for the same session - #492
Open
kostiantyn-pshenychnyi1 wants to merge 1 commit into
Open
Conversation
…ine for the same session The statusline displayed the session cost Claude Code calculates and passes in its payload, which CodeMie could not reconcile against tenant billing. CodeMie now computes it from the tenant's own per-token rates served by /v1/llm_models, falling back to Claude Code's value when rates are unavailable. Refs: EPMCDME-14267 Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
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.
Summary
The statusline displayed the session cost Claude Code calculates and passes in its payload — a figure CodeMie could not reconcile against tenant billing. CodeMie now computes it from the tenant's own per-token rates served by
/v1/llm_models, falling back to Claude Code's value when those rates are unavailable.Refs: EPMCDME-14267
Changes
plugin/transcript-cost.mjs— per-model session cost, counting each API response once./v1/llm_models, cached per tenant in~/.codemie/model-prices-cache.json(6h TTL).ai-run-sso,jwt,litellm,bedrock); subscription providers point at the vendor's API, not a CodeMie host.statusline-installer.tsnow generates the deployed script, inlining the cost module — it runs standalone from~/.claudeand cannot import from the package.Testing
Checklist
npm run ci) — unit tests (3120), typecheck, and lint pass locally; fullnpm run cinot run yetmainNotes
codemie analyticsstill prices fromsrc/utils/pricing.json(Anthropic list rates), so on a gateway tenant it reads below the statusline. Follow-up, not in this PR.