File tree Expand file tree Collapse file tree
packages/opencode/src/provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,7 +85,12 @@ function normalizeMessages(
8585 // as thinking blocks to Anthropic without a signature and would cause a 400 error.
8686 // This is a defence-in-depth guard; the primary prevention is in message-v2.ts where
8787 // reasoning parts from a different model are skipped before reaching this point.
88- if ( model . api . npm === "@ai-sdk/anthropic" || model . api . npm === "@ai-sdk/amazon-bedrock" ) {
88+ // Only applies to reasoning-capable models: non-reasoning models don't produce signed
89+ // thinking blocks, so their reasoning parts don't need a signature.
90+ if (
91+ model . capabilities . reasoning &&
92+ ( model . api . npm === "@ai-sdk/anthropic" || model . api . npm === "@ai-sdk/amazon-bedrock" )
93+ ) {
8994 msgs = msgs
9095 . map ( ( msg ) => {
9196 if ( msg . role !== "assistant" || ! Array . isArray ( msg . content ) ) return msg
You can’t perform that action at this time.
0 commit comments