@@ -25,6 +25,10 @@ export class UnboundHandler extends BaseProvider implements SingleCompletionHand
2525 this . client = new OpenAI ( { baseURL, apiKey } )
2626 }
2727
28+ private supportsTemperature ( ) : boolean {
29+ return ! this . getModel ( ) . id . startsWith ( "openai/o3-mini" )
30+ }
31+
2832 override async * createMessage ( systemPrompt : string , messages : Anthropic . Messages . MessageParam [ ] ) : ApiStream {
2933 // Convert Anthropic messages to OpenAI format
3034 const openAiMessages : OpenAI . Chat . ChatCompletionMessageParam [ ] = [
@@ -78,28 +82,30 @@ export class UnboundHandler extends BaseProvider implements SingleCompletionHand
7882 maxTokens = this . getModel ( ) . info . maxTokens
7983 }
8084
85+ const requestOptions : OpenAI . Chat . Completions . ChatCompletionCreateParamsStreaming = {
86+ model : this . getModel ( ) . id . split ( "/" ) [ 1 ] ,
87+ max_tokens : maxTokens ,
88+ messages : openAiMessages ,
89+ stream : true ,
90+ }
91+
92+ if ( this . supportsTemperature ( ) ) {
93+ requestOptions . temperature = this . options . modelTemperature ?? 0
94+ }
95+
8196 const { data : completion , response } = await this . client . chat . completions
82- . create (
83- {
84- model : this . getModel ( ) . id . split ( "/" ) [ 1 ] ,
85- max_tokens : maxTokens ,
86- temperature : this . options . modelTemperature ?? 0 ,
87- messages : openAiMessages ,
88- stream : true ,
89- } ,
90- {
91- headers : {
92- "X-Unbound-Metadata" : JSON . stringify ( {
93- labels : [
94- {
95- key : "app" ,
96- value : "roo-code" ,
97- } ,
98- ] ,
99- } ) ,
100- } ,
97+ . create ( requestOptions , {
98+ headers : {
99+ "X-Unbound-Metadata" : JSON . stringify ( {
100+ labels : [
101+ {
102+ key : "app" ,
103+ value : "roo-code" ,
104+ } ,
105+ ] ,
106+ } ) ,
101107 } ,
102- )
108+ } )
103109 . withResponse ( )
104110
105111 for await ( const chunk of completion ) {
@@ -150,7 +156,10 @@ export class UnboundHandler extends BaseProvider implements SingleCompletionHand
150156 const requestOptions : OpenAI . Chat . Completions . ChatCompletionCreateParamsNonStreaming = {
151157 model : this . getModel ( ) . id . split ( "/" ) [ 1 ] ,
152158 messages : [ { role : "user" , content : prompt } ] ,
153- temperature : this . options . modelTemperature ?? 0 ,
159+ }
160+
161+ if ( this . supportsTemperature ( ) ) {
162+ requestOptions . temperature = this . options . modelTemperature ?? 0
154163 }
155164
156165 if ( this . getModel ( ) . id . startsWith ( "anthropic/" ) ) {
0 commit comments