Fixes #5144: Add comprehensive test coverage for OpenRouter upstream_inference_cost #5257
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.
Summary
This PR addresses issue #5144 by adding comprehensive test coverage for OpenRouter's
upstream_inference_costfunctionality.Changes
upstream_inference_costupstream_inference_costInvestigation Results
Upon investigation, I found that the OpenRouter implementation was already correctly using
upstream_inference_costin the cost calculation (line 171 insrc/api/providers/openrouter.ts):The implementation also properly handles cached tokens:
Testing
All tests pass, confirming the existing implementation correctly:
upstream_inference_costfor BYOK cost calculationupstream_inference_costis missingThe issue appears to have been resolved in a previous change, and this PR adds the missing test coverage to ensure the functionality is properly validated.
Fixes #5144
Important
Adds comprehensive test coverage for
upstream_inference_costinOpenRouterHandler, ensuring correct cost calculation and token handling.upstream_inference_costfor BYOK cost calculation inopenrouter.spec.ts.upstream_inference_costinopenrouter.spec.ts.openrouter.spec.ts.openrouter.spec.ts.upstream_inference_costis used correctly in cost calculation.This description was created by
for 098ca59. You can customize this summary. It will automatically update as commits are pushed.