MCPcopy
hub / github.com/codeaashu/claude-code / getPromptCachingEnabled

Function getPromptCachingEnabled

src/services/api/claude.ts:333–356  ·  view source on GitHub ↗
(model: string)

Source from the content-addressed store, hash-verified

331}
332
333export function getPromptCachingEnabled(model: string): boolean {
334 // Global disable takes precedence
335 if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING)) return false
336
337 // Check if we should disable for small/fast model
338 if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING_HAIKU)) {
339 const smallFastModel = getSmallFastModel()
340 if (model === smallFastModel) return false
341 }
342
343 // Check if we should disable for default Sonnet
344 if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING_SONNET)) {
345 const defaultSonnet = getDefaultSonnetModel()
346 if (model === defaultSonnet) return false
347 }
348
349 // Check if we should disable for default Opus
350 if (isEnvTruthy(process.env.DISABLE_PROMPT_CACHING_OPUS)) {
351 const defaultOpus = getDefaultOpusModel()
352 if (model === defaultOpus) return false
353 }
354
355 return true
356}
357
358export function getCacheControl({
359 scope,

Callers 2

queryModelFunction · 0.85
paramsFromContextFunction · 0.85

Calls 4

isEnvTruthyFunction · 0.85
getSmallFastModelFunction · 0.85
getDefaultSonnetModelFunction · 0.85
getDefaultOpusModelFunction · 0.85

Tested by

no test coverage detected