pi-mono/packages/ai/catalog/providers/vercel-ai-gateway.ts
Armin Ronacher 2e0f175bd5
feat(ai): refactor provider definitions (#11368)
This builds the model catalog from per-provider definitions and
models.dev v2 data.

It eplacer `generate-models.ts` with one `defineProvider()` file per
built-in provider, shared model-family rules (Claude, GPT, DeepSeek,
Kimi, Google), and source adapters. models.dev is read through its v2
API. Outputs and CLI flags are unchanged.
2026-10-28 11:06:10 +01:00

14 lines
595 B
TypeScript

import { defineProvider } from "../define.ts";
import { isKimiK3FamilyId, KIMI_K3_MAX_TOKENS } from "../families/kimi.ts";
export default defineProvider({
id: "vercel-ai-gateway",
models: (ctx) =>
structuredClone(ctx.sources.aiGateway.chat).map((model) =>
// Keep Kimi K3's canonical output limit when gateway metadata is missing or incorrect.
model.id.startsWith("moonshotai/") && isKimiK3FamilyId(model.id.slice("moonshotai/".length))
? { ...model, maxTokens: KIMI_K3_MAX_TOKENS }
: model,
),
classifiers: (ctx) => structuredClone(ctx.sources.aiGateway.classifiers),
});