Skip to content

Commit 1760568

Browse files
committed
fix for prompt caching sonnet by short openrouter name
1 parent c080e6f commit 1760568

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

common/src/old-constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ export const providerModelNames = {
299299

300300
export type Model = (typeof models)[keyof typeof models] | (string & {})
301301

302+
export const shouldCacheModels = [
303+
'anthropic/claude-opus-4.1',
304+
'anthropic/claude-sonnet-4',
305+
'anthropic/claude-opus-4',
306+
'anthropic/claude-3.7-sonnet',
307+
'anthropic/claude-3.5-haiku',
308+
]
302309
const nonCacheableModels = [
303310
models.openrouter_grok_4,
304311
] satisfies string[] as string[]

common/src/util/model-utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ function getExplicitlyDefinedModels(): Set<string> {
88
if (explicitlyDefinedModels === null) {
99
// Dynamically import to avoid circular dependency issues
1010
// eslint-disable-next-line @typescript-eslint/no-var-requires
11-
const { models } = require('../old-constants')
12-
explicitlyDefinedModels = new Set(Object.values(models) as string[])
11+
const { models, shouldCacheModels } = require('../old-constants')
12+
explicitlyDefinedModels = new Set([
13+
...(Object.values(models) as string[]),
14+
...(Object.values(shouldCacheModels) as string[]),
15+
])
1316
}
1417
return explicitlyDefinedModels
1518
}

0 commit comments

Comments
 (0)