feat: Cost Display in Task Header - Suppress Zero Cost Values and Ensure Visibility for Gemini, OpenAI, LM Studio, and Ollama #2638
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.
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.
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.
open AI already as the ui option for the price.
Screenshots
How to Test
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.
TaskHeader.tsxto show costs only when greater than zero.Cline.tsto check for Gemini free tier before calculating cost.ProviderSettingsManager.tsto handle boolean values correctly during serialization.TaskHeader.test.tsxto verify cost display logic.ProviderSettingsManager.test.tsto ensure boolean values are preserved.ApiOptions.tsx.ModelInfoView.tsxto reflect free tier pricing.This description was created by
for 7df5d1f. It will automatically update as commits are pushed.