Skip to content

Fix LiteLLM cost model resolution - #1069

Merged
0xallam merged 1 commit into
mainfrom
devin/1786471276-litellm-cost-model-resolution
Aug 12, 2026
Merged

Fix LiteLLM cost model resolution#1069
0xallam merged 1 commit into
mainfrom
devin/1786471276-litellm-cost-model-resolution

Conversation

@bearsyankees

Copy link
Copy Markdown
Collaborator

No description provided.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds provider-qualified LiteLLM model resolution and revises usage accounting to prefer observed costs over local estimates without counting both.

  • Adds cached model-name normalization and pricing-table resolution.
  • Uses resolved model names for callback and SDK usage estimates.
  • Separates observed and estimated cost accumulators and preserves cost across hydration.
  • Adds tests for model resolution, routed-provider estimates, observed-cost precedence, hydration, and zero-cost runs.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The new resolver preserves provider-qualified entries, declines ambiguous suffix matches, and the revised ledger avoids adding observed and estimated representations of the same calls while retaining persisted historical cost.

Important Files Changed

Filename Overview
strix/report/pricing.py Adds defensive, cached resolution from configured model identifiers to unambiguous provider-qualified LiteLLM pricing keys.
strix/report/state.py Resolves callback model candidates before asking LiteLLM to estimate otherwise unavailable response costs.
strix/report/usage.py Separates observed and estimated totals, uses resolved pricing names, and restores persisted aggregate cost for resumed runs.
tests/test_cost_tracking.py Updates the callback fallback expectation to use the provider-qualified LiteLLM model name.
tests/test_pricing.py Covers representative resolution, ambiguity, observed-cost precedence, hydration, routed estimates, and zero-cost behavior.

Reviews (1): Last reviewed commit: "Fix LiteLLM cost model resolution" | Re-trigger Greptile

@0xallam
0xallam merged commit 8ca0c4a into main Aug 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants