feat(agents): support Anthropic 1M context beta header

This commit is contained in:
Peter Steinberger
2026-02-18 03:28:56 +01:00
parent d1c00dbb7c
commit c90b09cb02
5 changed files with 238 additions and 0 deletions

View File

@@ -79,6 +79,28 @@ We recommend migrating to the new `cacheRetention` parameter.
OpenClaw includes the `extended-cache-ttl-2025-04-11` beta flag for Anthropic API
requests; keep it if you override provider headers (see [/gateway/configuration](/gateway/configuration)).
## 1M context window (Anthropic beta)
Anthropic's 1M context window is beta-gated. In OpenClaw, enable it per model
with `params.context1m: true` for supported Opus/Sonnet models.
```json5
{
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-6": {
params: { context1m: true },
},
},
},
},
}
```
OpenClaw maps this to `anthropic-beta: context-1m-2025-08-07` on Anthropic
requests.
## Option B: Claude setup-token
**Best for:** using your Claude subscription.