33import { z } from "zod" ;
44import path from "node:path" ;
55import { readdir } from "node:fs/promises" ;
6- import * as readline from "node:readline" ;
76import { ModelFamilyValues } from "../src/family.js" ;
87
98// Venice API endpoint
109const API_ENDPOINT = "https://api.venice.ai/api/v1/models?type=text" ;
1110
12- async function promptForApiKey ( ) : Promise < string | null > {
13- const rl = readline . createInterface ( {
14- input : process . stdin ,
15- output : process . stdout ,
16- } ) ;
17-
18- return new Promise ( ( resolve ) => {
19- rl . question (
20- "Enter Venice API key to include alpha models (or press Enter to skip): " ,
21- ( answer ) => {
22- rl . close ( ) ;
23- const trimmed = answer . trim ( ) ;
24- resolve ( trimmed . length > 0 ? trimmed : null ) ;
25- } ,
26- ) ;
27- } ) ;
28- }
29-
3011// Zod schemas for API response validation
3112const Capabilities = z
3213 . object ( {
@@ -69,6 +50,7 @@ const ModelSpec = z
6950 . object ( {
7051 pricing : Pricing . optional ( ) ,
7152 availableContextTokens : z . number ( ) ,
53+ maxCompletionTokens : z . number ( ) . optional ( ) ,
7254 capabilities : Capabilities ,
7355 constraints : z . any ( ) . optional ( ) ,
7456 name : z . string ( ) ,
@@ -257,11 +239,7 @@ function mergeModel(
257239 const caps = spec . capabilities ;
258240
259241 const contextTokens = spec . availableContextTokens ;
260- const proposedOutputTokens = Math . floor ( contextTokens / 4 ) ;
261- const outputTokens =
262- existing ?. limit ?. output !== undefined && existing . limit . output < proposedOutputTokens
263- ? existing . limit . output
264- : proposedOutputTokens
242+ const outputTokens = spec . maxCompletionTokens ?? Math . floor ( contextTokens / 4 ) ;
265243
266244 const openWeights = spec . modelSource
267245 ? spec . modelSource . toLowerCase ( ) . includes ( "huggingface" )
@@ -487,7 +465,7 @@ async function main() {
487465 "models" ,
488466 ) ;
489467
490- // Check for API key from CLI argument, environment, or prompt
468+ // Check for API key from CLI argument or environment variable
491469 let apiKey : string | null = null ;
492470
493471 // Check CLI args for --api-key=xxx or --api-key xxx
@@ -506,11 +484,6 @@ async function main() {
506484 apiKey = process . env . VENICE_API_KEY ?? null ;
507485 }
508486
509- // Prompt if still no key
510- if ( ! apiKey ) {
511- apiKey = await promptForApiKey ( ) ;
512- }
513-
514487 const includeAlpha = apiKey !== null ;
515488
516489 if ( dryRun ) {
0 commit comments