Skip to content

Claude cost estimates stay at US$0.00+ and Codex Today/Week totals stay at zero #664

Description

@MoFeng2223

Summary

While validating #663, I found two separate compatibility problems in the local usage statistics. They are grouped here because both affect the token/cost rows below the subscription quota gauges.

1. Claude Code tokens are counted, but the monetary estimate stays at US$0.00+

Actual behavior

The Claude card can show millions of tokens for Today, Week, and Session, while every cost value remains US$0.00+.

Root cause

Claude usage is read from local ~/.claude/projects/**/*.jsonl logs, but pricing uses an exact model-ID lookup. Current logs can contain newer IDs such as:

  • claude-opus-4-6
  • claude-opus-4-8
  • claude-opus-5
  • claude-sonnet-5
  • claude-haiku-4-5-20251001
  • provider-prefixed IDs such as anthropic/claude-4.8-opus-20260528

The bundled pricing table contains only a small set of older IDs, and several entries have no numeric prices. ModelPricingManager requires an exact key match, so these models return no cost. The aggregator then sets hasUnpricedModel = true, keeps the numeric total at zero, and the UI renders US$0.00+.

Expected behavior

  • Normalize or alias current Claude model IDs before pricing.
  • Keep pricing data current and test newer/provider-prefixed model IDs.
  • If no trustworthy price exists, show an explicit unavailable/partial estimate instead of a misleading zero.
  • Clarify that this is an API-equivalent estimate from local tokens, not actual Claude subscription billing.

2. Codex Today/Week totals stay at zero despite real session usage

Actual behavior

Codex's subscription quota gauge works, but Today and Week remain zero even after active Codex sessions.

Root cause

CodexUsageProvider scans ~/.codex/sessions/**/*.jsonl, but JSONLUsageParser currently recognizes only top-level usage or message.usage payloads.

Current Codex logs record token updates in events shaped like:

type: "event_msg"payload.type: "token_count"payload.info.last_token_usage / payload.info.total_token_usage

Because that shape is not parsed, the provider finds the files but produces zero totals.

Expected behavior

  • Parse modern event_msg/token_count records.
  • Prefer per-event last_token_usage deltas, or safely derive deltas from cumulative totals without double counting.
  • Preserve the intended windows: current calendar day for Today, rolling seven days for Week, and rolling five hours for Session.
  • Add sanitized tests for current Codex JSONL shapes and cumulative-counter resets.

Notes

The Claude/Codex token and cost rows are local usage statistics. They are separate from the subscription quota bars returned by Anthropic/OpenAI endpoints.

No raw logs, prompts, account identifiers, credentials, or exact private usage data are included in this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions