Update announcement/settings with details about prompt caching

This commit is contained in:
Saoud Rizwan
2024-08-15 04:21:28 -04:00
parent ec2bfa352a
commit 6989779dd6
7 changed files with 48 additions and 18 deletions

View File

@@ -417,12 +417,12 @@ export class ClaudeDev {
cacheCreationInputTokens?: number,
cacheReadInputTokens?: number
): number {
const modelCacheWritesPrice = this.api.getModel().info.cacheWrites
const modelCacheWritesPrice = this.api.getModel().info.cacheWritesPrice
let cacheWritesCost = 0
if (cacheCreationInputTokens && modelCacheWritesPrice) {
cacheWritesCost = (modelCacheWritesPrice / 1_000_000) * cacheCreationInputTokens
}
const modelCacheReadsPrice = this.api.getModel().info.cacheReads
const modelCacheReadsPrice = this.api.getModel().info.cacheReadsPrice
let cacheReadsCost = 0
if (cacheReadInputTokens && modelCacheReadsPrice) {
cacheReadsCost = (modelCacheReadsPrice / 1_000_000) * cacheReadInputTokens

View File

@@ -25,7 +25,7 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
private disposables: vscode.Disposable[] = []
private view?: vscode.WebviewView | vscode.WebviewPanel
private claudeDev?: ClaudeDev
private latestAnnouncementId = "aug-11-2024" // update to some unique identifier when we add a new announcement
private latestAnnouncementId = "aug-15-2024" // update to some unique identifier when we add a new announcement
constructor(
private readonly context: vscode.ExtensionContext,

View File

@@ -21,8 +21,8 @@ export interface ModelInfo {
supportsPromptCache: boolean
inputPrice: number
outputPrice: number
cacheWrites?: number
cacheReads?: number
cacheWritesPrice?: number
cacheReadsPrice?: number
}
export type ApiModelId = AnthropicModelId | OpenRouterModelId | BedrockModelId
@@ -38,8 +38,8 @@ export const anthropicModels = {
supportsPromptCache: true,
inputPrice: 3.0, // $3 per million input tokens
outputPrice: 15.0, // $15 per million output tokens
cacheWrites: 3.75, // $3.75 per million tokens
cacheReads: 0.3, // $0.30 per million tokens
cacheWritesPrice: 3.75, // $3.75 per million tokens
cacheReadsPrice: 0.3, // $0.30 per million tokens
},
"claude-3-opus-20240229": {
maxTokens: 4096,
@@ -47,8 +47,8 @@ export const anthropicModels = {
supportsPromptCache: false,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWrites: 18.75,
cacheReads: 1.5,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"claude-3-sonnet-20240229": {
maxTokens: 4096,
@@ -63,8 +63,8 @@ export const anthropicModels = {
supportsPromptCache: true,
inputPrice: 0.25,
outputPrice: 1.25,
cacheWrites: 0.3,
cacheReads: 0.03,
cacheWritesPrice: 0.3,
cacheReadsPrice: 0.03,
},
} as const satisfies Record<string, ModelInfo> // as const assertion makes the object deeply readonly