Compare commits

...

3 Commits

Author SHA1 Message Date
Dennis Bartlett f0a7681d3b Fix spelling error 2025-04-24 21:32:34 -07:00
0xtoshii 4b15514462 changeset 2025-04-24 19:53:42 -07:00
0xtoshii 0a7c4c1e05 add 2025-04-24 19:47:27 -07:00
3 changed files with 19 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": minor
---
add prompt caching to gemini models in cline / openrouter providers
+6 -1
View File
@@ -20,7 +20,8 @@ export async function createOpenRouterStream(
]
// prompt caching: https://openrouter.ai/docs/prompt-caching
// this is specifically for claude models (some models may 'support prompt caching' automatically without this)
// this was initially specifically for claude models (some models may 'support prompt caching' automatically without this)
// gemini models only use the last breakpoint for caching, so the others will be ignored
switch (model.id) {
case "anthropic/claude-3.7-sonnet":
case "anthropic/claude-3.7-sonnet:beta":
@@ -39,6 +40,10 @@ export async function createOpenRouterStream(
case "anthropic/claude-3-haiku:beta":
case "anthropic/claude-3-opus":
case "anthropic/claude-3-opus:beta":
case "google/gemini-2.5-pro-preview-03-25":
case "google/gemini-2.0-flash-001":
case "google/gemini-flash-1.5":
case "google/gemini-pro-1.5":
openAiMessages[0] = {
role: "system",
content: [
+8
View File
@@ -1498,6 +1498,14 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
modelInfo.cacheWritesPrice = 0.14
modelInfo.cacheReadsPrice = 0.014
break
case "google/gemini-2.5-pro-preview-03-25":
case "google/gemini-2.0-flash-001":
case "google/gemini-flash-1.5":
case "google/gemini-pro-1.5":
modelInfo.supportsPromptCache = true
modelInfo.cacheWritesPrice = parsePrice(rawModel.pricing?.input_cache_write)
modelInfo.cacheReadsPrice = parsePrice(rawModel.pricing?.input_cache_read)
break
}
models[rawModel.id] = modelInfo