@@ -240,8 +240,6 @@ export default defineCommand({
240240 }
241241 const format = detectOutputFormat ( config . output ) ;
242242
243- const credential = await resolveConsoleGatewayCredential ( config ) ;
244-
245243 let models : string [ ] ;
246244 const typeMap = new Map < string , string > ( ) ;
247245
@@ -254,21 +252,8 @@ export default defineCommand({
254252 . filter ( Boolean ) ,
255253 ) ,
256254 ] ;
257- const searchResults = await Promise . all (
258- models . map ( ( name ) => fetchModelList ( config , credential . token , { name, pageSize : 50 } ) ) ,
259- ) ;
260- for ( let idx = 0 ; idx < models . length ; idx ++ ) {
261- const matched = searchResults [ idx ] . models . find ( ( item ) => item . model === models [ idx ] ) ;
262- if ( matched ) {
263- typeMap . set ( models [ idx ] , resolveModelType ( ( matched . capabilities as string [ ] ) || [ ] ) ) ;
264- }
265- }
266255 } else {
267- const modelInfos = await fetchAllModels ( config , credential . token ) ;
268- models = modelInfos . map ( ( info ) => info . name ) ;
269- for ( const info of modelInfos ) {
270- typeMap . set ( info . name , info . type ) ;
271- }
256+ models = [ ] ;
272257 }
273258
274259 const requestData = {
@@ -280,13 +265,33 @@ export default defineCommand({
280265 {
281266 api : FREE_TIER_API ,
282267 data : requestData ,
283- token : credential . token . slice ( 0 , 8 ) + "..." ,
284268 } ,
285269 format ,
286270 ) ;
287271 return ;
288272 }
289273
274+ const credential = await resolveConsoleGatewayCredential ( config ) ;
275+
276+ if ( ! modelFlag ) {
277+ const modelInfos = await fetchAllModels ( config , credential . token ) ;
278+ models = modelInfos . map ( ( info ) => info . name ) ;
279+ for ( const info of modelInfos ) {
280+ typeMap . set ( info . name , info . type ) ;
281+ }
282+ requestData . queryFreeTierQuotaRequest . models = models ;
283+ } else {
284+ const searchResults = await Promise . all (
285+ models . map ( ( name ) => fetchModelList ( config , credential . token , { name, pageSize : 50 } ) ) ,
286+ ) ;
287+ for ( let idx = 0 ; idx < models . length ; idx ++ ) {
288+ const matched = searchResults [ idx ] . models . find ( ( item ) => item . model === models [ idx ] ) ;
289+ if ( matched ) {
290+ typeMap . set ( models [ idx ] , resolveModelType ( ( matched . capabilities as string [ ] ) || [ ] ) ) ;
291+ }
292+ }
293+ }
294+
290295 const [ quotaResult , stopResult ] = await Promise . all ( [
291296 callConsoleGateway ( config , credential . token , {
292297 api : FREE_TIER_API ,
0 commit comments