Skip to content

ccusage hermes reports $0 cost when Hermes session uses subscription billing #1112

Closed

Description

@liuzemei

What happened?

Every row of ccusage hermes daily shows $0.00 even though token counts are clearly non‑zero. In my case ccusage sums to 10.2M input / 790K output / 267M cache‑read tokens (model gpt-5.5) but the cost column is $0 for every day.

Tracing it down: ccusage reads estimated_cost_usd / actual_cost_usd from Hermes' state.db. When Hermes is pointed at a subscription endpoint (in my config: provider: openai-codex → base_url: https://chatgpt.com/backend-api/codex), Hermes intentionally writes estimated_cost_usd = 0.0, actual_cost_usd = NULL, billing_mode = subscription_included, because those tokens are covered by the user's ChatGPT Plus/Pro subscription rather than metered.

calculate_hermes_cost in rust/crates/ccusage/src/adapter/hermes.rs short-circuits on Some(cost) regardless of whether the recorded cost is zero, so it returns 0.0 and never falls through to pricing-based calculation. The codex adapter doesn't have this short‑circuit and prices the same gpt-5.5 model correctly — ccusage codex daily shows a real dollar amount for the same model on my machine, while ccusage hermes daily shows $0.00.

Steps to reproduce

  1. Run Hermes against the ChatGPT subscription endpoint (provider: openai-codex, base_url: https://chatgpt.com/backend-api/codex) so it writes estimated_cost_usd = 0.0 with billing_mode = subscription_included into ~/.hermes/state.db.
  2. Accumulate non‑zero token usage on a model that exists in ccusage's pricing table, e.g. gpt-5.5.
  3. ccusage hermes daily --offline. Every row shows $0.00.
  4. Compare with ccusage codex daily for the same gpt-5.5 model — it shows a real cost.

Expected behavior

If a Hermes session's recorded cost is zero but it has non‑zero token usage, ccusage should fall back to pricing‑based calculation (the same path the codex adapter uses), so the user still sees a meaningful cost number. A recorded positive cost should still be trusted as is.

Version

20.0.1


I have a fix ready (very small change to calculate_hermes_cost + two regression tests; full crate cargo test passes 219/219). Happy to open the PR once approved.

Activity

  1. github-actions commented on May 21, 2026

    @github-actions
    Contributor

    This issue was auto-closed. Issues from new contributors are auto-closed by default.

    Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.

    Keep the issue short, concrete, and written in your own voice.

    If a maintainer replies lgtmi, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open.

    See CONTRIBUTING.md.

  2. added a commit that references this issue on May 21, 2026
    95d9a9f
  3. ryoppippi commented on Aug 31, 2026

    @ryoppippi
    Member

    Historical audit: this discussion was auto-closed by the legacy contributor gate. That closure did not assess technical importance.

    Audit result: resolved. A later merged change or the current main implementation covers this request. This item is kept for history and does not need to be reopened.

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

    triage:resolvedResolved by a later change or current implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions