What happened?
When using Anthropic SDK (or Claude Code SDK) with LiteLLM proxy configured to route to AWS Bedrock, requests fail with a 400 error. It seems the SDK follows Anthropic's official API spec and includes a ttl field in cache_control, but Bedrock does not accept this field.
Root cause: Anthropic's native API and Bedrock use different prompt caching formats:
- Anthropic API: Uses
cache_control with optional ttl field ("5m" or "1h")
- Bedrock API: Uses
cachePoint format without ttl field
Anthropic format (SDK output):
{
"cache_control": {
"type": "ephemeral",
"ttl": "1h"
}
}
Relevant log output
POST "...:4000/v1/messages"
**LLM input:**
{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Warmup",
"cache_control": {
"type": "ephemeral",
"ttl": "1h"
}
}
]
}
],
"tools": []
}
**Error response:**
{
"message": "messages.0.content.0.text.cache_control.ephemeral.ttl: Extra inputs are not permitted"
}
**Note**: The request works correctly when `ttl` field is removed
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.78.0-stable
Twitter / LinkedIn details
No response
What happened?
When using Anthropic SDK (or Claude Code SDK) with LiteLLM proxy configured to route to AWS Bedrock, requests fail with a 400 error. It seems the SDK follows Anthropic's official API spec and includes a
ttlfield incache_control, but Bedrock does not accept this field.Root cause: Anthropic's native API and Bedrock use different prompt caching formats:
cache_controlwith optionalttlfield ("5m"or"1h")cachePointformat withoutttlfieldAnthropic format (SDK output):
{ "cache_control": { "type": "ephemeral", "ttl": "1h" } }Relevant log output
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.78.0-stable
Twitter / LinkedIn details
No response