Repository navigation
feat: add tiered pricing for gemini-2.5-pro - #2741
Conversation
|
There was a problem hiding this comment.
❌ Changes requested. Reviewed everything up to f5a9949 in 2 minutes and 59 seconds
More details
- Looked at
246lines of code in3files - Skipped
0files when reviewing. - Skipped posting
6drafted comments based on config settings.
1. src/utils/cost.ts:15
- Draft comment:
Assumes tiers are sorted in ascending order by tokenLimit. Consider verifying/sorting them to ensure correct tier lookup. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
The comment identifies a real potential issue - unsorted tiers could lead to incorrect pricing. However, this seems like something that should be validated when creating/setting the tiers, not every time we look them up. The comment also doesn't provide clear direction on where/how to implement the validation.
The issue could be serious if it leads to incorrect pricing. The suggestion to sort tiers could be a valid solution.
While pricing correctness is important, this validation belongs at the data layer where tiers are defined/loaded, not in the cost calculation function. The current comment location puts the fix in the wrong place.
Delete the comment because it suggests adding validation in the wrong place and doesn't provide clear, actionable guidance.
2. webview-ui/src/components/settings/ApiOptions.tsx:1608
- Draft comment:
The tiered pricing rendering code assumes inputPriceTiers (and similarly outputPriceTiers) are provided in the expected sorted order. Consider adding a comment or safeguard if order isn’t guaranteed. - Reason this comment was not posted:
Comment looked like it was already resolved.
3. src/utils/cost.ts:15
- Draft comment:
The non-null assertion on totalInputTokensForPricing is safe due to the preceding check, but consider omitting '!' for clarity. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%
None
4. webview-ui/src/components/settings/ApiOptions.tsx:1564
- Draft comment:
Avoid hard-coding the callback URL domain ('saoudrizwan.claude-dev') in getOpenRouterAuthUrl; consider externalizing or parameterizing for production use. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. webview-ui/src/components/settings/ApiOptions.tsx:1605
- Draft comment:
The check for Gemini models uses Object.keys(geminiModels).includes(selectedModelId). Using the provider value (e.g. selectedProvider === 'gemini') might be more robust. - Reason this comment was not posted:
Comment was on unchanged code.
6. webview-ui/src/components/settings/ApiOptions.tsx:1577
- Draft comment:
The tier formatting helper (formatTiers) is well written; consider memoizing its result if the tiers rarely change, to optimize re-renders. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%
None
Workflow ID: wflow_U6EcK3Y5j56HvT7K
Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
- Clarify token limit display using full numbers instead of 'k'. - Specify price unit as '/million tokens' for better understanding.
|
thank you 🙏 |
* feat: add tiered pricing for gemini-2.5-pro * fix: ensure price tiers are sorted before lookup * refactor: remove old prices * refactor(settings): improve model tier pricing display clarity - Clarify token limit display using full numbers instead of 'k'. - Specify price unit as '/million tokens' for better understanding.
Description
This PR introduces tiered pricing calculation and display for the
gemini-2.5-pro-preview-03-25model based on input token count.Changes:
src/shared/api.ts:PriceTierinterface.ModelInfoto include optionalinputPriceTiersandoutputPriceTiersarrays.gemini-2.5-pro-preview-03-25definition to use these tiers, reflecting the $1.25/$2.50 input and $10.00/$15.00 output pricing based on a 200k input token threshold.src/utils/cost.ts:calculateApiCostInternalto determine effective input/output prices based on tiers if available, using a newtotalInputTokensForPricingparameter.calculateApiCostOpenAIto pass the total input tokens for tier lookup.webview-ui/src/components/settings/ApiOptions.tsx:ModelInfoViewto display tiered pricing clearly, with each tier on a new indented line.<span>andFragmentfor better layout and spacing control.Test Procedure
gemini-2.5-pro-preview-03-25model.Type of Change
Pre-flight Checklist
npm test) and code is formatted and linted (npm run format && npm run lint) (Based on pre-commit hook success)npm run changeset(Required for user-facing changes - Please run this if needed)Screenshots
Final UI showing tiered pricing for Gemini model in settings.

Additional Notes
This change generalizes the pricing structure to support future models with tiered costs.