copilot: Display cost multiplier for Github Copilot models #44800
+105
−16
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.
Description
Display cost multiplier for GitHub Copilot models in the model selectors (Both in Chat Panel and Inline Assistant)
Some technical notes
Although this PR's primary intent is to show the cost multiplier for GitHub Copilot models alone, I have included some necessary plumbing to allow specifying costs for other providers in future. I have introduced an enum called
LanguageModelCostInfofor showing cost in different ways for different models. Now, this enum is used inLanguageModeltrait to get the cost info.For now to begin with, in
LanguageModelCostInfo, I have specified two ways of pricing: Request-based (1 Agent request - GitHub Copilot uses this) and Token-based (1M Input tokens / 1M Output tokens). I had initially thought about adding aFreetype, especially for Ollama but didn't do it after realizing that Ollama has paid plans.Release Notes: