File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
packages/opencode/src/provider Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -792,11 +792,10 @@ export namespace Provider {
792792 }
793793
794794 // Reasoning models require max_completion_tokens instead of max_tokens
795- // when using openai-compatible provider
796- // Check if model has reasoning capability OR has reasoningEffort option
797- const isReasoningModel =
798- model . capabilities . reasoning || ( model . options && "reasoningEffort" in model . options )
799- if ( model . api . npm === "@ai-sdk/azure" && isReasoningModel ) {
795+ // when using openai-compatible or azure provider
796+ const isOpenAICompatible =
797+ model . api . npm === "@ai-sdk/openai-compatible" || model . api . npm === "@ai-sdk/azure"
798+ if ( isOpenAICompatible && model . capabilities . reasoning ) {
800799 if ( opts . body && typeof opts . body === "string" ) {
801800 try {
802801 const body = JSON . parse ( opts . body )
@@ -806,7 +805,11 @@ export namespace Provider {
806805 opts . body = JSON . stringify ( body )
807806 }
808807 } catch ( e ) {
809- // Ignore JSON parse errors
808+ log . warn ( "Failed to transform max_tokens parameter for reasoning model" , {
809+ providerID : model . providerID ,
810+ modelID : model . id ,
811+ error : e ,
812+ } )
810813 }
811814 }
812815 }
You can’t perform that action at this time.
0 commit comments