@@ -112,8 +112,11 @@ type FirstAgentCommandOptions = {
112112 model ?: string ;
113113 sessionKey ?: string ;
114114 streamParams ?: {
115+ frequencyPenalty ?: number ;
115116 maxTokens ?: number ;
117+ presencePenalty ?: number ;
116118 responseFormat ?: Record < string , unknown > ;
119+ seed ?: number ;
117120 temperature ?: number ;
118121 topP ?: number ;
119122 } ;
@@ -1402,6 +1405,46 @@ describe("OpenAI-compatible HTTP API (e2e)", () => {
14021405 }
14031406 } ) ;
14041407
1408+ it ( "forwards inbound penalty and seed params into streamParams" , async ( ) => {
1409+ const port = enabledPort ;
1410+ const mockAgentOnce = ( payloads : Array < { text : string } > ) => {
1411+ agentCommand . mockClear ( ) ;
1412+ agentCommand . mockResolvedValueOnce ( { payloads } as never ) ;
1413+ } ;
1414+ const getStreamParams = ( ) => firstAgentCommandOptions ( ) ?. streamParams ;
1415+
1416+ {
1417+ mockAgentOnce ( [ { text : "hello" } ] ) ;
1418+ const res = await postChatCompletions ( port , {
1419+ model : "openclaw" ,
1420+ frequency_penalty : - 0.5 ,
1421+ presence_penalty : 1.25 ,
1422+ seed : 12345 ,
1423+ messages : [ { role : "user" , content : "hi" } ] ,
1424+ } ) ;
1425+ expect ( res . status ) . toBe ( 200 ) ;
1426+ expect ( getStreamParams ( ) ) . toMatchObject ( {
1427+ frequencyPenalty : - 0.5 ,
1428+ presencePenalty : 1.25 ,
1429+ seed : 12345 ,
1430+ } ) ;
1431+ await res . text ( ) ;
1432+ }
1433+
1434+ for ( const body of [ { frequency_penalty : 3 } , { presence_penalty : - 3 } , { seed : 1.5 } ] ) {
1435+ agentCommand . mockClear ( ) ;
1436+ const res = await postChatCompletions ( port , {
1437+ model : "openclaw" ,
1438+ ...body ,
1439+ messages : [ { role : "user" , content : "hi" } ] ,
1440+ } ) ;
1441+ expect ( res . status ) . toBe ( 400 ) ;
1442+ const json = ( await res . json ( ) ) as { error ?: { type ?: string ; message ?: string } } ;
1443+ expect ( json . error ?. type ) . toBe ( "invalid_request_error" ) ;
1444+ expect ( agentCommand ) . toHaveBeenCalledTimes ( 0 ) ;
1445+ }
1446+ } ) ;
1447+
14051448 it ( "maps provider format failures to OpenAI-compatible 400 errors" , async ( ) => {
14061449 const port = enabledPort ;
14071450
0 commit comments