Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/types/src/providers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
"anthropic/claude-3.7-sonnet:thinking",
"anthropic/claude-sonnet-4",
"anthropic/claude-opus-4",
"google/gemini-2.5-pro-preview",
"google/gemini-2.5-flash-preview",
"google/gemini-2.5-flash-preview:thinking",
"google/gemini-2.5-flash-preview-05-20",
"google/gemini-2.5-flash-preview-05-20:thinking",
"google/gemini-2.0-flash-001",
"google/gemini-flash-1.5",
"google/gemini-flash-1.5-8b",
])

// https://www.anthropic.com/news/3-5-models-and-computer-use
Expand Down
21 changes: 15 additions & 6 deletions src/api/providers/fetchers/__tests__/openrouter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@ describe("OpenRouter API", () => {

const models = await getOpenRouterModels()

expect(
Object.entries(models)
.filter(([_, model]) => model.supportsPromptCache)
.map(([id, _]) => id)
.sort(),
).toEqual(Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS).sort())
const openRouterSupportedCaching = Object.entries(models)
.filter(([_, model]) => model.supportsPromptCache)
.map(([id, _]) => id)

const ourCachingModels = Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS)

// Verify all our caching models are actually supported by OpenRouter
for (const modelId of ourCachingModels) {
expect(openRouterSupportedCaching).toContain(modelId)
}

// Verify we have all supported models except intentionally excluded Google models
const expectedCachingModels = openRouterSupportedCaching.filter((id) => !id.startsWith("google/")).sort()

expect(ourCachingModels.sort()).toEqual(expectedCachingModels)

expect(
Object.entries(models)
Expand Down