Skip to content

Conversation

@d-oit
Copy link
Contributor

@d-oit d-oit commented Apr 15, 2025

Context

Update cost display logic to only show costs when they are greater than zero. This improves the user interface by hiding the cost display when there are no costs to report, reducing visual clutter in the task header.

image
if one of the API Provider is selected the ApiCost > 0 is not visible in the TaskHeader

const isCostAvailable = useMemo(() => {
return (
apiConfiguration?.apiProvider !== "openai" &&
apiConfiguration?.apiProvider !== "ollama" &&
apiConfiguration?.apiProvider !== "lmstudio" &&
apiConfiguration?.apiProvider !== "gemini"
)
}, [apiConfiguration?.apiProvider])

As a result, I always what to see the current cost of a task.

Improve Cost Display Logic: Hide Zero Costs, Show Valid Prices for All Providers

Implementation

Always show the task cost if greater then 0 in the Task Header.

  • add "free tier" ui option. set the price to 0 for all free tier api post.

open AI already as the ui option for the price.

  • add unit test for the API cost

Screenshots

before after
image

How to Test

  • Create a google gemini api provider with active "free tier"
  • Create a second gemini api provider with "free tier" = false
  1. Ask mode with the google gemini api provider with active "free tier" -> No API cost in the TaskHeader visible
  2. Ask with the google gemini api provider with "free tier" = true -> API cost in the TaskHeader visible

Get in Touch

discord :d_oit


Important

Improve task header cost display logic to show costs only when greater than zero and add 'free tier' option for Gemini API.

  • Behavior:
    • Update cost display logic in TaskHeader.tsx to show costs only when greater than zero.
    • Add 'free tier' option for Gemini API, setting cost to zero for free tier posts.
  • Implementation:
    • Modify Cline.ts to check for Gemini free tier before calculating cost.
    • Update ProviderSettingsManager.ts to handle boolean values correctly during serialization.
  • Tests:
    • Add unit tests in TaskHeader.test.tsx to verify cost display logic.
    • Add tests in ProviderSettingsManager.test.ts to ensure boolean values are preserved.
  • UI:
    • Add checkbox for 'free tier' in ApiOptions.tsx.
    • Update ModelInfoView.tsx to reflect free tier pricing.
  • Localization:
    • Add translations for 'use free tier' in multiple language files.

This description was created by Ellipsis for 7df5d1f. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 15, 2025

⚠️ No Changeset found

Latest commit: b3ecf4c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@d-oit d-oit marked this pull request as ready for review April 15, 2025 15:15
@d-oit d-oit requested review from cte and mrubens as code owners April 15, 2025 15:15
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 15, 2025
@ellipsis-dev
Copy link
Contributor

ellipsis-dev bot commented Apr 15, 2025

The pull request includes a variety of changes, such as feature additions, refactoring, and localization updates. To make the review process easier, I suggest splitting the localization changes into a separate pull request from the core feature changes related to the Gemini free tier. This will help reviewers focus on the core functionality changes without being distracted by the localization updates. Thank you!

@dosubot dosubot bot added the enhancement New feature or request label Apr 15, 2025
@d-oit d-oit closed this Apr 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant