@@ -272,12 +272,17 @@ export function buildOpenAISource(fields: {
272272 apiKey ?: string ;
273273 model : string ;
274274 reasoningEffort ?: ReasoningEffort ;
275+ maxTokens ?: number ;
276+ temperature ?: number ;
277+ topP ?: number ;
275278 quirks ?: Record < string , unknown > ;
276279} ) : InferenceSource {
277- const overrides =
278- fields . reasoningEffort !== undefined
279- ? { providerOptions : { reasoning_effort : fields . reasoningEffort } }
280- : { } ;
280+ const providerOptions : Record < string , unknown > = { } ;
281+ if ( fields . reasoningEffort !== undefined )
282+ providerOptions [ "reasoning_effort" ] = fields . reasoningEffort ;
283+ if ( fields . temperature !== undefined )
284+ providerOptions [ "temperature" ] = fields . temperature ;
285+ if ( fields . topP !== undefined ) providerOptions [ "top_p" ] = fields . topP ;
281286 registerSourceSecret ( fields . id , fields . apiKey ) ;
282287 return {
283288 id : fields . id ,
@@ -287,7 +292,10 @@ export function buildOpenAISource(fields: {
287292 : normalizeOpenAICompatibleBaseURL ( fields . baseURL ) ,
288293 credentialId : fields . id ,
289294 model : fields . model ,
290- defaults : { maxTokens : SOURCE_MAX_TOKENS , ...overrides } ,
295+ defaults : {
296+ maxTokens : fields . maxTokens ?? SOURCE_MAX_TOKENS ,
297+ ...( Object . keys ( providerOptions ) . length > 0 ? { providerOptions } : { } ) ,
298+ } ,
291299 ...( fields . quirks !== undefined ? { quirks : fields . quirks } : { } ) ,
292300 } ;
293301}
@@ -1405,6 +1413,11 @@ export function catalogEntryAsProviderSettings(
14051413 ? { defaultModel : entry . defaultModel }
14061414 : { } ) ,
14071415 ...( entry . free !== undefined ? { free : entry . free } : { } ) ,
1416+ ...( entry . maxTokens !== undefined ? { maxTokens : entry . maxTokens } : { } ) ,
1417+ ...( entry . temperature !== undefined
1418+ ? { temperature : entry . temperature }
1419+ : { } ) ,
1420+ ...( entry . topP !== undefined ? { topP : entry . topP } : { } ) ,
14081421 ...( entry . bifrostVirtualKey === true ? { bifrostVirtualKey : true } : { } ) ,
14091422 ...( entry . anthropic === true ? { anthropic : true } : { } ) ,
14101423 ...( go ? { opencodeGo : true } : { } ) ,
@@ -1482,6 +1495,11 @@ export function buildProviderCatalog(
14821495 ? { defaultModel : p . defaultModel }
14831496 : { } ) ,
14841497 ...( p . free !== undefined ? { free : p . free } : { } ) ,
1498+ ...( p . maxTokens !== undefined ? { maxTokens : p . maxTokens } : { } ) ,
1499+ ...( p . temperature !== undefined
1500+ ? { temperature : p . temperature }
1501+ : { } ) ,
1502+ ...( p . topP !== undefined ? { topP : p . topP } : { } ) ,
14851503 ...( p . bifrostVirtualKey === true ? { bifrostVirtualKey : true } : { } ) ,
14861504 ...( p . anthropic === true ? { anthropic : true } : { } ) ,
14871505 ...( go ? { opencodeGo : true } : { } ) ,
0 commit comments