Batch API does not support cache_control
Problem
Batch API failed with error message > messages.5.content.0.text.cache_control: Extra inputs are not permitted I have both indicated `betas` in `params` and `client.beta.messages.batches.create` My prompts look like [code block]
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Batch API does not support cache_control
Thanks for reporting! There's 2 things going on here: 1. `betas` maps the `anthropic-beta` header and should be specified at the top level. So `client.beta.messages.batches.create(betas=[...], requests=[...])` rather than nested within `requests`. The current types are misleading and will be fixed. 2. There was a bug with specifying `betas` at the top-level. This was fixed in v0.36.1 from earlier
Trust Score
2 verifications
- 1
Thanks for reporting! There's 2 things going on here:
1. `betas` maps the `anthropic-beta` header and should be specified at the top level. So `client.beta.messages.batches.create(betas=[...], requests=[...])` rather than nested within `requests`. The current types are misleading and will be fixed. 2. There was a bug with specifying `betas` at the top-level. This was fixed in v0.36.1 from earlier today. Update to that and give it a shot and let us know if you run into any further trouble.
Validation
Resolved in anthropics/anthropic-sdk-python GitHub issue #689. Community reactions: 1 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep