fix(models): enable 1h cache TTL for fable-5 on bedrock - #2923
Conversation
Claude Fable 5's aws-bedrock mapping was missing cacheWriteInputPrice1h, which the gateway uses as the supports-1h-TTL gate for Bedrock cachePoints. Caller-supplied ttl:"1h" markers were silently downgraded to the 5m default, so all cache writes landed in ephemeral_5m_input_tokens. AWS's Fable 5 model card documents 5m and 1h TTL support, so add the 1h write price (2x input, matching the direct Anthropic mapping) and allowlist the model in the bedrock 1h pricing spec. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR adds a ChangesBedrock 1h Pricing Update
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Enables AWS Bedrock forwarding and billing for 1-hour prompt-cache TTL (ttl: "1h") for the Anthropic Claude Fable 5 model by adding the missing 1h cache write pricing field and updating the Bedrock 1h pricing-spec allowlist.
Changes:
- Add
cacheWriteInputPrice1hto the Claude Fable 5aws-bedrockprovider mapping (aligning with the direct Anthropic mapping and enabling 1h TTL support gating). - Allowlist
anthropic.claude-fable-5in the Bedrock 1h pricing guard test to permitcacheWriteInputPrice1hfor that model on Bedrock.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/models/src/models/anthropic.ts | Adds Bedrock 1h cache-write price for Claude Fable 5 so 1h TTL can be forwarded/billed correctly. |
| apps/gateway/src/lib/anthropic-pricing.spec.ts | Extends the Bedrock 1h TTL allowlist to include Fable 5 so the pricing-spec guard matches the new mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const ONE_HOUR_BEDROCK_PREFIXES = [ | ||
| "anthropic.claude-fable-5", | ||
| "anthropic.claude-opus-4-5", | ||
| "anthropic.claude-opus-4-6", | ||
| "anthropic.claude-opus-4-7", |
Problem
A user reported that requesting prompt caching with
ttl: "1h"works on Opus 4.7/4.8 (tokens land incache_creation.ephemeral_1h_input_tokens) but on Claude Fable 5 the exact same request lands inephemeral_5m_input_tokens.Cause
The gateway gates 1h TTL forwarding for AWS Bedrock on the model mapping's
cacheWriteInputPrice1hfield (bedrockSupports1hTtlinpackages/actions/src/prepare-request-body.ts), silently downgradingttl: "1h"cachePoints to the 5m default when the field is absent. Fable 5'saws-bedrockmapping was missing the field (the directanthropicmapping has it), so any Fable 5 request routed through Bedrock lost the 1h TTL — Opus 4.7/4.8 have the field on both mappings, which is why they behaved correctly.Fix
cacheWriteInputPrice1h: "20.0e-6"(2× input price, matching the direct Anthropic mapping) to Fable 5'saws-bedrockprovider mapping. AWS's Fable 5 model card documents prompt caching with 5m and 1h TTLs.anthropic.claude-fable-5in the Bedrock 1h pricing spec guard.This also fixes billing for Fable 5 Bedrock 1h cache writes (the price was previously undefined). Geo-region (
us) pricing gets the ×1.1 premium automatically via region expansion.Testing
pnpm test:unitpasses (the previously failingchat-projectsspecs were a stale local test-DB schema, fixed bypnpm push-test)pnpm buildpasses🤖 Generated with Claude Code
Summary by CodeRabbit