File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ export const OpenrouterChatCompleteConfig: ProviderConfig = {
4242 min : 0 ,
4343 max : 2 ,
4444 } ,
45+ modalities : {
46+ param : 'modalities' ,
47+ } ,
48+ reasoning : {
49+ param : 'reasoning' ,
50+ } ,
4551 top_p : {
4652 param : 'top_p' ,
4753 default : 1 ,
@@ -54,10 +60,22 @@ export const OpenrouterChatCompleteConfig: ProviderConfig = {
5460 tool_choice : {
5561 param : 'tool_choice' ,
5662 } ,
63+ transforms : {
64+ param : 'transforms' ,
65+ } ,
66+ provider : {
67+ param : 'provider' ,
68+ } ,
69+ models : {
70+ param : 'models' ,
71+ } ,
5772 stream : {
5873 param : 'stream' ,
5974 default : false ,
6075 } ,
76+ response_format : {
77+ param : 'response_format' ,
78+ } ,
6179} ;
6280
6381interface OpenrouterChatCompleteResponse extends ChatCompletionResponse {
@@ -143,8 +161,18 @@ export const OpenrouterChatCompleteResponseTransform: (
143161} ;
144162
145163export const OpenrouterChatCompleteStreamChunkTransform : (
146- response : string
147- ) => string = ( responseChunk ) => {
164+ response : string ,
165+ fallbackId : string ,
166+ _streamState : Record < string , boolean > ,
167+ _strictOpenAiCompliance : boolean ,
168+ gatewayRequest : Params
169+ ) => string = (
170+ responseChunk ,
171+ fallbackId ,
172+ _streamState ,
173+ _strictOpenAiCompliance ,
174+ gatewayRequest
175+ ) => {
148176 let chunk = responseChunk . trim ( ) ;
149177 chunk = chunk . replace ( / ^ d a t a : / , '' ) ;
150178 chunk = chunk . trim ( ) ;
@@ -154,7 +182,7 @@ export const OpenrouterChatCompleteStreamChunkTransform: (
154182 if ( chunk . includes ( 'OPENROUTER PROCESSING' ) ) {
155183 chunk = JSON . stringify ( {
156184 id : `${ Date . now ( ) } ` ,
157- model : '' ,
185+ model : gatewayRequest . model || '' ,
158186 object : 'chat.completion.chunk' ,
159187 created : Date . now ( ) ,
160188 choices : [
You can’t perform that action at this time.
0 commit comments