Skip to content

Caching fails for Fable 5 on Bedrock #5651

@kblissett

Description

@kblissett

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions