fix(ai): support prompt caching for Bedrock application inference profiles (#2346)

Add AWS_BEDROCK_FORCE_CACHE=1 environment variable support. When the
model ID doesn't contain a recognizable Claude model name, users can
set this variable to force cache point injection.
This commit is contained in:
xu0o0
2026-03-18 18:21:10 +08:00
committed by GitHub
parent 8a8e2a8049
commit 31d59f8513
2 changed files with 20 additions and 1 deletions

View File

@@ -147,6 +147,13 @@ Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
```
Prompt caching is enabled automatically for Claude models whose ID contains a recognizable model name (base models and system-defined inference profiles). For application inference profiles (whose ARNs don't contain the model name), set `AWS_BEDROCK_FORCE_CACHE=1` to enable cache points:
```bash
export AWS_BEDROCK_FORCE_CACHE=1
pi --provider amazon-bedrock --model arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
```
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
```bash