Describe the Bug
Anthropic's 2026 breaking change to claude-opus-4-7 (and likely the wider 4.7 family) deprecates the temperature parameter (along with top_p / top_k). Any request that includes temperature returns:
400 — `temperature` is deprecated for this model.
Mastra's agent.stream() carries a default temperature (or whatever the user sets in defaultOptions / per-call callSettings) straight through to @ai-sdk/anthropic, which forwards it to the API verbatim. The result is a hard 400 in production with no graceful path.
This is the same shape of breaking change that motivated #13969 / #14435 (prefill removed in 4.5/4.6) — a model in a previously-supported family quietly drops a parameter, and the framework has no capability layer to absorb it.
Live failure
Production agent on claude-opus-4-7 with temperature: 0.3 → 400 mid-stream → run fails for the user with no automatic recovery. We currently have no way to ship 4-7 without forking Mastra or sanitising callSettings outside the framework.
Steps To Reproduce
- Create a Mastra
Agent configured with model: anthropic('claude-opus-4-7') and any non-zero temperature (or rely on the SDK default).
- Call
agent.stream({ messages: [{ role: 'user', content: 'hello' }] }).
- Anthropic returns
400 'temperature' is deprecated for this model.
- The error surfaces to the user; there is no
processAPIError hook that fires for this since the PrefillErrorHandler regex doesn't match, and no other built-in processor strips the param.
Expected Behavior
Pick one of these (in order of preference):
- Auto-strip dropped-capability params for known models. Same shape as the auto-injected
PrefillErrorHandler — a built-in inputProcessor (or call-settings sanitiser) consults a capability matrix per provider+modelId and removes params the model doesn't accept (temperature, top_p, top_k, prefill-trailing-assistant, etc.) before dispatch.
- Expose a public capability matrix users can extend. e.g.
setModelCapabilities('claude-opus-4-7', { supportsTemperature: false }) so adding a new Anthropic / OpenAI / xAI release becomes a one-row catalog edit instead of a code search across every agent definition.
- At minimum: a built-in
TemperatureDeprecatedHandler sibling to PrefillErrorHandler, registered the same way (auto-injected via errorProcessors), that on the 400 strips temperature (and top_p/top_k) from runState.callSettings and signals retry.
Why this matters / context
The ecosystem is hitting this same shape across frameworks each time Anthropic ships a breaking change:
Each framework currently solves it independently with its own per-model deny-list. Mastra is uniquely positioned to handle this at the provider + processor layer so users don't have to maintain their own model_capabilities.ts.
The processAPIError infrastructure that #14435 added is exactly the right primitive — it just needs (a) more matchers and (b) a way for the matcher to mutate callSettings, not just messageList. From the #14435 PR description, processors today can mutate messageList and signal { retry: true }; if processAPIError were extended to allow mutating callSettings (or returning a patched options bag), a stock TemperatureDeprecatedHandler becomes ~20 lines.
Reference
Verification
Describe the Bug
Anthropic's 2026 breaking change to
claude-opus-4-7(and likely the wider 4.7 family) deprecates thetemperatureparameter (along withtop_p/top_k). Any request that includestemperaturereturns:Mastra's
agent.stream()carries a defaulttemperature(or whatever the user sets indefaultOptions/ per-callcallSettings) straight through to@ai-sdk/anthropic, which forwards it to the API verbatim. The result is a hard 400 in production with no graceful path.This is the same shape of breaking change that motivated #13969 / #14435 (prefill removed in 4.5/4.6) — a model in a previously-supported family quietly drops a parameter, and the framework has no capability layer to absorb it.
Live failure
Production agent on
claude-opus-4-7withtemperature: 0.3→ 400 mid-stream → run fails for the user with no automatic recovery. We currently have no way to ship 4-7 without forking Mastra or sanitisingcallSettingsoutside the framework.Steps To Reproduce
Agentconfigured withmodel: anthropic('claude-opus-4-7')and any non-zerotemperature(or rely on the SDK default).agent.stream({ messages: [{ role: 'user', content: 'hello' }] }).400 'temperature' is deprecated for this model.processAPIErrorhook that fires for this since thePrefillErrorHandlerregex doesn't match, and no other built-in processor strips the param.Expected Behavior
Pick one of these (in order of preference):
PrefillErrorHandler— a built-ininputProcessor(or call-settings sanitiser) consults a capability matrix perprovider+modelIdand removes params the model doesn't accept (temperature,top_p,top_k, prefill-trailing-assistant, etc.) before dispatch.setModelCapabilities('claude-opus-4-7', { supportsTemperature: false })so adding a new Anthropic / OpenAI / xAI release becomes a one-row catalog edit instead of a code search across every agent definition.TemperatureDeprecatedHandlersibling toPrefillErrorHandler, registered the same way (auto-injected viaerrorProcessors), that on the 400 stripstemperature(andtop_p/top_k) fromrunState.callSettingsand signals retry.Why this matters / context
The ecosystem is hitting this same shape across frameworks each time Anthropic ships a breaking change:
PrefillErrorHandler)temperaturedeprecated RooCodeInc/Roo-Code#12162Each framework currently solves it independently with its own per-model deny-list. Mastra is uniquely positioned to handle this at the
provider + processorlayer so users don't have to maintain their ownmodel_capabilities.ts.The
processAPIErrorinfrastructure that #14435 added is exactly the right primitive — it just needs (a) more matchers and (b) a way for the matcher to mutatecallSettings, not justmessageList. From the #14435 PR description, processors today can mutatemessageListand signal{ retry: true }; ifprocessAPIErrorwere extended to allow mutatingcallSettings(or returning a patched options bag), a stockTemperatureDeprecatedHandlerbecomes ~20 lines.Reference
processAPIError+ auto-injectedPrefillErrorHandler(the pattern to follow)Verification
claude-opus-4-7+temperatureas of filing).