@@ -120,7 +120,7 @@ function migrateStandardProvider(info: ConfigProviderV1.Info) {
120120 body : info . options && options . body ,
121121 models :
122122 info . models &&
123- Object . fromEntries ( Object . entries ( info . models ) . map ( ( [ name , model ] ) => [ name , migrateModel ( model ) ] ) ) ,
123+ Object . fromEntries ( Object . entries ( info . models ) . map ( ( [ name , model ] ) => [ name , migrateModel ( model , info . npm ) ] ) ) ,
124124 }
125125}
126126
@@ -166,7 +166,7 @@ export function providerID(input: string) {
166166 return input
167167}
168168
169- function migrateModel ( info : typeof ConfigProviderV1 . Model . Type ) {
169+ function migrateModel ( info : typeof ConfigProviderV1 . Model . Type , npm : string | undefined ) {
170170 const disableThinkingBlockBinding =
171171 info . options ?. thinking ?. blockBinding === false || info . options ?. reasoningConfig ?. blockBinding === false
172172 const options = info . options && { ...info . options }
@@ -185,7 +185,13 @@ function migrateModel(info: typeof ConfigProviderV1.Model.Type) {
185185 }
186186 }
187187
188- const settings = options && ConfigProviderOptionsV1 . model ( options )
188+ const compatible = ( info . provider ?. npm ?? npm ) === "@ai-sdk/openai-compatible"
189+ const split = ( input : Record < string , unknown > ) =>
190+ compatible
191+ ? ConfigProviderOptionsV1 . compatibleModel ( input )
192+ : { settings : ConfigProviderOptionsV1 . model ( input ) , body : undefined }
193+ const migrated = options && split ( options )
194+ const settings = migrated ?. settings
189195 const compatibility = Model . compatibility ( info . interleaved )
190196 const costs = info . cost && [
191197 {
@@ -224,12 +230,10 @@ function migrateModel(info: typeof ConfigProviderV1.Model.Type) {
224230 settings : info . provider ?. api ? { ...settings , baseURL : info . provider . api } : settings ,
225231 capabilities,
226232 headers : info . headers ,
233+ body : migrated ?. body ,
227234 variants :
228235 info . variants &&
229- Object . entries ( info . variants ) . map ( ( [ id , options ] ) => ( {
230- id,
231- settings : ConfigProviderOptionsV1 . model ( options ) ,
232- } ) ) ,
236+ Object . entries ( info . variants ) . map ( ( [ id , options ] ) => ( { id, ...split ( options ) } ) ) ,
233237 cost : costs ,
234238 disabled : info . status === "deprecated" ? true : undefined ,
235239 limit : info . limit && {
0 commit comments