File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
webview-ui/src/components/settings Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,14 @@ import { AnthropicHandler } from "./anthropic"
5
5
6
6
export class PearAiHandler extends AnthropicHandler {
7
7
constructor ( options : ApiHandlerOptions ) {
8
+ if ( options . pearaiModelInfo ) {
9
+ options . pearaiModelInfo = {
10
+ ...options . pearaiModelInfo ,
11
+ inputPrice : options . pearaiModelInfo . inputPrice ? options . pearaiModelInfo . inputPrice * 1.03 : 0 ,
12
+ outputPrice : options . pearaiModelInfo . outputPrice ? options . pearaiModelInfo . outputPrice * 1.03 : 0 ,
13
+ }
14
+ }
15
+
8
16
if ( ! options . pearaiApiKey ) {
9
17
vscode . window . showErrorMessage ( "PearAI API key not found." , "Login to PearAI" ) . then ( async ( selection ) => {
10
18
if ( selection === "Login to PearAI" ) {
Original file line number Diff line number Diff line change @@ -1627,12 +1627,23 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) {
1627
1627
supportsImages : false , // VSCode LM API currently doesn't support images
1628
1628
} ,
1629
1629
}
1630
- case "pearai" :
1630
+ case "pearai" : {
1631
+ // Get the base Anthropic model info
1632
+ const baseModelInfo = anthropicModels [ anthropicDefaultModelId ]
1633
+ // Create PearAI model info with 1.03x price multiplier
1634
+ const pearaiModelInfo : ModelInfo = {
1635
+ ...baseModelInfo ,
1636
+ inputPrice : baseModelInfo . inputPrice * 1.03 ,
1637
+ outputPrice : baseModelInfo . outputPrice * 1.03 ,
1638
+ cacheWritesPrice : baseModelInfo . cacheWritesPrice ? baseModelInfo . cacheWritesPrice * 1.03 : undefined ,
1639
+ cacheReadsPrice : baseModelInfo . cacheReadsPrice ? baseModelInfo . cacheReadsPrice * 1.03 : undefined ,
1640
+ }
1631
1641
return {
1632
1642
selectedProvider : provider ,
1633
- selectedModelId : apiConfiguration ?. pearaiModelId || "pearai_model" ,
1634
- selectedModelInfo : apiConfiguration ?. pearaiModelInfo || openAiModelInfoSaneDefaults ,
1643
+ selectedModelId : apiConfiguration ?. pearaiModelId || anthropicDefaultModelId ,
1644
+ selectedModelInfo : apiConfiguration ?. pearaiModelInfo || pearaiModelInfo ,
1635
1645
}
1646
+ }
1636
1647
case "unbound" :
1637
1648
return getProviderData ( unboundModels , unboundDefaultModelId )
1638
1649
default :
You can’t perform that action at this time.
0 commit comments