What happened?
pi relies on the following lines to determine if a model supports caching on Amazon Bedrock:
|
function supportsPromptCaching(model: Model<"bedrock-converse-stream">): boolean { |
|
const candidates = getModelMatchCandidates(model.id, model.name); |
|
|
|
const hasClaudeRef = candidates.some((s) => s.includes("claude")); |
|
if (!hasClaudeRef) { |
|
// Application inference profiles don't contain the model name in the ARN. |
|
// Allow users to force cache points via environment variable. |
|
if (typeof process !== "undefined" && process.env.AWS_BEDROCK_FORCE_CACHE === "1") return true; |
|
return false; |
|
} |
|
// Claude 4.x models (opus-4, sonnet-4, haiku-4) |
|
if (candidates.some((s) => s.includes("-4-"))) return true; |
|
// Claude 3.7 Sonnet |
|
if (candidates.some((s) => s.includes("claude-3-7-sonnet"))) return true; |
|
// Claude 3.5 Haiku |
|
if (candidates.some((s) => s.includes("claude-3-5-haiku"))) return true; |
|
return false; |
|
} |
The model ID global.anthropic.claude-fable-5 does not match any of these patterns and thus no tokens are ever cached. This can lead to a dramatic increase in costs.
Steps to reproduce
Use global.anthropic.claude-fable-5 from provider amazon-bedrock.
Expected behavior
pi should use normal caching behavior when this model is selected.
Version
0.79.1
What happened?
pirelies on the following lines to determine if a model supports caching on Amazon Bedrock:pi/packages/ai/src/providers/amazon-bedrock.ts
Lines 620 to 637 in 1da9039
The model ID
global.anthropic.claude-fable-5does not match any of these patterns and thus no tokens are ever cached. This can lead to a dramatic increase in costs.Steps to reproduce
Use
global.anthropic.claude-fable-5from provideramazon-bedrock.Expected behavior
pishould use normal caching behavior when this model is selected.Version
0.79.1