@@ -32,7 +32,7 @@ export async function getLatestModels(
3232 } ) . then ( ( res ) => res . text ( ) )
3333
3434 try {
35- const models = modelsSchema . parse ( JSON . parse ( resposeText ) ) . data
35+ const models = listModelSchema . parse ( JSON . parse ( resposeText ) ) . data
3636
3737 return models
3838 . filter (
@@ -68,7 +68,7 @@ export async function getLatestModels(
6868 retries : currentConfig . config . maxRetries ,
6969 maxTimeout : currentConfig . config . timeout ,
7070 onRetry ( error , attempt , retryInfo ) {
71- console . log ( `Retry attempt ${ attempt } failed with error: ${ error } ` )
71+ console . error ( `Retry attempt ${ attempt } failed with error` , error )
7272 currentConfig . disable ( )
7373 currentConfig = pool . getProvider ( )
7474 }
@@ -77,13 +77,13 @@ export async function getLatestModels(
7777 return retry ( currentConfig . config )
7878}
7979
80- const modelsSchema = z . object ( {
81- object : z . literal ( 'list' ) ,
80+ const listModelSchema = z . object ( {
81+ object : z . literal ( 'list' ) . optional ( ) ,
8282 data : z . array (
8383 z . object ( {
8484 id : z . string ( ) ,
85- object : z . literal ( 'model' ) ,
86- owned_by : z . string ( )
85+ object : z . string ( ) . optional ( ) ,
86+ owned_by : z . string ( ) . optional ( )
8787 } )
8888 )
8989} )
0 commit comments