Skip to content

Reuse recently confirmed LiteLLM pricing instead of refreshing on every run #1968

Closed

Description

@liuzemei

What do you want to change?

Let online runs price from the cached LiteLLM response, the existing ETag cache, when the server confirmed it recently. A run would go to the network only when that cache is stale or has no entry for a model the report needs:

  • Confirmed within the last hour: no request.
  • Confirmed within the last day: refresh once, on the first model the cache cannot price exactly.
  • Older or missing: refresh up front, as today.

--offline stays as it is.

Why?

Every online run still waits on a LiteLLM round trip, and a unified ccusage daily makes 4 of them. On my machine that adds about 0.4 to 0.7 seconds to each run. This is the same ask as #1412 and #1627.

How? (optional)

I have it implemented and tested on my fork: main...liuzemei:ccusage:perf/cache-first-litellm-pricing

On my own Claude Code and Codex logs, per-model costs match an online run exactly. I'd like to open it as a PR if this direction works for you.

Activity

  1. pullfrog commented on Oct 25, 2026

    @pullfrog
    Contributor
  2. added
    enhancementNew feature or request
    priority:mediumA normal bug or meaningful improvement.
    triage:maintainableFits the repository's maintainable scope and needs review.
    on Oct 25, 2026
  3. added
    priority:lowMinor polish, documentation, or a low-impact edge case.
    triage:excludedExcluded from the current maintenance scope.
    and removed
    priority:mediumA normal bug or meaningful improvement.
    triage:maintainableFits the repository's maintainable scope and needs review.
    on Oct 25, 2026
  4. github-actions commented on Oct 25, 2026

    @github-actions
    Contributor

    Pullfrog triage: priority:low
    Kind: feature request
    Maintenance fit: excluded
    Confidence: high

    Requests cache-first LiteLLM pricing to save 0.4-0.7s per run. This is a performance enhancement, not a defect, with no maintainer endorsement, so excluded by default. Prior similar issues were auto-closed minutes after filing and remain unimplemented, so this is not a duplicate.

    Decision: closed by the contribution gate.

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

    enhancementNew feature or requestpriority:lowMinor polish, documentation, or a low-impact edge case.triage:excludedExcluded from the current maintenance scope.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions