Skip to content

[Bug]: Usage cost by provider does not sum multiple instances of the same provider #24039

Closed as not planned

Description

@Dwite

Area

apps/server, apps/web

Steps to reproduce

  1. Configure two or more instances of the same driver (here: Claude), each used for real work in the selected date range.
  2. Open the Usage page and switch the metric to cost.
  3. Compare the provider row for that driver (for example "Claude Code") with the cost of each instance's own transcripts.

Not yet reduced to a deterministic repro: reported from a live setup.

Expected behavior

The provider row shows the sum of cost across all instances of that driver.

Actual behavior

The provider row does not add up the usage of the multiple instances of the same provider. The total is lower than the sum of the instances. How much lower, and whether only one instance counts, was not measured.

Impact

Minor to major: the cost figure and its share of total cost are wrong for anyone who runs several accounts of one provider, which is the case multi-instance support is built for.

Environment

macOS, two Claude instances. App version not recorded. Code read against main @ d7a8d6f.

Suspected area (unverified)

Not confirmed. Places worth checking first:

  • apps/server/src/usage/UsageService.ts resolveTranscriptDirs: one transcript directory per instance, skipped when provider + realpath(dir) was already seen. Instances that resolve to the same directory count once. The directory comes from homePath, then CLAUDE_CONFIG_DIR, then ~/.claude (apps/server/src/provider/Drivers/claudeUsage.ts).
  • apps/server/src/usage/usageAggregation.ts drops records with a repeated dedupeKey, so overlapping or copied transcript folders lose records.
  • apps/web/src/components/usage/UsagePage.tsx (provider rows) reads merged.providers.find(entry.provider === provider), so totals group by driver kind, not by instance. Check that the merge keeps every instance's totals.

A server test with two Claude instances that have separate homePath values and different transcripts would show which layer drops the cost.

Activity

  1. juliusmarminge commented on Oct 23, 2026

    @juliusmarminge
    Member

    Tested the web Usage → Cost page on Linux at 66ee628e08, using two Claude instances with separate homePath directories containing two disjoint real transcripts, over the same 30-day window. After refreshing: instance A alone showed $0.53 (1 session), B alone $0.17 (1 session), and both together $0.70 (2 sessions). This did not reproduce the undercount.

    Please provide the affected app version, selected date range, each instance’s measured expected cost versus the displayed Claude total, and whether their homePath/CLAUDE_CONFIG_DIR values resolve to separate directories. An anonymized pair of transcript usage records that should both count would help distinguish missing-instance scanning from repeated-message deduplication. Remove credentials and message content.

  2. added
    needs more info
    on Oct 23, 2026
  3. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor

    Closing: no reply in 7 days after we asked for more information. Comment with the missing details and we will reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions