Skip to content

Conversation

mechanicmuthu
Copy link

@mechanicmuthu mechanicmuthu commented Aug 13, 2025

Related GitHub Issue

Closes: #

Roo Code Task Context (Optional)

Description

Test Procedure

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Documentation Updates

Additional Notes

Get in Touch


Important

Adds support for flexible pricing tiers in OpenAI cost calculations and updates UI components to handle service tier selection.

  • Behavior:
    • Adds support for flexible pricing tiers ("flex") in calculateApiCostOpenAI() in cost.ts.
    • Updates calculateApiCostOpenAI() to use flexPrice if serviceTier is "flex".
    • Adds flexPrice to ModelInfo in model.ts and providers/openai.ts.
  • UI Components:
    • Adds ServiceTier component in ServiceTier.tsx to select pricing tier.
    • Updates ApiOptions.tsx and ModelInfoView.tsx to display and handle service tier selection.
    • Updates ModelPicker.tsx to integrate service tier selection.
  • Tests:
    • Adds tests for calculateApiCostOpenAI() with flex pricing in cost.spec.ts.
  • Misc:
    • Updates i18n strings in settings.json for service tier descriptions.

This description was created by Ellipsis for 7c16a04. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 13, 2025
Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found several issues that need attention before this can be merged.

The main concerns are:

  1. Missing linked GitHub issue (required by contribution guidelines)
  2. Unrelated changes mixed with the flex pricing feature
  3. Debug code left in production
  4. Type safety issues that should be addressed

Please see my inline comments for specific suggestions.


const isSupported = useMemo(() => {
const supported = !!effectiveModelId && FLEX_COMPATIBLE_MODELS.some((m) => effectiveModelId.includes(m))
console.log("[DEBUG] Service tier supported check:", { effectiveModelId, supported, FLEX_COMPATIBLE_MODELS })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log should be removed from production code. Consider using a proper logging utility if debugging is needed during development.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed.

): number {
const cacheCreationInputTokensNum = cacheCreationInputTokens || 0
const cacheReadInputTokensNum = cacheReadInputTokens || 0
const nonCachedInputTokens = Math.max(0, inputTokens - cacheCreationInputTokensNum - cacheReadInputTokensNum)

// If flex tier selected and model exposes flexPrice, override pricing fields.
const pricingInfo =
serviceTier === "flex" && (modelInfo as any).flexPrice
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of 'as any' bypasses TypeScript's type safety. Could we properly type the flexPrice property in the ModelInfo interface instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed.

@@ -91,7 +91,6 @@ export function Features() {
y: 0,
transition: {
duration: 0.6,
ease: [0.21, 0.45, 0.27, 0.9],
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These animation easing changes seem unrelated to the flex pricing feature. Could these be moved to a separate PR to keep this one focused on a single feature?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are in fact unrelated. These were causing compile errors for me. These cane be removed or ignored.

@@ -16,6 +16,11 @@ export const openAiNativeModels = {
inputPrice: 1.25,
outputPrice: 10.0,
cacheReadsPrice: 0.13,
flexPrice: {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flexPrice object is missing cacheWritesPrice. Is this intentional, or should it include all pricing fields for consistency?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenAI does not charged extra for CacheWrite. Check with the pricing of other OpenAI api model pricing, if cache write price is included, then inputPrice can be considered as cachWritesPrice, otherwise if these are not maintained for other openai models, then it can be safely ignored here.

@@ -1590,7 +1590,7 @@ export class McpHub {
)
}
if (connection.server.disabled) {
throw new Error(`Server "${serverName}" is disabled and cannot be used`)
throw new Error(`Server \"${serverName}\" is disabled and cannot be used`)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The escaped quotes here are unnecessary since you're using double quotes for the string. This would be cleaner:

Server "" is disabled and cannot be used

Actually, looking at this again, the escaping is correct for the error message. Please disregard this comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. These should be removed.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 13, 2025
@mechanicmuthu
Copy link
Author

Create a new branch and a fresh clean pull request. CLosing this. Refer to PR 7079. CLosing this.

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 14, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 14, 2025
@mechanicmuthu mechanicmuthu deleted the flex-working1 branch August 14, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants