* add

* changeset

* Fix spelling error

---------

Co-authored-by: Dennis Bartlett <bartlett.dc.1@gmail.com>
This commit is contained in:
ToshiiandDennis Bartlett authored and GitHub committed 2025-04-24 21:38:07 -07:00
1 parent 4addffe94c
commit 0e07b92be2
3 files changed
+19 -1

No files matched your search

+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
@@ -1471,6 +1471,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