File tree Expand file tree Collapse file tree
webview-ui/src/components/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,14 @@ import { AnthropicHandler } from "./anthropic"
55
66export class PearAiHandler extends AnthropicHandler {
77 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+
816 if ( ! options . pearaiApiKey ) {
917 vscode . window . showErrorMessage ( "PearAI API key not found." , "Login to PearAI" ) . then ( async ( selection ) => {
1018 if ( selection === "Login to PearAI" ) {
Original file line number Diff line number Diff line change @@ -1627,12 +1627,23 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration) {
16271627 supportsImages : false , // VSCode LM API currently doesn't support images
16281628 } ,
16291629 }
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+ }
16311641 return {
16321642 selectedProvider : provider ,
1633- selectedModelId : apiConfiguration ?. pearaiModelId || "pearai_model" ,
1634- selectedModelInfo : apiConfiguration ?. pearaiModelInfo || openAiModelInfoSaneDefaults ,
1643+ selectedModelId : apiConfiguration ?. pearaiModelId || anthropicDefaultModelId ,
1644+ selectedModelInfo : apiConfiguration ?. pearaiModelInfo || pearaiModelInfo ,
16351645 }
1646+ }
16361647 case "unbound" :
16371648 return getProviderData ( unboundModels , unboundDefaultModelId )
16381649 default :
You can’t perform that action at this time.
0 commit comments