Repository navigation
test(decisions): bill the OpenAI-format openrouter case from provider-reported cost - #45853
Merged
mateo-berri merged 1 commit intoOct 10, 2026
Merged
Conversation
…-reported cost PR #45667 removed openrouter/typesafe/jev-1.13 from the cost map after #45640 moved OpenRouter decisions billing to usage.cost. The OpenAI-format wire test still read the removed row and raised KeyError on CircleCI integration-providers Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
|
bugbot run |
Contributor
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 30c4f8f. Configure here.
8 of 17 tasks
mateo-berri
deleted the
litellm_circleci_heal_openrouter_decisions_cost
branch
October 10, 2026 21:47
Merged
19 of 21 tasks
DeoLeung
pushed a commit
to aiyou178/litellm
that referenced
this pull request
Oct 11, 2026
…-reported cost (BerriAI#45853) PR BerriAI#45667 removed openrouter/typesafe/jev-1.13 from the cost map after BerriAI#45640 moved OpenRouter decisions billing to usage.cost. The OpenAI-format wire test still read the removed row and raised KeyError on CircleCI integration-providers Co-authored-by: mateo <mateo@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 5894968)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
integration-providersis red onmainin every scheduled runHow it solves it:
usage.costOpenRouter reportstest_decisions_wire.pyalready uses since fix(openrouter): bill Responses, Decisions and pass-through from OpenRouter usage.cost, always allow reasoning params #45640User Flow
Before: a maintainer reading the scheduled CircleCI run on
mainseesintegration-providersred with aKeyErrorintegrationworkflow, for example pipeline 91107 or pipeline 91085test_decisions_openai_format_wire.py::test_each_provider_gets_its_own_path_key_and_body_and_is_billed_from_the_cost_map[openrouter]fails withKeyError: 'openrouter/typesafe/jev-1.13'After: the same job runs the openrouter case against the billing OpenRouter actually uses and it passes
integrationworkflow triggered on this branch, linked under Proof of Fixtest_each_provider_gets_its_own_path_key_and_body_and_is_billed[openrouter]passes and asserts the spend equals the reportedusage.costPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
The culprit is ed22fd9 from #45667, which removed 139
openrouter/*rows from the cost map,openrouter/typesafe/jev-1.13among them. #45640 had already moved OpenRouter decisions billing to the provider-reportedusage.costand updatedtest_decisions_wire.py, but the OpenAI-format sibling keptcost_map_key="openrouter/typesafe/jev-1.13", so_expected_spendraisedKeyErrorbefore the request was even sentThe fix gives the OpenAI-format
_Provideraprovider_reported_cost, has the fake upstream return it inusage.cost, and asserts the gateway bills exactly that amount. The client-facing response shape is unchanged. Mutation check: reading a nonexistent usage key inOpenRouterDecisionsConfig.provider_reported_costmakes the test fail withisclose(0.0, 1.5834e-05)This is a test-only change, so the proof is CircleCI on this branch, triggered manually since CircleCI does not run on PRs. Pipeline 91128 at 30c4f8f is running
Type
✅ Test
Caveats (if any)
Medium
mainare deferred to the next runintegration-managementand-replica, Databricks classifier rename burst testintegration-managementand-replica,test_disable_lazy_routes_flag_serves_config_declared_features_like_the_warmed_lazy_proxyLITELLM_DISABLE_LAZY_ROUTES=truethe configured/langfuse/{subpath:path}lands ahead of its/langfusesibling, so the eager table no longer matches the warmed lazy oneintegration-extensions,test_eh_provider_passthrough_routes_classify_effective_streaming[gemini-generate]and[gemini-stream]/gemini/v1beta/modelspass-through, which now outranks the built-in Gemini route and answers 500, so whether the test or fix(proxy): let configured pass-through endpoints outrank built-in provider prefix routes #44133 should move is a product callintegration-providersGemini TTS and Databricks megabyte-endpoint timing testsintegration-accounting,integration-extensionsandintegration-mcpworker-kill chaos testsschema-migrationtiming out at about 97% in pipeline 91122Final Attestation
Link to Devin session: https://app.devin.ai/sessions/5076c6a4aaa74a2e88f5402c2b54b8c2
Open in Devin Desktop: https://app.devin.ai/desktop/session/5076c6a4aaa74a2e88f5402c2b54b8c2?variant=devin
Note
Low Risk
Test-only change to integration expectations; no production billing or gateway logic modified.
Overview
Fixes failing OpenAI-format decisions integration billing for OpenRouter after
openrouter/*rows were removed from the cost map.The wire test’s
_Providerhelper now supportsprovider_reported_cost: mocked upstreamusagecan includecost, and_expected_spendprefers that value over the cost-map lookup. The OpenRouter case setscost_map_keytoNone, usesprovider_reported_cost=1.5834e-5, and the parametrized billing test asserts gateway spend matches that reported cost—matchingtest_decisions_wire.py.Reviewed by Cursor Bugbot for commit 30c4f8f. Bugbot is set up for automated code reviews on this repo. Configure here.