Skip to content

Commit fc8e672

Browse files
committed
Fix supportsPromptCache check
1 parent b0337f3 commit fc8e672

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/api/providers/fetchers/__tests__/fixtures/openrouter-models.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"rawHeaders": {
1212
"access-control-allow-origin": "*",
1313
"cdn-cache-control": "max-age=300",
14-
"cf-ray": "9358d8d15a5a2f64-LAX",
14+
"cf-ray": "9358ea26bac719db-LAX",
1515
"connection": "close",
1616
"content-encoding": "br",
1717
"content-type": "application/json",
18-
"date": "Thu, 24 Apr 2025 21:55:48 GMT",
18+
"date": "Thu, 24 Apr 2025 22:07:38 GMT",
1919
"server": "cloudflare",
2020
"transfer-encoding": "chunked",
2121
"vary": "Accept-Encoding"

src/api/providers/fetchers/__tests__/openrouter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { PROMPT_CACHING_MODELS } from "../../../../shared/api"
99
import { getOpenRouterModels } from "../openrouter"
1010

1111
nockBack.fixtures = path.join(__dirname, "fixtures")
12-
nockBack.setMode("dryrun")
12+
nockBack.setMode("lockdown")
1313

1414
describe("OpenRouter API", () => {
1515
describe("getOpenRouterModels", () => {

src/api/providers/fetchers/openrouter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions) {
6868
? parseApiPrice(rawModel.pricing?.input_cache_read)
6969
: undefined
7070

71-
const supportsPromptCache = !!cacheWritesPrice && !!cacheReadsPrice
71+
const supportsPromptCache =
72+
typeof cacheWritesPrice !== "undefined" && typeof cacheReadsPrice !== "undefined"
7273

7374
const modelInfo: ModelInfo = {
7475
maxTokens: rawModel.top_provider?.max_completion_tokens,

src/shared/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ export const PROMPT_CACHING_MODELS = new Set([
14231423
"anthropic/claude-3.7-sonnet",
14241424
"anthropic/claude-3.7-sonnet:beta",
14251425
"anthropic/claude-3.7-sonnet:thinking",
1426-
// "google/gemini-2.5-pro-preview-03-25",
1426+
"google/gemini-2.5-pro-preview-03-25",
14271427
"google/gemini-2.0-flash-001",
14281428
"google/gemini-flash-1.5",
14291429
"google/gemini-flash-1.5-8b",
@@ -1432,7 +1432,7 @@ export const PROMPT_CACHING_MODELS = new Set([
14321432
// These models don't have prompt caching enabled by default (you can turn it on
14331433
// in settings).
14341434
export const OPTIONAL_PROMPT_CACHING_MODELS = new Set([
1435-
// "google/gemini-2.5-pro-preview-03-25",
1435+
"google/gemini-2.5-pro-preview-03-25",
14361436
"google/gemini-2.0-flash-001",
14371437
"google/gemini-flash-1.5",
14381438
"google/gemini-flash-1.5-8b",

0 commit comments

Comments
 (0)