Repository Public
1/**2 * CLI: refresh the model registry with the owner keys from .env.3 * pnpm models:sync → all providers with a key4 * pnpm models:sync anthropic → one provider5 */6import "./load-env";7import { syncAllWithEnvKeys, syncProvider } from "@/lib/ai/registry";8import { closeDb } from "@/db";9import { isProviderId } from "@/lib/ai/core/types";1011async function main() {12 const target = process.argv[2];13 if (target) {14 if (!isProviderId(target)) throw new Error(`Unknown provider ${target}`);15 const key = { openai: process.env.OPENAI_API_KEY, anthropic: process.env.ANTHROPIC_API_KEY, gemini: process.env.GOOGLE_GEMINI_API_KEY, xai: process.env.XAI_API_KEY }[target];16 if (!key) throw new Error(`No key for ${target} in the environment`);17 console.table([await syncProvider(target, key, "cli")]);18 } else {19 console.table(await syncAllWithEnvKeys("cli"));20 }21 await closeDb();22}2324main().catch((e) => {25 console.error(e);26 process.exit(1);27});28