@@ -164,6 +164,14 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
164164 ...( reasoning && reasoning ) ,
165165 }
166166
167+ if ( this . options . serviceTier && this . options . serviceTier !== "auto" ) {
168+ ; ( requestOptions as any ) . service_tier = this . options . serviceTier
169+ console . log ( "[DEBUG] Setting service_tier parameter:" , this . options . serviceTier )
170+ console . log ( "[DEBUG] Full request options:" , JSON . stringify ( requestOptions , null , 2 ) )
171+ } else {
172+ console . log ( "[DEBUG] Service tier not set or is 'auto'. Current value:" , this . options . serviceTier )
173+ }
174+
167175 // Add max_tokens if needed
168176 this . addMaxTokensIfNeeded ( requestOptions , modelInfo )
169177
@@ -226,6 +234,14 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
226234 : [ systemMessage , ...convertToOpenAiMessages ( messages ) ] ,
227235 }
228236
237+ if ( this . options . serviceTier && this . options . serviceTier !== "auto" ) {
238+ ; ( requestOptions as any ) . service_tier = this . options . serviceTier
239+ console . log ( "[DEBUG] Setting service_tier parameter:" , this . options . serviceTier )
240+ console . log ( "[DEBUG] Full request options:" , JSON . stringify ( requestOptions , null , 2 ) )
241+ } else {
242+ console . log ( "[DEBUG] Service tier not set or is 'auto'. Current value:" , this . options . serviceTier )
243+ }
244+
229245 // Add max_tokens if needed
230246 this . addMaxTokensIfNeeded ( requestOptions , modelInfo )
231247
@@ -271,6 +287,14 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
271287 messages : [ { role : "user" , content : prompt } ] ,
272288 }
273289
290+ if ( this . options . serviceTier && this . options . serviceTier !== "auto" ) {
291+ ; ( requestOptions as any ) . service_tier = this . options . serviceTier
292+ console . log ( "[DEBUG] Setting service_tier parameter:" , this . options . serviceTier )
293+ console . log ( "[DEBUG] Full request options:" , JSON . stringify ( requestOptions , null , 2 ) )
294+ } else {
295+ console . log ( "[DEBUG] Service tier not set or is 'auto'. Current value:" , this . options . serviceTier )
296+ }
297+
274298 // Add max_tokens if needed
275299 this . addMaxTokensIfNeeded ( requestOptions , modelInfo )
276300
@@ -315,6 +339,14 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
315339 temperature : undefined ,
316340 }
317341
342+ if ( this . options . serviceTier && this . options . serviceTier !== "auto" ) {
343+ ; ( requestOptions as any ) . service_tier = this . options . serviceTier
344+ console . log ( "[DEBUG] Setting service_tier parameter:" , this . options . serviceTier )
345+ console . log ( "[DEBUG] Full request options:" , JSON . stringify ( requestOptions , null , 2 ) )
346+ } else {
347+ console . log ( "[DEBUG] Service tier not set or is 'auto'. Current value:" , this . options . serviceTier )
348+ }
349+
318350 // O3 family models do not support the deprecated max_tokens parameter
319351 // but they do support max_completion_tokens (the modern OpenAI parameter)
320352 // This allows O3 models to limit response length when includeMaxTokens is enabled
@@ -340,6 +372,14 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
340372 temperature : undefined ,
341373 }
342374
375+ if ( this . options . serviceTier && this . options . serviceTier !== "auto" ) {
376+ ; ( requestOptions as any ) . service_tier = this . options . serviceTier
377+ console . log ( "[DEBUG] Setting service_tier parameter:" , this . options . serviceTier )
378+ console . log ( "[DEBUG] Full request options:" , JSON . stringify ( requestOptions , null , 2 ) )
379+ } else {
380+ console . log ( "[DEBUG] Service tier not set or is 'auto'. Current value:" , this . options . serviceTier )
381+ }
382+
343383 // O3 family models do not support the deprecated max_tokens parameter
344384 // but they do support max_completion_tokens (the modern OpenAI parameter)
345385 // This allows O3 models to limit response length when includeMaxTokens is enabled
0 commit comments