fix(vscode): show upstream inference cost for OpenRouter BYOK sessions - #13841
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (4 snapshots, latest commit 6e32cd0)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6e32cd0)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit b57e37c)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit cb2326d)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 04ae572)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by grok-4.6 · Input: 50.5K · Output: 9.6K · Cached: 468.5K Review guidance: REVIEW.md from base branch |
iscekic
marked this pull request as draft
September 7, 2026 02:32
iscekic
force-pushed
the
kwf/surface-the-vs-code-extensio-5184
branch
from
September 7, 2026 02:33
04ae572 to
cb2326d
Compare
iscekic
marked this pull request as ready for review
September 7, 2026 02:48
iscekic
marked this pull request as draft
September 7, 2026 02:54
iscekic
force-pushed
the
kwf/surface-the-vs-code-extensio-5184
branch
from
September 7, 2026 02:54
cb2326d to
01f3f7f
Compare
iscekic
force-pushed
the
kwf/surface-the-vs-code-extensio-5184
branch
from
September 7, 2026 02:58
01f3f7f to
d628dd8
Compare
iscekic
force-pushed
the
kwf/surface-the-vs-code-extensio-5184
branch
from
September 7, 2026 03:00
d628dd8 to
b57e37c
Compare
iscekic
marked this pull request as ready for review
September 7, 2026 03:01
chrarnoldus
reviewed
Sep 7, 2026
| // charged to the user's own key. A non-BYOK response always bills at least the | ||
| // upstream cost, so preferring upstream only when it exceeds the billed amount | ||
| // never changes non-BYOK sessions. | ||
| const cost = upstream !== undefined && (isKilo || upstream > (regular ?? -Infinity)) ? upstream : regular |
Collaborator
There was a problem hiding this comment.
I think technically it would have to be upstream+regular for OpenRouter BYOK
chrarnoldus
approved these changes
Sep 7, 2026
iscekic
force-pushed
the
kwf/surface-the-vs-code-extensio-5184
branch
from
September 7, 2026 13:00
6e32cd0 to
3fe90e8
Compare
iscekic
enabled auto-merge (squash)
September 7, 2026 13:01
This was referenced Sep 8, 2026
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.
Request
Changelog for users
usage.cost_details.upstream_inference_cost— the real spend on the user's own provider key — whenever OpenRouter bills the account $0 or only its routing fee for BYOK routing (OpenRouter BYOK sessions always show $0 — providerCost ignores cost_details.upstream_inference_cost #13829).usage.cost, exactly as today.Changelog for maintainers
providerCosthelper now preferscostDetails.upstreamInferenceCostover the billedcostwhenever the upstream figure is strictly greater; previously upstream was preferred only for the Kilo provider. That one expression is the whole fix — start the review there.upstream > regularis false andusage.costis returned untouched; unit tests pin both the BYOK and non-BYOK payload shapes.costDetailsbut no top-levelcost, the new expression (regular ?? -Infinity) now returns the upstream figure, where the old code fell through to the token-based estimate. Only reachable if OpenRouter ever omitscostwhile still reporting cost details; not covered by a test.cost: 0, BYOK wherecostis only the routing fee, non-BYOK unchanged, nocostDetailsunchanged, and the Kilo-provider preference.E2E proof — log excerpts
/Users/igor/.local/share/kwf/sections/surface-the-vs-code-extensio-5184/e2e-cli/e1-baseline.log/Users/igor/.local/share/kwf/sections/surface-the-vs-code-extensio-5184/e2e-cli/e1-packed.log