Compare commits

..
Author SHA1 Message Date
Aiden Cline 7380da1e2d fix(sync): retain curated base model links 2026-06-06 18:32:13 -05:00
1886 changed files with 6307 additions and 8245 deletions

No files matched your search

@@ -1,68 +0,0 @@
name: Close stale pull requests
on:
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
permissions:
issues: write
pull-requests: write
jobs:
close-stale-pull-requests:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
env:
REVIEWER: rekram1-node
with:
script: |
const { owner, repo } = context.repo
const now = Date.now()
const weekAgo = now - 7 * 24 * 60 * 60 * 1000
const monthAgo = now - 30 * 24 * 60 * 60 * 1000
const pulls = await github.paginate(github.rest.pulls.list, {
owner,
repo,
state: "open",
per_page: 100,
})
const feedbackPulls = new Set()
for (const qualifier of ["commenter", "reviewed-by"]) {
const results = await github.paginate(
github.rest.search.issuesAndPullRequests,
{
q: `repo:${owner}/${repo} is:pr is:open ${qualifier}:${process.env.REVIEWER}`,
per_page: 100,
},
)
for (const result of results) feedbackPulls.add(result.number)
}
for (const pull of pulls) {
const updatedAt = Date.parse(pull.updated_at)
const monthStale = updatedAt < monthAgo
const feedbackStale = updatedAt < weekAgo && feedbackPulls.has(pull.number)
if (!monthStale && !feedbackStale) continue
const reason = monthStale
? "it has not been updated in 30 days"
: `it has not been updated in 7 days after feedback from @${process.env.REVIEWER}`
await github.rest.issues.createComment({
owner,
repo,
issue_number: pull.number,
body: `Closing this pull request as stale because ${reason}. Feel free to reopen it or submit a new pull request if the work is resumed.`,
})
await github.rest.pulls.update({
owner,
repo,
pull_number: pull.number,
state: "closed",
})
}
+2 -4
View File
@@ -63,9 +63,7 @@ jobs:
- name: Sync model catalogs
run: bun models:sync ${{ matrix.provider }}
env:
BASETEN_API_KEY: ${{ secrets.BASETEN_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
VENICE_API_KEY: ${{ secrets.VENICE_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
@@ -83,7 +81,7 @@ jobs:
LABELS: automation,model-sync,provider:${{ matrix.provider }}
TITLE: "chore(sync): update ${{ matrix.name }} model catalog"
run: |
if [ -z "$(git status --porcelain -- models providers)" ]; then
if [ -z "$(git status --porcelain -- providers)" ]; then
echo "No model catalog changes found."
exit 0
fi
@@ -92,7 +90,7 @@ jobs:
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch --no-tags --depth=1 origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH" || true
git checkout -B "$BRANCH"
git add models providers
git add providers
git commit -m "$TITLE"
git push --force-with-lease origin "$BRANCH"
+3 -3
View File
@@ -10,9 +10,9 @@ knowledge = "2025-04"
open_weights = false
[limit]
context = 1_000_000
output = 64_000
context = 131_072
output = 16_384
[modalities]
input = ["text", "image"]
input = ["text"]
output = ["text"]
-18
View File
@@ -1,18 +0,0 @@
name = "Claude Fable 5"
family = "claude-fable"
release_date = "2026-06-09"
last_updated = "2026-06-09"
attachment = true
reasoning = true
temperature = false
tool_call = true
open_weights = false
knowledge = "2026-01-31"
[limit]
context = 1_000_000
output = 128_000
[modalities]
input = ["text", "image", "pdf"]
output = ["text"]
-19
View File
@@ -1,19 +0,0 @@
name = "Command A Plus"
family = "command-a"
release_date = "2026-05-20"
last_updated = "2026-06-09"
attachment = true
reasoning = true
temperature = true
knowledge = "2025-04-01"
tool_call = true
open_weights = true
structured_output = true
[limit]
context = 128_000
output = 64_000
[modalities]
input = ["text", "image"]
output = ["text"]
-19
View File
@@ -1,19 +0,0 @@
name = "North Mini Code"
family = "north"
release_date = "2026-06-09"
last_updated = "2026-06-09"
attachment = false
reasoning = true
temperature = true
structured_output = true
knowledge = "2025-09-23"
tool_call = true
open_weights = true
[limit]
context = 256_000
output = 64_000
[modalities]
input = ["text"]
output = ["text"]
+2 -2
View File
@@ -1,7 +1,7 @@
name = "Gemini 2.5 Flash"
family = "gemini-flash"
release_date = "2025-06-17"
last_updated = "2025-06-17"
release_date = "2025-03-20"
last_updated = "2025-06-05"
attachment = true
reasoning = true
temperature = true
-18
View File
@@ -1,18 +0,0 @@
name = "Gemini 2.5 Pro TTS"
family = "gemini-pro"
release_date = "2025-09-30"
last_updated = "2025-12-10"
attachment = false
reasoning = false
temperature = false
tool_call = false
knowledge = "2025-01"
open_weights = false
[limit]
context = 32_768
output = 16_384
[modalities]
input = ["text"]
output = ["audio"]
+2 -2
View File
@@ -1,7 +1,7 @@
name = "Gemini 2.5 Pro"
family = "gemini-pro"
release_date = "2025-06-17"
last_updated = "2025-06-17"
release_date = "2025-03-20"
last_updated = "2025-06-05"
attachment = true
reasoning = true
temperature = true
+2 -2
View File
@@ -1,7 +1,7 @@
name = "Mistral Large 2.1"
family = "mistral-large"
release_date = "2024-11-18"
last_updated = "2024-11-18"
release_date = "2024-11-01"
last_updated = "2024-11-04"
attachment = false
reasoning = false
temperature = true
+1 -1
View File
@@ -1,5 +1,5 @@
name = "Kimi K2.5"
family = "kimi-k2"
family = "kimi-k2.5"
release_date = "2026-01"
last_updated = "2026-01"
attachment = false
+1 -1
View File
@@ -1,5 +1,5 @@
name = "Kimi K2.6"
family = "kimi-k2"
family = "kimi-k2.6"
release_date = "2026-04-21"
last_updated = "2026-04-21"
attachment = true
-23
View File
@@ -1,23 +0,0 @@
name = "Kimi K2.7 Code"
family = "kimi-k2"
release_date = "2026-06-12"
last_updated = "2026-06-12"
attachment = true
reasoning = true
temperature = false
tool_call = true
structured_output = true
knowledge = "2025-01"
open_weights = true
[limit]
context = 262_144
output = 262_144
[modalities]
input = ["text", "image", "video"]
output = ["text"]
[[weights]]
label = "Hugging Face"
url = "https://huggingface.co/moonshotai/Kimi-K2.7-Code"
-19
View File
@@ -1,19 +0,0 @@
name = "GPT-5.5 Instant"
release_date = "2026-05-05"
last_updated = "2026-05-28"
attachment = true
reasoning = true
temperature = true
tool_call = true
structured_output = true
knowledge = "2025-12-01"
open_weights = false
[limit]
context = 400_000
input = 400_000
output = 128_000
[modalities]
input = ["text", "image", "pdf"]
output = ["text"]
-17
View File
@@ -1,17 +0,0 @@
name = "Sarvam 105B"
family = "sarvam"
release_date = "2025-09-01"
last_updated = "2025-09-01"
attachment = false
reasoning = true
temperature = true
tool_call = true
open_weights = true
[limit]
context = 131_072
output = 131_072
[modalities]
input = ["text"]
output = ["text"]
-17
View File
@@ -1,17 +0,0 @@
name = "Sarvam 30B"
family = "sarvam"
release_date = "2026-02-18"
last_updated = "2026-02-18"
attachment = false
reasoning = true
temperature = true
tool_call = true
open_weights = true
[limit]
context = 128_000
output = 128_000
[modalities]
input = ["text"]
output = ["text"]
-22
View File
@@ -1,22 +0,0 @@
name = "Step 3.7 Flash"
release_date = "2026-05-29"
last_updated = "2026-05-29"
attachment = true
reasoning = true
temperature = true
tool_call = true
knowledge = "2026-01-01"
open_weights = true
[limit]
context = 256_000
input = 256_000
output = 256_000
[modalities]
input = ["text", "image"]
output = ["text"]
[[weights]]
label = "Hugging Face"
url = "https://huggingface.co/stepfun-ai/Step-3.7-Flash"
+1 -2
View File
@@ -6,11 +6,10 @@ attachment = true
reasoning = false
temperature = true
tool_call = true
structured_output = true
open_weights = false
[limit]
context = 1_000_000
context = 2_000_000
output = 30_000
[modalities]
+1 -2
View File
@@ -6,11 +6,10 @@ attachment = true
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = false
[limit]
context = 1_000_000
context = 2_000_000
output = 30_000
[modalities]
-1
View File
@@ -6,7 +6,6 @@ attachment = true
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = false
[limit]
@@ -1,22 +0,0 @@
name = "MiMo-V2.5-Pro-UltraSpeed"
family = "mimo"
release_date = "2026-06-08"
last_updated = "2026-06-09"
attachment = false
reasoning = true
temperature = true
tool_call = true
knowledge = "2024-12"
open_weights = true
[limit]
context = 1_048_576
output = 131_072
[modalities]
input = ["text"]
output = ["text"]
[[weights]]
label = "Hugging Face"
url = "https://huggingface.co/XiaomiMiMo/MiMo-V2.5-Pro-FP4-DFlash"
-18
View File
@@ -1,18 +0,0 @@
name = "GLM-5.2"
family = "glm"
release_date = "2026-06-13"
last_updated = "2026-06-13"
attachment = false
reasoning = true
temperature = true
tool_call = true
structured_output = true
open_weights = false
[limit]
context = 1_000_000
output = 131_072
[modalities]
input = ["text"]
output = ["text"]
+2 -3
View File
@@ -18,13 +18,12 @@
"test": "bun test",
"validate": "bun ./packages/core/script/validate.ts",
"compare:migrations": "bun ./packages/core/script/compare-model-migrations.ts",
"baseten:sync": "bun ./packages/core/script/sync-models.ts baseten",
"cloudflare:sync": "bun ./packages/core/script/sync-models.ts cloudflare-workers-ai",
"chutes:generate": "bun ./packages/core/script/generate-chutes.ts",
"databricks:generate": "bun ./packages/core/script/generate-databricks.ts",
"helicone:generate": "bun ./packages/core/script/generate-helicone.ts",
"venice:sync": "bun ./packages/core/script/sync-models.ts venice",
"vercel:generate": "bun ./packages/core/script/sync-models.ts vercel",
"venice:generate": "bun ./packages/core/script/generate-venice.ts",
"vercel:generate": "bun ./packages/core/script/generate-vercel.ts",
"wandb:generate": "bun ./packages/core/script/generate-wandb.ts",
"digitalocean:generate": "bun ./packages/core/script/generate-digitalocean.ts",
"ambient:generate": "bun ./packages/core/script/generate-ambient.ts",
+1 -4
View File
@@ -13,7 +13,7 @@ import { z } from "zod";
import path from "node:path";
import { existsSync, readFileSync } from "node:fs";
import { mkdir } from "node:fs/promises";
import { inferKimiFamily, ModelFamilyValues } from "../src/family.js";
import { ModelFamilyValues } from "../src/family.js";
const API_ENDPOINT = "https://llm.chutes.ai/v1/models";
const MODEL_METADATA_DIR = path.join(import.meta.dirname, "..", "..", "..", "models");
@@ -261,9 +261,6 @@ function matchesFamily(target: string, family: string): boolean {
}
function inferFamily(modelId: string, modelName: string): string | undefined {
const kimiFamily = inferKimiFamily(modelId, modelName);
if (kimiFamily !== undefined) return kimiFamily;
const sortedFamilies = [...ModelFamilyValues].sort((a, b) => b.length - a.length);
// First pass: try exact substring matches
@@ -26,7 +26,7 @@
import { z } from "zod";
import path from "node:path";
import { mkdir } from "node:fs/promises";
import { inferKimiFamily, ModelFamilyValues } from "../src/family.js";
import { ModelFamilyValues } from "../src/family.js";
const MODELS_API = "https://api.digitalocean.com/v2/gen-ai/models";
const PRICING_API = "https://www.digitalocean.com/api/static-content/v1/products";
@@ -142,7 +142,7 @@ const PRICING_NAME_MAP: Record<string, string> = {
// DO-hosted
"qwen3-32b": "alibaba-qwen3-32b",
"minimax m2.5 (public preview)": "minimax-m2.5",
"kimi k2.5": "kimi-k2",
"kimi k2.5": "kimi-k2.5",
"nvidia nemotron 3 super 120b (public preview)": "nvidia-nemotron-3-super-120b",
"glm 5": "glm-5",
};
@@ -311,9 +311,6 @@ function formatNumber(n: number): string {
}
function inferFamily(modelId: string, modelName: string): string | undefined {
const kimiFamily = inferKimiFamily(modelId, modelName);
if (kimiFamily !== undefined) return kimiFamily;
const sorted = [...ModelFamilyValues].sort((a, b) => b.length - a.length);
const targets = [modelId.toLowerCase(), modelName.toLowerCase()];
for (const family of sorted) {
@@ -4,8 +4,6 @@ import { mkdir } from "node:fs/promises";
import path from "node:path";
import { z } from "zod";
import { inferKimiFamily } from "../src/family.js";
// Friendli API endpoint
const API_ENDPOINT = "https://api.friendli.ai/serverless/v1/models";
@@ -55,9 +53,6 @@ const familyPatterns: [RegExp, string][] = [
];
function inferFamily(modelId: string, modelName: string): string | undefined {
const kimiFamily = inferKimiFamily(modelId, modelName);
if (kimiFamily !== undefined) return kimiFamily;
for (const [pattern, family] of familyPatterns) {
if (pattern.test(modelId) || pattern.test(modelName)) {
return family;
+653
View File
@@ -0,0 +1,653 @@
#!/usr/bin/env bun
import { z } from "zod";
import path from "node:path";
import { readdir } from "node:fs/promises";
import { ModelFamilyValues } from "../src/family.js";
// Venice API endpoint
const API_ENDPOINT = "https://api.venice.ai/api/v1/models?type=text";
// Zod schemas for API response validation
const Capabilities = z
.object({
optimizedForCode: z.boolean().optional(),
quantization: z.string().optional(),
supportsAudioInput: z.boolean().optional(),
supportsFunctionCalling: z.boolean().optional(),
supportsLogProbs: z.boolean().optional(),
supportsReasoning: z.boolean().optional(),
supportsResponseSchema: z.boolean().optional(),
supportsVideoInput: z.boolean().optional(),
supportsVision: z.boolean().optional(),
supportsWebSearch: z.boolean().optional(),
})
.passthrough();
const PricingTier = z.object({ usd: z.number(), diem: z.number().optional() }).passthrough();
const ExtendedPricing = z
.object({
context_token_threshold: z.number(),
input: PricingTier,
output: PricingTier,
cache_input: PricingTier.optional(),
cache_write: PricingTier.optional(),
})
.passthrough();
const Pricing = z
.object({
input: PricingTier,
output: PricingTier,
cache_input: PricingTier.optional(),
cache_write: PricingTier.optional(),
extended: ExtendedPricing.optional(),
})
.passthrough();
const ModelSpec = z
.object({
pricing: Pricing.optional(),
availableContextTokens: z.number(),
maxCompletionTokens: z.number().optional(),
capabilities: Capabilities,
constraints: z.any().optional(),
name: z.string(),
modelSource: z.string().optional(),
offline: z.boolean().optional(),
privacy: z.string().optional(),
traits: z.array(z.string()).optional(),
})
.passthrough();
const VeniceModel = z
.object({
created: z.number(),
id: z.string(),
model_spec: ModelSpec,
object: z.string(),
owned_by: z.string(),
type: z.string(),
})
.passthrough();
const VeniceResponse = z
.object({
data: z.array(VeniceModel),
object: z.string(),
type: z.string(),
})
.passthrough();
function matchesFamily(target: string, family: string): boolean {
const targetLower = target.toLowerCase();
const familyLower = family.toLowerCase();
let familyIdx = 0;
for (let i = 0; i < targetLower.length && familyIdx < familyLower.length; i++) {
if (targetLower[i] === familyLower[familyIdx]) {
familyIdx++;
}
}
return familyIdx === familyLower.length;
}
function inferFamily(modelId: string, modelName: string): string | undefined {
const sortedFamilies = [...ModelFamilyValues].sort((a, b) => b.length - a.length);
for (const family of sortedFamilies) {
if (matchesFamily(modelId, family)) {
return family;
}
}
for (const family of sortedFamilies) {
if (matchesFamily(modelName, family)) {
return family;
}
}
return undefined;
}
function buildInputModalities(capabilities: z.infer<typeof Capabilities>): string[] {
const mods: string[] = ["text"];
if (capabilities.supportsVision) mods.push("image");
if (capabilities.supportsAudioInput) mods.push("audio");
if (capabilities.supportsVideoInput) mods.push("video");
return mods;
}
function formatNumber(n: number): string {
if (n >= 1000) {
// Format with underscores for readability (e.g., 131_072)
return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "_");
}
return n.toString();
}
function timestampToDate(timestamp: number): string {
const date = new Date(timestamp * 1000);
return date.toISOString().slice(0, 10);
}
function getTodayDate(): string {
return new Date().toISOString().slice(0, 10);
}
interface ExistingModel {
name?: string;
family?: string;
attachment?: boolean;
reasoning?: boolean;
tool_call?: boolean;
structured_output?: boolean;
temperature?: boolean;
knowledge?: string;
release_date?: string;
last_updated?: string;
open_weights?: boolean;
interleaved?: boolean | { field: string };
status?: string;
cost?: {
input?: number;
output?: number;
reasoning?: number;
cache_read?: number;
cache_write?: number;
context_over_200k?: {
input?: number;
output?: number;
cache_read?: number;
cache_write?: number;
context_min?: number;
};
tiers?: Array<{
tier: {
type?: "context";
size: number;
};
input?: number;
output?: number;
cache_read?: number;
cache_write?: number;
}>;
};
limit?: {
context?: number;
input?: number;
output?: number;
};
modalities?: {
input?: string[];
output?: string[];
};
provider?: {
npm?: string;
api?: string;
};
}
async function loadExistingModel(filePath: string): Promise<ExistingModel | null> {
try {
const file = Bun.file(filePath);
if (!(await file.exists())) {
return null;
}
const toml = await import(filePath, { with: { type: "toml" } }).then(
(mod) => mod.default,
);
return toml as ExistingModel;
} catch (e) {
console.warn(`Warning: Failed to parse existing file ${filePath}:`, e);
return null;
}
}
function getExistingLongContextMin(existing: ExistingModel | null) {
return (
existing?.cost?.tiers?.find(
(tier) =>
(tier.tier.type === undefined || tier.tier.type === "context") &&
tier.tier.size >= 200_000,
)?.tier.size ?? 200_000
);
}
function getExistingLongContextCost(existing: ExistingModel | null) {
return (
existing?.cost?.tiers?.find(
(tier) =>
(tier.tier.type === undefined || tier.tier.type === "context") &&
tier.tier.size >= 200_000,
) ?? existing?.cost?.context_over_200k
);
}
function getLongContextMin(cost: { context_min?: number }) {
return cost.context_min ?? 200_000;
}
interface MergedModel {
name: string;
family?: string;
attachment: boolean;
reasoning: boolean;
tool_call: boolean;
structured_output?: boolean;
temperature: boolean;
knowledge?: string;
release_date: string;
last_updated: string;
open_weights: boolean;
interleaved?: boolean | { field: string };
status?: string;
cost?: {
input: number;
output: number;
cache_read?: number;
cache_write?: number;
context_over_200k?: {
input: number;
output: number;
cache_read?: number;
cache_write?: number;
context_min?: number;
};
};
limit: {
context: number;
output: number;
};
modalities: {
input: string[];
output: string[];
};
}
function mergeModel(
apiModel: z.infer<typeof VeniceModel>,
existing: ExistingModel | null,
): MergedModel {
const spec = apiModel.model_spec;
const caps = spec.capabilities;
const contextTokens = spec.availableContextTokens;
const outputTokens = spec.maxCompletionTokens ?? Math.floor(contextTokens / 4);
const openWeights = spec.modelSource?.toLowerCase().includes("huggingface") ?? false;
const inputModalities = buildInputModalities(caps);
if (existing?.modalities?.input?.includes("pdf") && !inputModalities.includes("pdf")) {
inputModalities.push("pdf");
}
const attachment =
caps.supportsVision === true ||
caps.supportsAudioInput === true ||
caps.supportsVideoInput === true;
const merged: MergedModel = {
name: spec.name,
attachment,
reasoning: caps.supportsReasoning === true,
tool_call: caps.supportsFunctionCalling === true,
temperature: true,
release_date: timestampToDate(apiModel.created),
last_updated: getTodayDate(),
open_weights: openWeights,
limit: {
context: contextTokens,
output: outputTokens,
},
modalities: {
input: inputModalities,
output: ["text"],
},
};
// structured_output only if true
if (caps.supportsResponseSchema === true) {
merged.structured_output = true;
}
// Cost from API
if (spec.pricing) {
merged.cost = {
input: spec.pricing.input.usd,
output: spec.pricing.output.usd,
...(spec.pricing.cache_input && { cache_read: spec.pricing.cache_input.usd }),
...(spec.pricing.cache_write && { cache_write: spec.pricing.cache_write.usd }),
};
// Extended pricing maps to context_over_200k
if (spec.pricing.extended) {
merged.cost.context_over_200k = {
input: spec.pricing.extended.input.usd,
output: spec.pricing.extended.output.usd,
context_min: spec.pricing.extended.context_token_threshold,
...(spec.pricing.extended.cache_input && { cache_read: spec.pricing.extended.cache_input.usd }),
...(spec.pricing.extended.cache_write && { cache_write: spec.pricing.extended.cache_write.usd }),
};
}
}
const inferred = inferFamily(apiModel.id, spec.name);
merged.family = inferred ?? existing?.family;
// Preserve manual fields from existing
if (existing?.knowledge) {
merged.knowledge = existing.knowledge;
}
if (existing?.interleaved !== undefined) {
merged.interleaved = existing.interleaved;
}
if (existing?.status !== undefined) {
merged.status = existing.status;
}
return merged;
}
function formatToml(model: MergedModel): string {
const lines: string[] = [];
// Basic fields
lines.push(`name = "${model.name.replace(/"/g, '\\"')}"`);
if (model.family) {
lines.push(`family = "${model.family}"`);
}
lines.push(`attachment = ${model.attachment}`);
lines.push(`reasoning = ${model.reasoning}`);
lines.push(`tool_call = ${model.tool_call}`);
if (model.structured_output !== undefined) {
lines.push(`structured_output = ${model.structured_output}`);
}
lines.push(`temperature = ${model.temperature}`);
if (model.knowledge) {
lines.push(`knowledge = "${model.knowledge}"`);
}
lines.push(`release_date = "${model.release_date}"`);
lines.push(`last_updated = "${model.last_updated}"`);
lines.push(`open_weights = ${model.open_weights}`);
if (model.status) {
lines.push(`status = "${model.status}"`);
}
// Interleaved section (if present)
if (model.interleaved !== undefined) {
lines.push("");
if (model.interleaved === true) {
lines.push(`interleaved = true`);
} else if (typeof model.interleaved === "object") {
lines.push(`[interleaved]`);
lines.push(`field = "${model.interleaved.field}"`);
}
}
// Cost section
if (model.cost) {
lines.push("");
lines.push(`[cost]`);
lines.push(`input = ${model.cost.input}`);
lines.push(`output = ${model.cost.output}`);
if (model.cost.cache_read !== undefined) {
lines.push(`cache_read = ${model.cost.cache_read}`);
}
if (model.cost.cache_write !== undefined) {
lines.push(`cache_write = ${model.cost.cache_write}`);
}
if (model.cost.context_over_200k) {
lines.push("");
lines.push(`[[cost.tiers]]`);
lines.push(`tier = { size = ${formatNumber(getLongContextMin(model.cost.context_over_200k))} }`);
lines.push(`input = ${model.cost.context_over_200k.input}`);
lines.push(`output = ${model.cost.context_over_200k.output}`);
if (model.cost.context_over_200k.cache_read !== undefined) {
lines.push(`cache_read = ${model.cost.context_over_200k.cache_read}`);
}
if (model.cost.context_over_200k.cache_write !== undefined) {
lines.push(`cache_write = ${model.cost.context_over_200k.cache_write}`);
}
}
}
// Limit section
lines.push("");
lines.push(`[limit]`);
lines.push(`context = ${formatNumber(model.limit.context)}`);
lines.push(`output = ${formatNumber(model.limit.output)}`);
// Modalities section
lines.push("");
lines.push(`[modalities]`);
lines.push(`input = [${model.modalities.input.map((m) => `"${m}"`).join(", ")}]`);
lines.push(`output = [${model.modalities.output.map((m) => `"${m}"`).join(", ")}]`);
return lines.join("\n") + "\n";
}
interface Changes {
field: string;
oldValue: string;
newValue: string;
}
function detectChanges(
existing: ExistingModel | null,
merged: MergedModel,
): Changes[] {
if (!existing) return [];
const changes: Changes[] = [];
const compare = (field: string, oldVal: unknown, newVal: unknown) => {
const oldStr = JSON.stringify(oldVal);
const newStr = JSON.stringify(newVal);
if (oldStr !== newStr) {
changes.push({
field,
oldValue: formatValue(oldVal),
newValue: formatValue(newVal),
});
}
};
const formatValue = (val: unknown): string => {
if (typeof val === "number") return formatNumber(val);
if (Array.isArray(val)) return `[${val.join(", ")}]`;
if (val === undefined) return "(none)";
return String(val);
};
compare("name", existing.name, merged.name);
compare("family", existing.family, merged.family);
compare("attachment", existing.attachment, merged.attachment);
compare("reasoning", existing.reasoning, merged.reasoning);
compare("tool_call", existing.tool_call, merged.tool_call);
compare("structured_output", existing.structured_output, merged.structured_output);
compare("open_weights", existing.open_weights, merged.open_weights);
compare("release_date", existing.release_date, merged.release_date);
compare("cost.input", existing.cost?.input, merged.cost?.input);
compare("cost.output", existing.cost?.output, merged.cost?.output);
compare("cost.cache_read", existing.cost?.cache_read, merged.cost?.cache_read);
compare("cost.cache_write", existing.cost?.cache_write, merged.cost?.cache_write);
const existingLongContextCost = getExistingLongContextCost(existing);
compare("cost.context_over_200k.input", existingLongContextCost?.input, merged.cost?.context_over_200k?.input);
compare("cost.context_over_200k.output", existingLongContextCost?.output, merged.cost?.context_over_200k?.output);
compare("cost.context_over_200k.cache_read", existingLongContextCost?.cache_read, merged.cost?.context_over_200k?.cache_read);
compare("cost.context_over_200k.cache_write", existingLongContextCost?.cache_write, merged.cost?.context_over_200k?.cache_write);
compare("limit.context", existing.limit?.context, merged.limit.context);
compare("limit.output", existing.limit?.output, merged.limit.output);
compare("modalities.input", existing.modalities?.input, merged.modalities.input);
return changes;
}
async function main() {
const args = process.argv.slice(2);
const dryRun = args.includes("--dry-run");
const modelsDir = path.join(
import.meta.dirname,
"..",
"..",
"..",
"providers",
"venice",
"models",
);
// Check for API key from CLI argument or environment variable
let apiKey: string | null = null;
// Check CLI args for --api-key=xxx or --api-key xxx
const apiKeyArgIndex = args.findIndex((arg) => arg.startsWith("--api-key"));
if (apiKeyArgIndex !== -1) {
const arg = args[apiKeyArgIndex];
if (arg?.includes("=")) {
apiKey = arg.split("=")[1] ?? null;
} else if (args[apiKeyArgIndex + 1]) {
apiKey = args[apiKeyArgIndex + 1] ?? null;
}
}
// Fall back to environment variable
if (!apiKey) {
apiKey = process.env.VENICE_API_KEY ?? null;
}
const includeAlpha = apiKey !== null;
if (dryRun) {
console.log(
`[DRY RUN] Fetching Venice models from API${includeAlpha ? " (including alpha models)" : ""}...`,
);
} else {
console.log(
`Fetching Venice models from API${includeAlpha ? " (including alpha models)" : ""}...`,
);
}
// Fetch API data
const fetchOptions: RequestInit = {};
if (apiKey) {
fetchOptions.headers = {
Authorization: `Bearer ${apiKey}`,
};
}
const res = await fetch(API_ENDPOINT, fetchOptions);
if (!res.ok) {
console.error(`Failed to fetch API: ${res.status} ${res.statusText}`);
if (res.status === 401) {
console.error("Invalid API key. Please check your VENICE_API_KEY.");
}
process.exit(1);
}
const json = await res.json();
const parsed = VeniceResponse.safeParse(json);
if (!parsed.success) {
console.error("Invalid API response:", parsed.error.errors);
process.exit(1);
}
const apiModels = parsed.data.data;
// Get existing files
const existingFiles = new Set<string>();
try {
const files = await readdir(modelsDir);
for (const file of files) {
if (file.endsWith(".toml")) {
existingFiles.add(file);
}
}
} catch {
// Directory might not exist yet
}
console.log(`Found ${apiModels.length} models in API, ${existingFiles.size} existing files\n`);
// Track API model IDs for orphan detection
const apiModelIds = new Set<string>();
let created = 0;
let updated = 0;
let unchanged = 0;
for (const apiModel of apiModels) {
const safeId = apiModel.id.replace(/\//g, "-");
const filename = `${safeId}.toml`;
const filePath = path.join(modelsDir, filename);
apiModelIds.add(filename);
const existing = await loadExistingModel(filePath);
const merged = mergeModel(apiModel, existing);
const tomlContent = formatToml(merged);
if (existing === null) {
// New file
created++;
if (dryRun) {
console.log(`[DRY RUN] Would create: ${filename}`);
console.log(` name = "${merged.name}"`);
if (merged.family) {
console.log(` family = "${merged.family}" (inferred)`);
}
console.log("");
} else {
await Bun.write(filePath, tomlContent);
console.log(`Created: ${filename}`);
}
} else {
// Check for changes
const changes = detectChanges(existing, merged);
if (changes.length > 0) {
updated++;
if (dryRun) {
console.log(`[DRY RUN] Would update: ${filename}`);
} else {
await Bun.write(filePath, tomlContent);
console.log(`Updated: ${filename}`);
}
for (const change of changes) {
console.log(` ${change.field}: ${change.oldValue} → ${change.newValue}`);
}
console.log("");
} else {
unchanged++;
}
}
}
// Check for orphaned files
const orphaned: string[] = [];
for (const file of existingFiles) {
if (!apiModelIds.has(file)) {
orphaned.push(file);
console.log(`Warning: Orphaned file (not in API): ${file}`);
}
}
// Summary
console.log("");
if (dryRun) {
console.log(
`Summary: ${created} would be created, ${updated} would be updated, ${unchanged} unchanged, ${orphaned.length} orphaned`,
);
} else {
console.log(
`Summary: ${created} created, ${updated} updated, ${unchanged} unchanged, ${orphaned.length} orphaned`,
);
}
}
await main();
+589
View File
@@ -0,0 +1,589 @@
#!/usr/bin/env bun
/**
* Generates Vercel model TOML files from the AI Gateway API.
*
* Flags:
* --dry-run: Preview changes without writing files
* --new-only: Only create new models, skip updating existing ones
*/
import { z } from "zod";
import path from "node:path";
import { mkdir } from "node:fs/promises";
import { ModelFamilyValues } from "../src/family.js";
const API_ENDPOINT = "https://ai-gateway.vercel.sh/v1/models";
enum ModelType {
Language = "language",
Embedding = "embedding",
Image = "image",
Video = "video",
Reranking = "reranking",
}
enum SkipZeroFields {
LimitContext = "limit.context",
LimitInput = "limit.input",
LimitOutput = "limit.output",
}
const PricingTier = z.object({
cost: z.string(),
min: z.number(),
max: z.number().optional(),
});
const Pricing = z.object({
input: z.string().optional(),
output: z.string().optional(),
input_cache_read: z.string().optional(),
input_cache_write: z.string().optional(),
input_tiers: z.array(PricingTier).optional(),
output_tiers: z.array(PricingTier).optional(),
input_cache_read_tiers: z.array(PricingTier).optional(),
input_cache_write_tiers: z.array(PricingTier).optional(),
}).passthrough();
const VercelModel = z.object({
id: z.string(),
name: z.string(),
created: z.number(),
released: z.number().optional(),
context_window: z.number(),
max_tokens: z.number(),
type: z.nativeEnum(ModelType),
tags: z.array(z.string()).optional().default([]),
pricing: Pricing.optional(),
}).passthrough();
const VercelResponse = z.object({
data: z.array(VercelModel),
}).passthrough();
interface ExistingModel {
name?: string;
family?: string;
attachment?: boolean;
reasoning?: boolean;
tool_call?: boolean;
structured_output?: boolean;
temperature?: boolean;
knowledge?: string;
release_date?: string;
last_updated?: string;
open_weights?: boolean;
interleaved?: boolean | { field: string };
status?: string;
cost?: {
input?: number;
output?: number;
cache_read?: number;
cache_write?: number;
};
limit?: {
context?: number;
input?: number;
output?: number;
};
modalities?: {
input?: string[];
output?: string[];
};
}
interface MergedModel {
name: string;
family?: string;
attachment: boolean;
reasoning: boolean;
tool_call: boolean;
structured_output?: boolean;
temperature: boolean;
knowledge?: string;
release_date: string;
last_updated: string;
open_weights: boolean;
interleaved?: boolean | { field: string };
status?: string;
cost?: {
input: number;
output: number;
cache_read?: number;
cache_write?: number;
};
limit: {
context: number;
input?: number;
output: number;
};
modalities: {
input: string[];
output: string[];
};
}
interface Changes {
field: string;
oldValue: string;
newValue: string;
}
function timestampToDate(timestamp: number): string {
const date = new Date(timestamp * 1000);
return date.toISOString().slice(0, 10);
}
function getTodayDate(): string {
return new Date().toISOString().slice(0, 10);
}
// Number utilities
function formatNumber(n: number): string {
if (n >= 1000) {
return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "_");
}
return n.toString();
}
function isSubstring(target: string, family: string): boolean {
return target.toLowerCase().includes(family.toLowerCase());
}
function matchesFamily(target: string, family: string): boolean {
const targetLower = target.toLowerCase();
const familyLower = family.toLowerCase();
let familyIdx = 0;
for (let i = 0; i < targetLower.length && familyIdx < familyLower.length; i++) {
if (targetLower[i] === familyLower[familyIdx]) {
familyIdx++;
}
}
return familyIdx === familyLower.length;
}
function inferFamily(modelId: string, modelName: string): string | undefined {
const sortedFamilies = [...ModelFamilyValues].sort((a, b) => b.length - a.length);
// First pass: try exact substring matches
for (const family of sortedFamilies) {
if (isSubstring(modelId, family)) {
return family;
}
}
for (const family of sortedFamilies) {
if (isSubstring(modelName, family)) {
return family;
}
}
// Second pass: fall back to subsequence matching
for (const family of sortedFamilies) {
if (matchesFamily(modelId, family)) {
return family;
}
}
for (const family of sortedFamilies) {
if (matchesFamily(modelName, family)) {
return family;
}
}
return undefined;
}
function buildInputModalities(tags: string[]): string[] {
const mods: string[] = ["text"];
const tagSet = new Set(tags);
if (tagSet.has("vision")) mods.push("image");
if (tagSet.has("file-input")) mods.push("pdf");
return mods;
}
function buildOutputModalities(modelType: ModelType, tags: string[]): string[] {
const mods: string[] = ["text"];
const tagSet = new Set(tags);
if (modelType === ModelType.Image || tagSet.has("image-generation")) {
mods.push("image");
} else if (modelType === ModelType.Video) {
mods.push("video");
}
return mods;
}
async function loadExistingModel(filePath: string): Promise<ExistingModel | null> {
try {
const file = Bun.file(filePath);
if (!(await file.exists())) {
return null;
}
const toml = await import(filePath, { with: { type: "toml" } }).then(
(mod) => mod.default,
);
return toml as ExistingModel;
} catch (e) {
console.warn(`Warning: Failed to parse existing file ${filePath}:`, e);
return null;
}
}
function isOpenAIModel(modelId: string): boolean {
return modelId.startsWith("openai/");
}
function mergeModel(
apiModel: z.infer<typeof VercelModel>,
existing: ExistingModel | null,
): MergedModel {
const tagSet = new Set(apiModel.tags);
const inputModalities = buildInputModalities(apiModel.tags);
const outputModalities = buildOutputModalities(apiModel.type, apiModel.tags);
// Preserve existing values when available (previously manually specified)
const name = existing?.name ?? apiModel.name;
const attachment = existing?.attachment ?? (tagSet.has("vision") || tagSet.has("file-input"));
const reasoning = existing?.reasoning ?? tagSet.has("reasoning");
const toolCall = existing?.tool_call ?? tagSet.has("tool-use");
const openWeights = existing?.open_weights ?? false;
const family = existing?.family ?? inferFamily(apiModel.id, apiModel.name);
const structuredOutput = existing?.structured_output;
const knowledge = existing?.knowledge;
const interleaved = existing?.interleaved;
const status = existing?.status;
// Release date: use API, fallback to existing, then today
const releaseDate = apiModel.released
? timestampToDate(apiModel.released)
: (existing?.release_date ?? getTodayDate());
// Preserve existing limits if API returns 0 (indicates missing/invalid data)
const contextLimit = apiModel.context_window > 0
? apiModel.context_window
: (existing?.limit?.context ?? 0);
const outputLimit = apiModel.max_tokens > 0
? apiModel.max_tokens
: (existing?.limit?.output ?? 0);
const merged: MergedModel = {
name,
family,
attachment,
reasoning,
tool_call: toolCall,
temperature: true,
release_date: releaseDate,
last_updated: getTodayDate(),
open_weights: openWeights,
...(structuredOutput !== undefined && { structured_output: structuredOutput }),
...(knowledge && { knowledge }),
...(interleaved !== undefined && { interleaved }),
...(status && { status }),
limit: {
context: contextLimit,
...(isOpenAIModel(apiModel.id) && contextLimit > outputLimit && { input: contextLimit - outputLimit }),
output: outputLimit,
},
modalities: {
input: inputModalities,
output: outputModalities,
},
};
if (apiModel.pricing) {
const inputPrice = apiModel.pricing.input_tiers?.[0]?.cost ?? apiModel.pricing.input;
const outputPrice = apiModel.pricing.output_tiers?.[0]?.cost ?? apiModel.pricing.output;
const cacheReadPrice = apiModel.pricing.input_cache_read_tiers?.[0]?.cost ?? apiModel.pricing.input_cache_read;
const cacheWritePrice = apiModel.pricing.input_cache_write_tiers?.[0]?.cost ?? apiModel.pricing.input_cache_write;
if (inputPrice && outputPrice) {
merged.cost = {
input: parseFloat(inputPrice) * 1_000_000,
output: parseFloat(outputPrice) * 1_000_000,
...(cacheReadPrice && {
cache_read: parseFloat(cacheReadPrice) * 1_000_000,
}),
...(cacheWritePrice && {
cache_write: parseFloat(cacheWritePrice) * 1_000_000,
}),
};
}
}
return merged;
}
function formatToml(model: MergedModel): string {
const lines: string[] = [];
lines.push(`name = "${model.name.replace(/"/g, '\\"')}"`);
if (model.family) {
lines.push(`family = "${model.family}"`);
}
lines.push(`attachment = ${model.attachment}`);
lines.push(`reasoning = ${model.reasoning}`);
lines.push(`tool_call = ${model.tool_call}`);
if (model.structured_output !== undefined) {
lines.push(`structured_output = ${model.structured_output}`);
}
lines.push(`temperature = ${model.temperature}`);
if (model.knowledge) {
lines.push(`knowledge = "${model.knowledge}"`);
}
lines.push(`release_date = "${model.release_date}"`);
lines.push(`last_updated = "${model.last_updated}"`);
lines.push(`open_weights = ${model.open_weights}`);
if (model.status) {
lines.push(`status = "${model.status}"`);
}
if (model.interleaved !== undefined) {
lines.push("");
if (model.interleaved === true) {
lines.push(`interleaved = true`);
} else if (typeof model.interleaved === "object") {
lines.push(`[interleaved]`);
lines.push(`field = "${model.interleaved.field}"`);
}
}
if (model.cost) {
lines.push("");
lines.push(`[cost]`);
lines.push(`input = ${model.cost.input}`);
lines.push(`output = ${model.cost.output}`);
if (model.cost.cache_read !== undefined) {
lines.push(`cache_read = ${model.cost.cache_read}`);
}
if (model.cost.cache_write !== undefined) {
lines.push(`cache_write = ${model.cost.cache_write}`);
}
}
lines.push("");
lines.push(`[limit]`);
lines.push(`context = ${formatNumber(model.limit.context)}`);
if (model.limit.input !== undefined) {
lines.push(`input = ${formatNumber(model.limit.input)}`);
}
lines.push(`output = ${formatNumber(model.limit.output)}`);
lines.push("");
lines.push(`[modalities]`);
lines.push(`input = [${model.modalities.input.map((m) => `"${m}"`).join(", ")}]`);
lines.push(`output = [${model.modalities.output.map((m) => `"${m}"`).join(", ")}]`);
return lines.join("\n") + "\n";
}
function detectChanges(
existing: ExistingModel | null,
merged: MergedModel,
): Changes[] {
if (!existing) return [];
const changes: Changes[] = [];
const EPSILON = 0.001; // price diff to ignore (per million tokens)
const shouldSkipZero = (field: string, oldVal: unknown, newVal: unknown): boolean => {
if (!Object.values(SkipZeroFields).includes(field as SkipZeroFields)) {
return false;
}
return (typeof oldVal === "number" && oldVal === 0) || (typeof newVal === "number" && newVal === 0);
};
const formatValue = (val: unknown): string => {
if (typeof val === "number") return formatNumber(val);
if (Array.isArray(val)) return `[${val.join(", ")}]`;
if (val === undefined) return "(none)";
return String(val);
};
const isMaterialPriceDiff = (oldPrice: unknown, newPrice: unknown): boolean => {
// 0 → undefined is not material (cost removed)
if (oldPrice === 0 && newPrice === undefined) return false;
if (oldPrice !== undefined && newPrice !== undefined) {
return Math.abs((oldPrice as number) - (newPrice as number)) > EPSILON;
}
return oldPrice !== newPrice;
};
const compare = (field: string, oldVal: unknown, newVal: unknown) => {
if (shouldSkipZero(field, oldVal, newVal)) return;
const isDiff = field.startsWith("cost.")
? isMaterialPriceDiff(oldVal, newVal)
: JSON.stringify(oldVal) !== JSON.stringify(newVal);
if (isDiff) {
changes.push({
field,
oldValue: formatValue(oldVal),
newValue: formatValue(newVal),
});
}
};
compare("name", existing.name, merged.name);
compare("family", existing.family, merged.family);
compare("attachment", existing.attachment, merged.attachment);
compare("reasoning", existing.reasoning, merged.reasoning);
compare("tool_call", existing.tool_call, merged.tool_call);
compare("structured_output", existing.structured_output, merged.structured_output);
compare("open_weights", existing.open_weights, merged.open_weights);
compare("release_date", existing.release_date, merged.release_date);
compare("cost.input", existing.cost?.input, merged.cost?.input);
compare("cost.output", existing.cost?.output, merged.cost?.output);
compare("cost.cache_read", existing.cost?.cache_read, merged.cost?.cache_read);
compare("cost.cache_write", existing.cost?.cache_write, merged.cost?.cache_write);
compare("limit.context", existing.limit?.context, merged.limit.context);
compare("limit.input", existing.limit?.input, merged.limit.input);
compare("limit.output", existing.limit?.output, merged.limit.output);
compare("modalities.input", existing.modalities?.input, merged.modalities.input);
return changes;
}
async function main() {
const args = process.argv.slice(2);
const dryRun = args.includes("--dry-run");
const newOnly = args.includes("--new-only");
const modelsDir = path.join(
import.meta.dirname,
"..",
"..",
"..",
"providers",
"vercel",
"models",
);
console.log(`${dryRun ? "[DRY RUN] " : ""}${newOnly ? "[NEW ONLY] " : ""}Fetching Vercel models from API...`);
const res = await fetch(API_ENDPOINT);
if (!res.ok) {
console.error(`Failed to fetch API: ${res.status} ${res.statusText}`);
process.exit(1);
}
const json = await res.json();
const parsed = VercelResponse.safeParse(json);
if (!parsed.success) {
console.error("Invalid API response:", parsed.error.errors);
process.exit(1);
}
const apiModels = parsed.data.data;
const existingFiles = new Set<string>();
try {
for await (const file of new Bun.Glob("**/*.toml").scan({
cwd: modelsDir,
absolute: false,
})) {
existingFiles.add(file);
}
} catch {
}
console.log(`Found ${apiModels.length} models in API, ${existingFiles.size} existing files\n`);
const apiModelIds = new Set<string>();
let created = 0;
let updated = 0;
let unchanged = 0;
for (const apiModel of apiModels) {
// Skip these since OpenCode does not support image / video / reranking yet
if (
apiModel.type === ModelType.Image ||
apiModel.type === ModelType.Video ||
apiModel.type === ModelType.Reranking
) {
continue;
}
const relativePath = `${apiModel.id}.toml`;
const filePath = path.join(modelsDir, relativePath);
const dirPath = path.dirname(filePath);
apiModelIds.add(relativePath);
const existing = await loadExistingModel(filePath);
const merged = mergeModel(apiModel, existing);
const tomlContent = formatToml(merged);
if (existing === null) {
created++;
if (dryRun) {
console.log(`[DRY RUN] Would create: ${relativePath}`);
console.log(` name = "${merged.name}"`);
if (merged.family) {
console.log(` family = "${merged.family}" (inferred)`);
}
console.log("");
} else {
await mkdir(dirPath, { recursive: true });
await Bun.write(filePath, tomlContent);
console.log(`Created: ${relativePath}`);
}
} else {
if (newOnly) {
unchanged++;
continue;
}
const changes = detectChanges(existing, merged);
if (changes.length > 0) {
updated++;
if (dryRun) {
console.log(`[DRY RUN] Would update: ${relativePath}`);
} else {
await mkdir(dirPath, { recursive: true });
await Bun.write(filePath, tomlContent);
console.log(`Updated: ${relativePath}`);
}
for (const change of changes) {
console.log(` ${change.field}: ${change.oldValue} → ${change.newValue}`);
}
console.log("");
} else {
unchanged++;
}
}
}
const orphaned: string[] = [];
for (const file of existingFiles) {
if (!apiModelIds.has(file)) {
orphaned.push(file);
console.log(`Warning: Orphaned file (not in API): ${file}`);
}
}
console.log("");
if (dryRun) {
console.log(
`Summary: ${created} would be created, ${updated} would be updated, ${unchanged} unchanged, ${orphaned.length} orphaned`,
);
} else {
console.log(
`Summary: ${created} created, ${updated} updated, ${unchanged} unchanged, ${orphaned.length} orphaned`,
);
}
}
await main();
+1 -4
View File
@@ -3,7 +3,7 @@
import path from "node:path";
import { mkdir } from "node:fs/promises";
import { z } from "zod";
import { inferKimiFamily, ModelFamilyValues } from "../src/family.js";
import { ModelFamilyValues } from "../src/family.js";
const API_ENDPOINT = "https://trace.wandb.ai/inference/analysis/artificialanalysis/models";
@@ -176,9 +176,6 @@ function matchesFamily(target: string, family: string): boolean {
}
function inferFamily(modelId: string, modelName: string): string | undefined {
const kimiFamily = inferKimiFamily(modelId, modelName);
if (kimiFamily !== undefined) return kimiFamily;
const sortedFamilies = [...ModelFamilyValues].sort((a, b) => b.length - a.length);
for (const family of sortedFamilies) {
+2 -11
View File
@@ -26,7 +26,6 @@ export const ModelFamilyValues = [
"claude-haiku",
"claude-sonnet",
"claude-opus",
"claude-fable",
// Gemini style
"gemini",
@@ -66,7 +65,8 @@ export const ModelFamilyValues = [
// Moonshot Kimi
"kimi",
"kimi-k2",
"kimi-k2.5",
"kimi-k2.6",
"kimi-free",
"kimi-thinking",
@@ -102,8 +102,6 @@ export const ModelFamilyValues = [
"command-r",
"command-a",
"command-light",
"north",
"north-free",
// AI21 Jamba
"jamba",
@@ -422,10 +420,3 @@ export const ModelFamilyValues = [
export const ModelFamily = z.enum(ModelFamilyValues);
export type ModelFamily = z.infer<typeof ModelFamily>;
export function inferKimiFamily(...values: string[]): ModelFamily | undefined {
const target = values.join(" ").toLowerCase();
if (/kimi[^a-z0-9]*k2(?:[^a-z0-9]*\d+)?[^a-z0-9]*thinking/.test(target)) return "kimi-thinking";
if (/kimi[\s_-]*k2/.test(target)) return "kimi-k2";
return undefined;
}
+2 -2
View File
@@ -25,7 +25,7 @@ const ReasoningEffortValue = z.preprocess(
(value) => (value === "null" ? null : value),
z.union([
z.null(),
z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"]),
z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]),
]),
);
@@ -47,7 +47,7 @@ const ReasoningOption = z
type: z.literal("budget_tokens"),
min: z
.number()
.min(-1, "Minimum reasoning budget cannot be less than -1")
.min(0, "Minimum reasoning budget cannot be negative")
.optional(),
max: z
.number()
+27 -197
View File
@@ -1,16 +1,13 @@
import path from "node:path";
import { lstat, mkdir, readdir, rm } from "node:fs/promises";
import { mkdir, readdir, rm } from "node:fs/promises";
import { mergeDeep } from "remeda";
import { z } from "zod";
import { AuthoredModel, AuthoredModelShape, ModelMetadata } from "../schema.js";
import { baseten } from "./providers/baseten.js";
import { AuthoredModel, AuthoredModelShape } from "../schema.js";
import { cloudflareWorkersAi } from "./providers/cloudflare-workers-ai.js";
import { google } from "./providers/google.js";
import { openrouter } from "./providers/openrouter.js";
import { ovhcloud } from "./providers/ovhcloud.js";
import { vercel } from "./providers/vercel.js";
import { venice } from "./providers/venice.js";
import { xai } from "./providers/xai.js";
const ExistingModelType = AuthoredModelShape.partial()
@@ -41,19 +38,12 @@ export type ExistingModel = z.infer<typeof ExistingModelType>;
export type SyncedFullModel = Omit<z.infer<typeof AuthoredModelShape>, "id">;
export type SyncedBaseModel = Omit<z.infer<typeof SyncedBaseModel>, "id">;
export type SyncedModel = SyncedFullModel | SyncedBaseModel;
export type SyncedMetadata = Omit<z.infer<typeof ModelMetadata>, "id">;
export interface SyncProvider<SourceModel> {
id: string;
name: string;
modelsDir: string;
metadataNamespace?: string;
skipCreates?: boolean;
deleteMissing?: boolean;
preserveSymlinks?: boolean;
preserveBaseModels?: boolean;
sameModel?(current: ExistingModel, desired: SyncedModel): boolean;
missingNotice?(paths: string[]): string[];
sourceID?(model: SourceModel): string;
skippedNotice?(ids: string[]): string[];
fetchModels(): Promise<unknown>;
@@ -61,7 +51,7 @@ export interface SyncProvider<SourceModel> {
translateModel(
model: SourceModel,
context: { existing(id: string): ExistingModel | undefined },
): { id: string; model: SyncedModel; metadata?: { id: string; model: SyncedMetadata } } | undefined;
): { id: string; model: SyncedModel } | undefined;
}
export interface SyncResult {
@@ -77,29 +67,23 @@ export interface SyncResult {
}
export const providers: {
baseten: SyncProvider<any>;
"cloudflare-workers-ai": SyncProvider<any>;
google: SyncProvider<any>;
openrouter: SyncProvider<any>;
ovhcloud: SyncProvider<any>;
vercel: SyncProvider<any>;
venice: SyncProvider<any>;
xai: SyncProvider<any>;
} = {
baseten,
"cloudflare-workers-ai": cloudflareWorkersAi,
google,
openrouter,
ovhcloud,
vercel,
venice,
xai,
};
export const groups = {
aggregators: ["openrouter", "vercel"],
aggregators: ["openrouter"],
cloudflare: ["cloudflare-workers-ai"],
direct: ["baseten", "google", "ovhcloud", "venice", "xai"],
direct: ["google", "ovhcloud", "xai"],
} as const;
type ProviderID = keyof typeof providers;
@@ -119,12 +103,9 @@ export async function syncProvider<SourceModel>(
): Promise<SyncResult> {
console.log(`\nSyncing ${provider.name}...`);
const existingState = await readExisting(provider.modelsDir);
const { models: existing, brokenSymlinks } = existingState;
let { modelMetadata } = existingState;
const existing = await readExisting(provider.modelsDir);
const sourceModels = provider.parseModels(await provider.fetchModels());
const desired = new Map<string, { model: z.infer<typeof SyncedAuthoredModel>; content: string }>();
const desiredMetadata = new Map<string, { model: z.infer<typeof ModelMetadata>; content: string }>();
const skippedRemote: string[] = [];
for (const sourceModel of sourceModels) {
@@ -134,7 +115,7 @@ export async function syncProvider<SourceModel>(
},
});
if (translated === undefined) {
if (provider.sourceID !== undefined) skippedRemote.push(provider.sourceID(sourceModel));
if (provider.skipCreates) skippedRemote.push(provider.sourceID?.(sourceModel) ?? "unknown");
continue;
}
@@ -148,46 +129,9 @@ export async function syncProvider<SourceModel>(
throw new Error(`Duplicate synced model path: ${provider.id}/${relativePath}`);
}
if (translated.metadata !== undefined) {
const parsedMetadata = ModelMetadata.safeParse({
id: translated.metadata.id,
...stripUndefined(translated.metadata.model),
});
if (!parsedMetadata.success) {
parsedMetadata.error.cause = { provider: provider.id, metadata: translated.metadata.id };
throw parsedMetadata.error;
}
const metadataPath = `${translated.metadata.id}.toml`;
if (desiredMetadata.has(metadataPath)) throw new Error(`Duplicate synced metadata path: ${metadataPath}`);
desiredMetadata.set(metadataPath, {
model: parsedMetadata.data,
content: formatMetadataToml(parsedMetadata.data),
});
}
const translatedModel = provider.preserveBaseModels === false
? translated.model
: preserveBaseModel(translated.model, existing.get(relativePath)?.authored);
const translatedBase = "base_model" in translatedModel ? translatedModel.base_model : undefined;
let resolvedReasoning: boolean | undefined;
if (translatedBase !== undefined) {
if (translated.metadata?.id === translatedBase) {
resolvedReasoning = translated.metadata.model.reasoning;
} else {
modelMetadata ??= await readModelMetadata(provider.modelsDir);
const canonicalReasoning = modelMetadata[translatedBase]?.reasoning;
resolvedReasoning = typeof canonicalReasoning === "boolean" ? canonicalReasoning : undefined;
}
} else {
resolvedReasoning = existing.get(relativePath)?.toml.reasoning;
}
const parsed = SyncedAuthoredModel.safeParse(stripUndefined({
id: translated.id,
...preserveReasoningOptions(
translatedModel,
existing.get(relativePath)?.authored,
resolvedReasoning,
),
...preserveBaseModel(translated.model, existing.get(relativePath)?.authored),
}));
if (!parsed.success) {
parsed.error.cause = { provider: provider.id, path: relativePath };
@@ -203,48 +147,6 @@ export async function syncProvider<SourceModel>(
const files: SyncResult["files"] = [];
let unchanged = 0;
const metadataDir = modelMetadataDir(provider.modelsDir);
for (const [relativePath, file] of desiredMetadata) {
const filePath = path.join(metadataDir, relativePath);
const currentFile = Bun.file(filePath);
const current = await currentFile.exists()
? ModelMetadata.safeParse({
id: relativePath.slice(0, -5),
...Bun.TOML.parse(await currentFile.text()) as Record<string, unknown>,
})
: undefined;
if (current?.success && stable(current.data) === stable(file.model)) continue;
files.push({ status: current === undefined ? "created" : "updated", path: filePath });
if (options.dryRun) {
console.log(`Would ${current === undefined ? "create" : "update"} metadata ${relativePath}`);
} else {
await mkdir(path.dirname(filePath), { recursive: true });
await Bun.write(filePath, file.content);
}
}
if (provider.metadataNamespace !== undefined) {
if (!/^[a-z0-9-]+$/.test(provider.metadataNamespace)) {
throw new Error(`Invalid metadata namespace: ${provider.metadataNamespace}`);
}
const namespaceDir = path.join(metadataDir, provider.metadataNamespace);
for (const { file } of await tomlFiles(namespaceDir)) {
const relativePath = path.join(provider.metadataNamespace, file);
if (desiredMetadata.has(relativePath) || provider.deleteMissing === false) continue;
if (options.newOnly) {
console.log(`Skipping metadata removal in new-only mode: ${relativePath}`);
continue;
}
const filePath = path.join(metadataDir, relativePath);
files.push({ status: "deleted", path: filePath });
if (options.dryRun) {
console.log(`Would remove metadata ${relativePath}`);
} else {
await rm(filePath, { force: true });
}
}
}
for (const [relativePath, file] of desired) {
const filePath = path.join(provider.modelsDir, relativePath);
const current = existing.get(relativePath);
@@ -255,18 +157,12 @@ export async function syncProvider<SourceModel>(
console.log(`Would create ${relativePath}`);
} else {
await mkdir(path.dirname(filePath), { recursive: true });
if (await isSymlink(filePath)) await rm(filePath, { force: true });
await Bun.write(filePath, file.content);
}
continue;
}
if (current.symlink && provider.preserveSymlinks) {
unchanged++;
continue;
}
if (!(provider.sameModel?.(current.authored, file.model) ?? sameModel(relativePath, current.authored, file.model))) {
if (!sameModel(relativePath, current.authored, file.model)) {
if (options.newOnly) {
unchanged++;
continue;
@@ -284,15 +180,8 @@ export async function syncProvider<SourceModel>(
}
}
const missingLocal: string[] = [];
for (const relativePath of new Set([...existing.keys(), ...brokenSymlinks])) {
for (const relativePath of existing.keys()) {
if (desired.has(relativePath)) continue;
if (provider.deleteMissing === false) {
missingLocal.push(relativePath);
console.log(`Retaining model missing from source: ${relativePath}`);
unchanged++;
continue;
}
if (options.newOnly) {
console.log(`Skipping removal in new-only mode: ${relativePath}`);
unchanged++;
@@ -308,10 +197,7 @@ export async function syncProvider<SourceModel>(
}
}
const result = summarize(provider, files, unchanged, [
...provider.skippedNotice?.(skippedRemote) ?? [],
...provider.missingNotice?.(missingLocal) ?? [],
]);
const result = summarize(provider, files, unchanged, provider.skippedNotice?.(skippedRemote) ?? []);
console.log(
`${options.dryRun ? "Dry run: " : ""}${result.created} created, ${result.updated} updated, ${result.deleted} removed, ${result.unchanged} unchanged`,
);
@@ -333,22 +219,6 @@ export function preserveBaseModel(model: SyncedModel, existing: ExistingModel |
};
}
export function preserveReasoningOptions(
model: SyncedModel,
existing: ExistingModel | undefined,
resolvedReasoning: boolean | undefined = existing?.reasoning,
): SyncedModel {
if ((model.reasoning ?? resolvedReasoning) === false) {
const { reasoning_options: _reasoningOptions, ...withoutReasoningOptions } = model;
return withoutReasoningOptions as SyncedModel;
}
if (model.reasoning_options !== undefined || existing?.reasoning_options === undefined) return model;
return {
...model,
reasoning_options: existing.reasoning_options,
};
}
export async function syncTargets(target: string, options: SyncOptions = {}) {
const ids = target in groups
? groups[target as keyof typeof groups]
@@ -382,24 +252,13 @@ async function readExisting(modelsDir: string) {
toml: ExistingModel;
symlink: boolean;
}>();
const brokenSymlinks = new Set<string>();
let modelMetadata: Record<string, Record<string, unknown>> | undefined;
for (const { file, symlink } of await tomlFiles(modelsDir)) {
const filePath = path.join(modelsDir, file);
let text: string;
try {
text = await Bun.file(filePath).text();
} catch (error) {
if (symlink && error instanceof Error && "code" in error && error.code === "ENOENT") {
brokenSymlinks.add(file);
continue;
}
throw error;
}
const text = await Bun.file(path.join(modelsDir, file)).text();
const parsed = ExistingModel.safeParse(Bun.TOML.parse(text));
if (!parsed.success) {
parsed.error.cause = { path: filePath };
parsed.error.cause = { path: path.join(modelsDir, file) };
throw parsed.error;
}
@@ -409,25 +268,17 @@ async function readExisting(modelsDir: string) {
}
const toml = authored.base_model === undefined
? authored
: resolveBaseModel(authored, modelMetadata ?? {}, filePath);
: resolveBaseModel(authored, modelMetadata ?? {}, path.join(modelsDir, file));
existing.set(file, { authored, toml, symlink });
}
return { models: existing, brokenSymlinks, modelMetadata };
}
async function isSymlink(filePath: string) {
try {
return (await lstat(filePath)).isSymbolicLink();
} catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT") return false;
throw error;
}
return existing;
}
async function readModelMetadata(modelsDir: string) {
const metadataDir = modelMetadataDir(modelsDir);
const root = path.dirname(path.dirname(path.dirname(modelsDir)));
const metadataDir = path.join(root, "models");
const result: Record<string, Record<string, unknown>> = {};
for await (const modelPath of new Bun.Glob("**/*.toml").scan({
@@ -445,10 +296,6 @@ async function readModelMetadata(modelsDir: string) {
return result;
}
function modelMetadataDir(modelsDir: string) {
return path.join(path.dirname(path.dirname(path.dirname(modelsDir))), "models");
}
function resolveBaseModel(
authored: ExistingModel,
modelMetadata: Record<string, Record<string, unknown>>,
@@ -695,19 +542,15 @@ function formatToml(model: z.infer<typeof SyncedAuthoredModel>) {
if (model.open_weights !== undefined) lines.push(`open_weights = ${model.open_weights}`);
if (model.status !== undefined) lines.push(`status = ${quote(model.status)}`);
if (model.reasoning_options?.length === 0) {
lines.push("reasoning_options = []");
} else {
for (const option of model.reasoning_options ?? []) {
lines.push("", "[[reasoning_options]]");
lines.push(`type = ${quote(option.type)}`);
if (option.type === "effort") {
lines.push(`values = [${option.values.map(formatReasoningValue).join(", ")}]`);
}
if (option.type === "budget_tokens") {
if (option.min !== undefined) lines.push(`min = ${formatInteger(option.min)}`);
if (option.max !== undefined) lines.push(`max = ${formatInteger(option.max)}`);
}
for (const option of model.reasoning_options ?? []) {
lines.push("", "[[reasoning_options]]");
lines.push(`type = ${quote(option.type)}`);
if (option.type === "effort") {
lines.push(`values = [${option.values.map(formatReasoningValue).join(", ")}]`);
}
if (option.type === "budget_tokens") {
if (option.min !== undefined) lines.push(`min = ${formatInteger(option.min)}`);
if (option.max !== undefined) lines.push(`max = ${formatInteger(option.max)}`);
}
}
@@ -743,7 +586,7 @@ function formatToml(model: z.infer<typeof SyncedAuthoredModel>) {
for (const tier of model.cost.tiers ?? []) {
lines.push("", "[[cost.tiers]]");
lines.push(`tier = { type = ${quote(tier.tier.type ?? "context")}, size = ${formatInteger(tier.tier.size)} }`);
lines.push(`tier = { type = ${quote(tier.tier.type)}, size = ${formatInteger(tier.tier.size)} }`);
lines.push(`input = ${formatNumber(tier.input)}`);
lines.push(`output = ${formatNumber(tier.output)}`);
if (tier.reasoning !== undefined) lines.push(`reasoning = ${formatNumber(tier.reasoning)}`);
@@ -772,19 +615,6 @@ function formatToml(model: z.infer<typeof SyncedAuthoredModel>) {
return `${lines.join("\n")}\n`;
}
function formatMetadataToml(model: z.infer<typeof ModelMetadata>) {
const content = formatToml(model as unknown as z.infer<typeof SyncedAuthoredModel>).trimEnd();
const lines = [content];
for (const weight of model.weights ?? []) {
lines.push("", "[[weights]]");
if (weight.label !== undefined) lines.push(`label = ${quote(weight.label)}`);
lines.push(`url = ${quote(weight.url)}`);
if (weight.format !== undefined) lines.push(`format = ${quote(weight.format)}`);
if (weight.quantization !== undefined) lines.push(`quantization = ${quote(weight.quantization)}`);
}
return `${lines.join("\n")}\n`;
}
export async function main(args = process.argv.slice(2)) {
if (args.includes("--list-providers")) {
console.log(JSON.stringify(syncProviderMatrix()));
-188
View File
@@ -1,188 +0,0 @@
import { z } from "zod";
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
import { factorBaseModel, resolveCanonicalBaseModel } from "./openrouter.js";
const API_ENDPOINT = "https://inference.baseten.co/v1/models";
const Price = z.union([z.string(), z.number()]);
export const BasetenModel = z.object({
id: z.string().min(1),
name: z.string().min(1),
context_length: z.number().int().positive(),
max_completion_tokens: z.number().int().positive(),
input_modalities: z.array(z.string()),
output_modalities: z.array(z.string()),
pricing: z.object({
prompt: Price,
completion: Price,
}).passthrough(),
supported_features: z.array(z.string()),
supported_sampling_parameters: z.array(z.string()),
}).passthrough();
export const BasetenResponse = z.object({
data: z.array(BasetenModel),
}).passthrough();
export type BasetenModel = z.infer<typeof BasetenModel>;
export const baseten = {
id: "baseten",
name: "Baseten",
modelsDir: "providers/baseten/models",
deleteMissing: false,
sourceID(model) {
return model.id;
},
skippedNotice(ids) {
if (ids.length === 0) return [];
return [
`${ids.length} Baseten models were not created because their slugs could not be mapped exactly to provider-agnostic metadata.`,
`Skipped remote IDs: ${ids.map((id) => `\`${id}\``).join(", ")}`,
];
},
missingNotice(paths) {
if (paths.length === 0) return [];
return [
`${paths.length} local Baseten models were absent from the catalog and were retained for manual lifecycle review.`,
`Retained local paths: ${paths.map((item) => `\`${item}\``).join(", ")}`,
];
},
async fetchModels() {
const key = process.env.BASETEN_API_KEY;
if (key === undefined) throw new Error("Baseten sync requires BASETEN_API_KEY");
return fetchBasetenModels(key);
},
parseModels(raw) {
return BasetenResponse.parse(raw).data;
},
translateModel(model, context) {
const existing = context.existing(model.id);
const baseModel = existing === undefined
? resolveBasetenBaseModel(model.id)
: existing.base_model;
if (existing === undefined && baseModel === undefined) return undefined;
if (
existing === undefined
&& (price(model.pricing.prompt) === undefined || price(model.pricing.completion) === undefined)
) return undefined;
return {
id: model.id,
model: buildBasetenModel(model, existing, baseModel),
};
},
} satisfies SyncProvider<BasetenModel>;
export async function fetchBasetenModels(
key: string,
fetcher: typeof fetch = fetch,
) {
const response = await fetcher(API_ENDPOINT, {
headers: { Authorization: `Api-Key ${key}` },
});
if (!response.ok) {
throw new Error(`Baseten models request failed: ${response.status} ${response.statusText}`);
}
return BasetenResponse.parse(await response.json());
}
function price(value: string | number | undefined) {
if (value === undefined || value === "") return undefined;
const number = Number(value);
return Number.isFinite(number) && number >= 0
? Math.round(number * 1_000_000_000_000) / 1_000_000
: undefined;
}
export function buildBasetenModel(
model: BasetenModel,
existing: ExistingModel | undefined,
baseModel = existing === undefined ? resolveBasetenBaseModel(model.id) : existing.base_model,
): SyncedModel {
const features = new Set(model.supported_features);
const samplingParameters = new Set(model.supported_sampling_parameters);
const input = modalities(model.input_modalities, existing?.modalities?.input ?? ["text"]);
const output = modalities(model.output_modalities, existing?.modalities?.output ?? ["text"]);
const inputCost = price(model.pricing.prompt);
const outputCost = price(model.pricing.completion);
const cost = inputCost !== undefined && outputCost !== undefined
? {
input: inputCost,
output: outputCost,
reasoning: existing?.cost?.reasoning,
cache_read: existing?.cost?.cache_read,
cache_write: existing?.cost?.cache_write,
tiers: existing?.cost?.tiers,
}
: existing?.cost;
const limit = {
context: model.context_length,
input: existing?.limit?.input,
output: model.max_completion_tokens,
};
const values: Partial<SyncedFullModel> = {
name: model.name ?? existing?.name,
family: existing?.family,
release_date: existing?.release_date,
last_updated: existing?.last_updated,
attachment: input.some((value) => value !== "text"),
reasoning: features.has("reasoning") || existing?.reasoning,
reasoning_options: existing?.reasoning_options,
temperature: samplingParameters.has("temperature"),
tool_call: features.has("tools") || existing?.tool_call,
structured_output: features.has("structured_outputs") || existing?.structured_output,
knowledge: existing?.knowledge,
open_weights: existing?.open_weights,
status: existing?.status,
interleaved: existing?.interleaved,
cost,
limit,
modalities: { input, output },
};
if (baseModel !== undefined) {
if (limit.context === undefined || limit.output === undefined) {
throw new Error(`Baseten model ${model.id} has incomplete token limits required for sync`);
}
return factorBaseModel(baseModel, values, limit, existing?.base_model_omit);
}
const required = z.object({
name: z.string(),
release_date: z.string(),
last_updated: z.string(),
open_weights: z.boolean(),
cost: z.object({ input: z.number(), output: z.number() }),
}).safeParse(values);
if (!required.success) {
throw new Error(`Baseten model ${model.id} has incomplete local metadata required for sync`);
}
return values as SyncedFullModel;
}
export function resolveBasetenBaseModel(id: string) {
const [prefix, ...parts] = id.split("/");
if (prefix === undefined || parts.length === 0) return undefined;
const canonicalPrefix = {
"deepseek-ai": "deepseek",
MiniMaxAI: "minimax",
moonshotai: "moonshotai",
nvidia: "nvidia",
"zai-org": "zai",
}[prefix];
if (canonicalPrefix === undefined) return resolveCanonicalBaseModel(id);
return resolveCanonicalBaseModel(`${canonicalPrefix}/${parts.join("/").toLowerCase()}`);
}
type Modality = "text" | "audio" | "image" | "video" | "pdf";
function modalities(values: string[], fallback: Modality[]): Modality[] {
const allowed = new Set<Modality>(["text", "audio", "image", "video", "pdf"]);
const result = values
.map((value) => value.toLowerCase())
.filter((value): value is Modality => allowed.has(value as Modality));
return [...new Set(result.length > 0 ? result : fallback)];
}
@@ -96,7 +96,7 @@ export const cloudflareWorkersAi = {
},
} satisfies SyncProvider<CloudflareModel>;
export function buildWorkersAiModel(
function buildWorkersAiModel(
model: z.infer<typeof OpenRouterModel>,
existing: ExistingModel | undefined,
): SyncedModel {
@@ -108,14 +108,11 @@ export function buildWorkersAiModel(
max_completion_tokens: existing?.limit?.output ?? model.top_provider.max_completion_tokens,
},
};
const synced = {
...buildOpenRouterModel(
source,
existing,
existing?.base_model ?? resolveCloudflareBaseModel(model),
),
reasoning_options: existing?.reasoning_options,
};
const synced = buildOpenRouterModel(
source,
existing,
existing?.base_model ?? resolveCloudflareBaseModel(model),
);
if ("base_model" in synced) return synced;
return {
...synced,
+6 -9
View File
@@ -1,7 +1,6 @@
import { z } from "zod";
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
import { factorBaseModel } from "./openrouter.js";
import type { ExistingModel, SyncProvider, SyncedModel } from "../index.js";
const API_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/models";
@@ -82,12 +81,12 @@ export const google = {
return {
id,
model: buildGoogleModel(model, existing),
model: buildModel(model, existing),
};
},
} satisfies SyncProvider<GoogleModel>;
export function buildGoogleModel(model: GoogleModel, existing: ExistingModel): SyncedModel {
function buildModel(model: GoogleModel, existing: ExistingModel): SyncedModel {
const name = existing.name;
const releaseDate = existing.release_date;
const lastUpdated = existing.last_updated;
@@ -112,7 +111,9 @@ export function buildGoogleModel(model: GoogleModel, existing: ExistingModel): S
throw new Error(`Google model ${model.name} has incomplete local TOML metadata required for sync`);
}
const synced: SyncedFullModel = {
return {
base_model: existing.base_model,
base_model_omit: existing.base_model_omit,
name: model.displayName ?? name,
family: existing.family,
release_date: releaseDate,
@@ -137,8 +138,4 @@ export function buildGoogleModel(model: GoogleModel, existing: ExistingModel): S
},
modalities,
};
return existing.base_model === undefined
? synced
: factorBaseModel(existing.base_model, synced, synced.limit, existing.base_model_omit);
}
+21 -49
View File
@@ -1,17 +1,15 @@
import { z } from "zod";
import { readFileSync, readdirSync } from "node:fs";
import { existsSync, readFileSync } from "node:fs";
import path from "node:path";
import { inferKimiFamily, ModelFamilyValues } from "../../family.js";
import { ModelFamilyValues } from "../../family.js";
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
const API_ENDPOINT = "https://openrouter.ai/api/v1/models";
const MODELS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "models");
const modelMetadataByID = new Map<string, Record<string, unknown>>();
const modelMetadataFilesByProvider = new Map<string, Set<string>>();
const CANONICAL_PROVIDER_PREFIXES = {
alibaba: { provider: "alibaba", metadata: "alibaba" },
anthropic: { provider: "anthropic", metadata: "anthropic" },
cohere: { provider: "cohere", metadata: "cohere" },
deepseek: { provider: "deepseek", metadata: "deepseek" },
@@ -113,9 +111,6 @@ function modalities(values: string[], fallback: Modality[]): Modality[] {
}
function inferFamily(model: OpenRouterModel, name: string) {
const kimiFamily = inferKimiFamily(model.id, name);
if (kimiFamily !== undefined) return kimiFamily;
const target = `${model.id} ${name}`.toLowerCase();
return [...ModelFamilyValues]
.sort((a, b) => b.length - a.length)
@@ -166,12 +161,15 @@ export function buildOpenRouterModel(
input: existing?.limit?.input,
output: model.top_provider.max_completion_tokens ?? existing?.limit?.output ?? context,
};
const canonical = existing?.base_model ?? baseModel ?? resolveCanonicalBaseModel(model.id);
const canonical = existing?.base_model ?? baseModel ?? resolveCanonicalModel(model.id)?.from;
if (canonical !== undefined) {
return factorBaseModel(
canonical,
{
return {
base_model: canonical,
base_model_omit: existing?.base_model === canonical
? existing.base_model_omit ?? baseModelOmit(canonical, limit)
: baseModelOmit(canonical, limit),
...baseModelOverrides(canonical, {
name: baseModel !== undefined || model.id.endsWith(":free") ? name : undefined,
attachment,
reasoning,
@@ -182,11 +180,9 @@ export function buildOpenRouterModel(
interleaved: existing?.interleaved,
limit,
modalities: { input, output },
cost,
},
limit,
existing?.base_model === canonical ? existing.base_model_omit : undefined,
);
}),
cost,
};
}
return {
@@ -209,7 +205,7 @@ export function buildOpenRouterModel(
} satisfies SyncedFullModel;
}
export function resolveCanonicalBaseModel(openrouterID: string) {
function resolveCanonicalModel(openrouterID: string) {
const [prefix, ...modelParts] = openrouterID.split("/");
if (prefix === undefined || modelParts.length === 0) return undefined;
if (openrouterID.startsWith("~/") || prefix.startsWith("~")) return undefined;
@@ -223,33 +219,17 @@ export function resolveCanonicalBaseModel(openrouterID: string) {
return modelMetadataExists(canonical.metadata, candidate);
});
return match === undefined ? undefined : `${canonical.metadata}/${match}`;
return match === undefined
? undefined
: {
from: `${canonical.metadata}/${match}`,
provider: canonical.provider,
modelID: match,
};
}
function modelMetadataExists(provider: string, modelID: string) {
let files = modelMetadataFilesByProvider.get(provider);
if (files === undefined) {
try {
files = new Set(readdirSync(path.join(MODELS_DIR, provider)));
} catch {
files = new Set();
}
modelMetadataFilesByProvider.set(provider, files);
}
return files.has(`${modelID}.toml`);
}
export function factorBaseModel(
modelID: string,
values: Partial<SyncedFullModel>,
limit: SyncedFullModel["limit"],
existingOmit?: string[],
): SyncedModel {
return {
base_model: modelID,
base_model_omit: existingOmit ?? baseModelOmit(modelID, limit),
...baseModelOverrides(modelID, values),
};
return existsSync(path.join(MODELS_DIR, provider, `${modelID}.toml`));
}
function baseModelOmit(
@@ -289,14 +269,6 @@ function baseModelOverrides(
function inheritedOverride(value: unknown, inherited: unknown): unknown {
if (value === undefined) return undefined;
if (sameInheritedValue(value, inherited)) return undefined;
if (isPlainObject(value) && isPlainObject(inherited)) {
const overrides = Object.fromEntries(
Object.entries(value)
.map(([key, item]) => [key, inheritedOverride(item, inherited[key])])
.filter(([, item]) => item !== undefined),
);
return Object.keys(overrides).length > 0 ? overrides : undefined;
}
return stripUndefined(value);
}
@@ -121,7 +121,6 @@ export function buildOvhcloudModel(
last_updated: lastUpdated,
attachment,
reasoning,
reasoning_options: reasoning ? existing?.reasoning_options : undefined,
temperature: temperature || undefined,
tool_call: toolCall,
structured_output: structuredOutput || undefined,
-241
View File
@@ -1,241 +0,0 @@
import { readdirSync } from "node:fs";
import path from "node:path";
import { z } from "zod";
import { inferKimiFamily, ModelFamilyValues } from "../../family.js";
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
import { factorBaseModel } from "./openrouter.js";
const API_ENDPOINT = "https://api.venice.ai/api/v1/models?type=text";
const MODELS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "models");
const Capabilities = z.object({
supportsAudioInput: z.boolean().optional(),
supportsE2EE: z.boolean().optional(),
supportsFunctionCalling: z.boolean().optional(),
supportsReasoning: z.boolean().optional(),
supportsReasoningEffort: z.boolean().optional(),
reasoningEffortOptions: z.array(z.string()).optional(),
supportsResponseSchema: z.boolean().optional(),
supportsVideoInput: z.boolean().optional(),
supportsVision: z.boolean().optional(),
}).passthrough();
const PricingTier = z.object({
usd: z.number().nonnegative(),
}).passthrough();
const ExtendedPricing = z.object({
context_token_threshold: z.number().int().nonnegative(),
input: PricingTier,
output: PricingTier,
cache_input: PricingTier.optional(),
cache_write: PricingTier.optional(),
}).passthrough();
const Pricing = z.object({
input: PricingTier,
output: PricingTier,
cache_input: PricingTier.optional(),
cache_write: PricingTier.optional(),
extended: ExtendedPricing.optional(),
}).passthrough();
const ModelSpec = z.object({
pricing: Pricing.optional(),
availableContextTokens: z.number().int().nonnegative(),
maxCompletionTokens: z.number().int().nonnegative().optional(),
capabilities: Capabilities,
name: z.string().min(1),
modelSource: z.string().optional(),
}).passthrough();
export const VeniceModel = z.object({
created: z.number(),
id: z.string().min(1),
model_spec: ModelSpec,
}).passthrough();
export const VeniceResponse = z.object({
data: z.array(VeniceModel),
}).passthrough();
export type VeniceModel = z.infer<typeof VeniceModel>;
type ReasoningEffort = "default" | "max" | "low" | "high" | "none" | "medium" | "minimal" | "xhigh";
interface MetadataEntry {
id: string;
filename: string;
normalizedFull: string;
normalizedFilename: string;
}
let metadataEntries: MetadataEntry[] | undefined;
const BASE_MODEL_ALIASES: Record<string, string> = {
"claude-opus-4-6-fast": "anthropic/claude-opus-4-6",
"claude-opus-4-7-fast": "anthropic/claude-opus-4-7",
"claude-opus-4-8-fast": "anthropic/claude-opus-4-8",
};
export const venice = {
id: "venice",
name: "Venice",
modelsDir: "providers/venice/models",
preserveBaseModels: false,
async fetchModels() {
const headers = process.env.VENICE_API_KEY
? { Authorization: `Bearer ${process.env.VENICE_API_KEY}` }
: undefined;
const response = await fetch(API_ENDPOINT, { headers });
if (!response.ok) {
throw new Error(`Venice models request failed: ${response.status} ${response.statusText}`);
}
return response.json();
},
parseModels(raw) {
return VeniceResponse.parse(raw).data;
},
translateModel(model, context) {
if (model.model_spec.capabilities.supportsE2EE === true) return undefined;
const id = model.id.replaceAll("/", "-");
const existing = context.existing(id);
const existingBase = existing?.base_model?.startsWith("venice/") === false ? existing.base_model : undefined;
const resolvedBase = existingBase ?? resolveVeniceBaseModel(model.id, model.model_spec.name);
return {
id,
model: buildVeniceModel(model, existing, resolvedBase ?? null),
};
},
} satisfies SyncProvider<VeniceModel>;
export function buildVeniceModel(
model: VeniceModel,
existing: ExistingModel | undefined,
baseModel: string | null | undefined = existing?.base_model ?? resolveVeniceBaseModel(model.id, model.model_spec.name),
today = new Date().toISOString().slice(0, 10),
): SyncedModel {
const spec = model.model_spec;
const capabilities = spec.capabilities;
const input = [
"text" as const,
...(capabilities.supportsVision ? ["image" as const] : []),
...(capabilities.supportsAudioInput ? ["audio" as const] : []),
...(capabilities.supportsVideoInput ? ["video" as const] : []),
...(existing?.modalities?.input.includes("pdf") ? ["pdf" as const] : []),
];
const limit = {
context: spec.availableContextTokens,
input: existing?.limit?.input,
output: spec.maxCompletionTokens ?? Math.floor(spec.availableContextTokens / 4),
};
const reasoningEfforts = capabilities.reasoningEffortOptions?.filter(isReasoningEffort);
const reasoningOptions = reasoningEfforts?.length
? [{ type: "effort" as const, values: reasoningEfforts }]
: [];
const cost = spec.pricing === undefined
? existing?.cost
: {
input: spec.pricing.input.usd,
output: spec.pricing.output.usd,
reasoning: existing?.cost?.reasoning,
cache_read: spec.pricing.cache_input?.usd,
cache_write: spec.pricing.cache_write?.usd,
input_audio: existing?.cost?.input_audio,
output_audio: existing?.cost?.output_audio,
tiers: spec.pricing.extended === undefined
? existing?.cost?.tiers
: [{
tier: { type: "context" as const, size: spec.pricing.extended.context_token_threshold },
input: spec.pricing.extended.input.usd,
output: spec.pricing.extended.output.usd,
cache_read: spec.pricing.extended.cache_input?.usd,
cache_write: spec.pricing.extended.cache_write?.usd,
}],
};
const authoritative = {
name: spec.name,
attachment: input.some((value) => value !== "text"),
reasoning: capabilities.supportsReasoning === true,
reasoning_options: reasoningOptions,
tool_call: capabilities.supportsFunctionCalling === true,
structured_output: capabilities.supportsResponseSchema === true ? true : undefined,
temperature: undefined,
cost,
limit,
modalities: { input: [...new Set(input)], output: ["text" as const] },
};
const releaseDate = new Date(model.created * 1000).toISOString().slice(0, 10);
const values: SyncedFullModel = {
...authoritative,
family: baseModel == null ? inferFamily(model.id, spec.name) ?? existing?.family : existing?.family,
release_date: releaseDate,
last_updated: existing?.last_updated ?? today,
knowledge: existing?.knowledge,
open_weights: spec.modelSource?.toLowerCase().includes("huggingface")
?? existing?.open_weights
?? false,
status: existing?.status,
interleaved: existing?.interleaved,
};
return baseModel == null
? values
: factorBaseModel(baseModel, values, limit, existing?.base_model_omit);
}
export function resolveVeniceBaseModel(id: string, name: string) {
const alias = BASE_MODEL_ALIASES[id];
if (alias !== undefined) return alias;
const entries = getMetadataEntries();
const normalizedID = normalize(id);
const normalizedName = normalize(name);
const ranked = [
entries.filter((entry) => entry.normalizedFull === normalizedID),
entries.filter((entry) => entry.normalizedFilename === normalizedID),
entries.filter((entry) => entry.normalizedFilename === normalizedName),
];
return ranked.find((matches) => matches.length === 1)?.[0]?.id;
}
function getMetadataEntries() {
if (metadataEntries !== undefined) return metadataEntries;
metadataEntries = [];
for (const provider of readdirSync(MODELS_DIR, { withFileTypes: true })) {
if (!provider.isDirectory()) continue;
for (const file of readdirSync(path.join(MODELS_DIR, provider.name), { withFileTypes: true })) {
if (!file.isFile() || !file.name.endsWith(".toml")) continue;
const filename = file.name.slice(0, -5);
metadataEntries.push({
id: `${provider.name}/${filename}`,
filename,
normalizedFull: normalize(`${provider.name}/${filename}`),
normalizedFilename: normalize(filename),
});
}
}
return metadataEntries;
}
function normalize(value: string) {
return value.toLowerCase().replaceAll(/[^a-z0-9]/g, "");
}
function isReasoningEffort(value: string): value is ReasoningEffort {
return ["default", "max", "low", "high", "none", "medium", "minimal", "xhigh"].includes(value);
}
function inferFamily(id: string, name: string) {
const kimiFamily = inferKimiFamily(id, name);
if (kimiFamily !== undefined) return kimiFamily;
const target = `${id} ${name}`.toLowerCase();
return [...ModelFamilyValues]
.sort((a, b) => b.length - a.length)
.find((family) => {
const value = family.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
if (family === "o") return new RegExp(`(^|[^a-z0-9])${value}(?=\\d|$|[^a-z0-9])`).test(target);
return new RegExp(`(^|[^a-z0-9])${value}(?=$|[^a-z0-9])`).test(target);
});
}
-210
View File
@@ -1,210 +0,0 @@
import { z } from "zod";
import { inferKimiFamily, ModelFamilyValues } from "../../family.js";
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../index.js";
import { factorBaseModel, resolveCanonicalBaseModel } from "./openrouter.js";
const API_ENDPOINT = "https://ai-gateway.vercel.sh/v1/models";
const ModelType = z.enum(["language", "embedding", "image", "video", "reranking"]);
const PricingTier = z.object({
cost: z.string(),
min: z.number(),
max: z.number().optional(),
});
const Pricing = z.object({
input: z.string().optional(),
output: z.string().optional(),
input_cache_read: z.string().optional(),
input_cache_write: z.string().optional(),
input_tiers: z.array(PricingTier).optional(),
output_tiers: z.array(PricingTier).optional(),
input_cache_read_tiers: z.array(PricingTier).optional(),
input_cache_write_tiers: z.array(PricingTier).optional(),
}).passthrough();
export const VercelModel = z.object({
id: z.string(),
name: z.string(),
created: z.number(),
released: z.number().optional(),
context_window: z.number(),
max_tokens: z.number(),
type: ModelType,
tags: z.array(z.string()).optional().default([]),
pricing: Pricing.optional(),
}).passthrough();
const VercelResponse = z.object({
data: z.array(VercelModel),
}).passthrough();
export type VercelModel = z.infer<typeof VercelModel>;
export const vercel = {
id: "vercel",
name: "Vercel AI Gateway",
modelsDir: "providers/vercel/models",
preserveSymlinks: true,
async fetchModels() {
const response = await fetch(API_ENDPOINT);
if (!response.ok) {
throw new Error(`Vercel AI Gateway request failed: ${response.status} ${response.statusText}`);
}
return response.json();
},
parseModels(raw) {
return VercelResponse.parse(raw).data;
},
translateModel(model, context) {
return {
id: model.id,
model: buildVercelModel(model, context.existing(model.id)),
};
},
sameModel(current, desired) {
return sameVercelModel(current, desired);
},
} satisfies SyncProvider<VercelModel>;
export function buildVercelModel(model: VercelModel, existing: ExistingModel | undefined): SyncedModel {
const tags = new Set(model.tags);
const releaseDate = model.released
? dateFromTimestamp(model.released)
: existing?.release_date ?? new Date().toISOString().slice(0, 10);
const context = model.context_window > 0
? model.context_window
: existing?.limit?.context ?? 0;
const output = model.max_tokens > 0
? model.max_tokens
: existing?.limit?.output ?? 0;
const input = model.id.startsWith("openai/") && context > output
? context - output
: undefined;
const cost = buildCost(model.pricing, existing?.cost);
const synced: SyncedFullModel = {
name: existing?.name ?? model.name,
family: existing?.family ?? inferFamily(model.id, model.name),
release_date: releaseDate,
last_updated: existing?.last_updated ?? releaseDate,
attachment: existing?.attachment ?? (tags.has("vision") || tags.has("file-input")),
reasoning: existing?.reasoning ?? tags.has("reasoning"),
reasoning_options: existing?.reasoning_options,
temperature: true,
tool_call: model.type === "language"
? existing?.tool_call ?? tags.has("tool-use")
: tags.has("tool-use"),
structured_output: existing?.structured_output,
knowledge: existing?.knowledge,
open_weights: existing?.open_weights ?? false,
status: existing?.status,
interleaved: existing?.interleaved,
experimental: existing?.experimental,
provider: existing?.provider,
cost,
limit: { context, input, output },
modalities: {
input: ["text", tags.has("vision") ? "image" : undefined, tags.has("file-input") ? "pdf" : undefined]
.filter((value): value is "text" | "image" | "pdf" => value !== undefined),
output: model.type === "image"
? ["image"]
: model.type === "video"
? ["video"]
: tags.has("image-generation")
? ["text", "image"]
: ["text"],
},
};
const baseModel = existing?.base_model ?? resolveCanonicalBaseModel(model.id);
if (baseModel === undefined) return synced;
const { last_updated: _lastUpdated, ...overrides } = synced;
return factorBaseModel(baseModel, overrides, synced.limit, existing?.base_model_omit);
}
function dateFromTimestamp(timestamp: number) {
return new Date(timestamp * 1000).toISOString().slice(0, 10);
}
function price(value: string | undefined) {
if (value === undefined) return undefined;
const number = Number(value);
return Number.isFinite(number) && number >= 0
? Math.round(number * 1_000_000_000_000) / 1_000_000
: undefined;
}
function buildCost(pricing: VercelModel["pricing"], existing?: ExistingModel["cost"]) {
const input = price(pricing?.input_tiers?.[0]?.cost ?? pricing?.input);
const output = price(pricing?.output_tiers?.[0]?.cost ?? pricing?.output);
if (input === undefined || output === undefined) return undefined;
return {
input,
output,
reasoning: existing?.reasoning,
cache_read: price(pricing?.input_cache_read_tiers?.[0]?.cost ?? pricing?.input_cache_read),
cache_write: price(pricing?.input_cache_write_tiers?.[0]?.cost ?? pricing?.input_cache_write),
tiers: existing?.tiers,
};
}
function inferFamily(modelID: string, name: string) {
const kimiFamily = inferKimiFamily(modelID, name);
if (kimiFamily !== undefined) return kimiFamily;
const targets = [modelID, name].map((value) => value.toLowerCase());
const families = [...ModelFamilyValues].sort((a, b) => b.length - a.length);
return families.find((family) => targets.some((target) => target.includes(family.toLowerCase())))
?? families.find((family) => targets.some((target) => isSubsequence(target, family.toLowerCase())));
}
function isSubsequence(target: string, value: string) {
let index = 0;
for (const character of target) {
if (character === value[index]) index++;
}
return index === value.length;
}
function sameVercelModel(current: ExistingModel, desired: SyncedModel) {
const desiredModel = desired as ExistingModel;
const fields: Array<[unknown, unknown, boolean?]> = [
[current.base_model, desiredModel.base_model],
[current.base_model_omit, desiredModel.base_model_omit],
[current.name, desiredModel.name],
[current.family, desiredModel.family],
[current.attachment, desiredModel.attachment],
[current.reasoning, desiredModel.reasoning],
[current.reasoning_options, desiredModel.reasoning_options],
[current.tool_call, desiredModel.tool_call],
[current.structured_output, desiredModel.structured_output],
[current.open_weights, desiredModel.open_weights],
[current.release_date, desiredModel.release_date],
[current.cost?.input, desiredModel.cost?.input, true],
[current.cost?.output, desiredModel.cost?.output, true],
[current.cost?.cache_read, desiredModel.cost?.cache_read, true],
[current.cost?.cache_write, desiredModel.cost?.cache_write, true],
[current.limit?.context, desiredModel.limit?.context],
[current.limit?.input, desiredModel.limit?.input],
[current.limit?.output, desiredModel.limit?.output],
[current.modalities?.input, desiredModel.modalities?.input],
];
return fields.every(([currentValue, desiredValue, cost]) => {
if (cost && currentValue === 0 && desiredValue === undefined) return true;
if (cost && typeof currentValue === "number" && typeof desiredValue === "number") {
return Math.abs(currentValue - desiredValue) <= 0.001;
}
if (
(currentValue === 0 || desiredValue === 0)
&& (typeof currentValue === "number" || typeof desiredValue === "number")
) {
return true;
}
return JSON.stringify(currentValue) === JSON.stringify(desiredValue);
});
}
+3 -4
View File
@@ -29,7 +29,7 @@ const XAIAPIKey = z.object({
acls: z.array(z.string()),
}).passthrough();
export type XAIModel = z.infer<typeof XAIModel>;
type XAIModel = z.infer<typeof XAIModel>;
export const xai = {
id: "xai",
@@ -87,7 +87,7 @@ export const xai = {
return {
id: model.id,
model: buildXAIModel(model, existing),
model: buildModel(model, existing),
};
},
} satisfies SyncProvider<XAIModel>;
@@ -159,7 +159,7 @@ function cost(model: XAIModel, existing: ExistingModel) {
};
}
export function buildXAIModel(model: XAIModel, existing: ExistingModel): SyncedModel {
function buildModel(model: XAIModel, existing: ExistingModel): SyncedModel {
const name = existing.name;
const attachment = existing.attachment;
const reasoning = existing.reasoning;
@@ -195,7 +195,6 @@ export function buildXAIModel(model: XAIModel, existing: ExistingModel): SyncedM
last_updated: model.canonical_id === undefined ? created : lastUpdated!,
attachment: input.some((value) => value !== "text"),
reasoning,
reasoning_options: existing.reasoning_options,
temperature: existing.temperature,
tool_call: toolCall,
structured_output: existing.structured_output,
-150
View File
@@ -1,150 +0,0 @@
import { afterEach, expect, test } from "bun:test";
import path from "node:path";
import { mkdir, mkdtemp } from "node:fs/promises";
import os from "node:os";
import { syncProvider } from "../src/sync/index.js";
import {
BasetenResponse,
baseten,
buildBasetenModel,
fetchBasetenModels,
type BasetenModel,
} from "../src/sync/providers/baseten.js";
const catalogModel: BasetenModel = {
id: "zai-org/GLM-5.1",
name: "GLM 5.1",
context_length: 128_000,
max_completion_tokens: 32_000,
input_modalities: ["text"],
output_modalities: ["text"],
pricing: {
prompt: "0.00000012",
completion: "0.0000005",
},
supported_features: ["reasoning", "reasoning_effort", "tools", "structured_outputs"],
supported_sampling_parameters: ["temperature", "top_p"],
};
const newCatalogModel: BasetenModel = {
...catalogModel,
};
afterEach(() => {
baseten.modelsDir = "providers/baseten/models";
baseten.fetchModels = async () => {
const key = process.env.BASETEN_API_KEY;
if (key === undefined) throw new Error("Baseten sync requires BASETEN_API_KEY");
return fetchBasetenModels(key);
};
});
test("Baseten maps authoritative fields and preserves curated metadata", () => {
const synced = buildBasetenModel(catalogModel, {
name: "Old name",
release_date: "2025-08-05",
last_updated: "2025-09-01",
attachment: false,
reasoning: true,
reasoning_options: [{ type: "effort", values: ["low", "high"] }],
tool_call: true,
open_weights: true,
status: "deprecated",
interleaved: { field: "reasoning_content" },
base_model: "zhipuai/glm-5.1",
base_model_omit: ["limit.input"],
cost: { input: 0.1, output: 0.4, cache_write: 0.2 },
limit: { context: 64_000, output: 16_000 },
modalities: { input: ["text"], output: ["text"] },
});
expect(synced).toMatchObject({
base_model: "zhipuai/glm-5.1",
base_model_omit: ["limit.input"],
reasoning_options: [{ type: "effort", values: ["low", "high"] }],
status: "deprecated",
interleaved: { field: "reasoning_content" },
cost: { input: 0.12, output: 0.5, cache_write: 0.2 },
limit: { context: 128_000, output: 32_000 },
});
});
test("Baseten preserves curated reasoning when an opt-in capability is omitted", () => {
const synced = buildBasetenModel({
...catalogModel,
supported_features: ["tools", "structured_outputs"],
}, {
name: "GLM 5.1",
release_date: "2026-05-20",
last_updated: "2026-05-20",
attachment: false,
reasoning: true,
reasoning_options: [{ type: "toggle" }],
tool_call: true,
open_weights: true,
cost: { input: 1, output: 4 },
limit: { context: 100_000, output: 50_000 },
modalities: { input: ["text"], output: ["text"] },
});
expect(synced).toMatchObject({
reasoning: true,
reasoning_options: [{ type: "toggle" }],
});
});
test("Baseten sync adds exact base models, retains missing entries, and is idempotent", async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "models-dev-baseten-"));
const modelsDir = path.join(root, "providers", "baseten", "models");
const metadataDir = path.join(root, "models", "zhipuai");
await mkdir(path.join(modelsDir, "stale"), { recursive: true });
await mkdir(metadataDir, { recursive: true });
await Bun.write(
path.join(metadataDir, "glm-5.1.toml"),
Bun.file(path.join(import.meta.dirname, "../../../models/zhipuai/glm-5.1.toml")),
);
await Bun.write(path.join(modelsDir, "stale", "model.toml"), [
'name = "Retained"',
'release_date = "2025-01-01"',
'last_updated = "2025-01-01"',
"attachment = false",
"reasoning = false",
"tool_call = false",
"open_weights = false",
"[cost]",
"input = 1",
"output = 1",
"[limit]",
"context = 1000",
"output = 100",
"[modalities]",
'input = ["text"]',
'output = ["text"]',
"",
].join("\n"));
baseten.modelsDir = modelsDir;
baseten.fetchModels = async () => ({ data: [newCatalogModel] });
const first = await syncProvider(baseten);
const second = await syncProvider(baseten);
expect(first.created).toBe(1);
expect(first.deleted).toBe(0);
expect(first.notices.join(" ")).toContain("stale/model.toml");
expect(second).toMatchObject({ created: 0, updated: 0, deleted: 0 });
});
test("Baseten rejects malformed catalog responses", () => {
expect(() => BasetenResponse.parse({ data: "broken" })).toThrow();
});
test("Baseten rejects non-success API responses", async () => {
const fetcher = async () => new Response("unauthorized", {
status: 401,
statusText: "Unauthorized",
});
expect(fetchBasetenModels("fixture-key", fetcher as typeof fetch))
.rejects.toThrow("Baseten models request failed: 401 Unauthorized");
});
@@ -1,35 +0,0 @@
import { expect, test } from "bun:test";
import { buildWorkersAiModel } from "../src/sync/providers/cloudflare-workers-ai.js";
import type { OpenRouterModel } from "../src/sync/providers/openrouter.js";
test("Cloudflare Workers AI sync preserves reasoning options", () => {
const model: OpenRouterModel = {
id: "@cf/nvidia/nemotron-3-120b-a12b",
name: "Nemotron 3 Super 120B",
created: 1_773_187_200,
hugging_face_id: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16",
knowledge_cutoff: null,
context_length: 256_000,
architecture: {
input_modalities: ["text"],
output_modalities: ["text"],
},
pricing: {
prompt: "0.0000005",
completion: "0.0000015",
},
top_provider: {
context_length: 256_000,
max_completion_tokens: 256_000,
},
supported_parameters: ["reasoning", "tools", "temperature"],
};
const synced = buildWorkersAiModel(model, {
base_model: "nvidia/nemotron-3-super-120b-a12b",
reasoning_options: [{ type: "toggle" }],
});
expect(synced.reasoning_options).toEqual([{ type: "toggle" }]);
});
-15
View File
@@ -1,15 +0,0 @@
import { expect, test } from "bun:test";
import { inferKimiFamily } from "../src/family.js";
test("Kimi family inference ignores K2 versions", () => {
expect(inferKimiFamily("moonshotai/kimi-k2.5")).toBe("kimi-k2");
expect(inferKimiFamily("moonshotai/kimi-k2.7-code")).toBe("kimi-k2");
expect(inferKimiFamily("Kimi K2.6")).toBe("kimi-k2");
});
test("Kimi family inference preserves thinking variants", () => {
expect(inferKimiFamily("moonshotai/kimi-k2-thinking")).toBe("kimi-thinking");
expect(inferKimiFamily("Kimi K2.5 Thinking")).toBe("kimi-thinking");
expect(inferKimiFamily("moonshotai/kimi-k2.6:thinking")).toBe("kimi-thinking");
});
-35
View File
@@ -1,35 +0,0 @@
import { expect, test } from "bun:test";
import { buildGoogleModel } from "../src/sync/providers/google.js";
test("Google sync keeps base models compact", () => {
const synced = buildGoogleModel({
name: "models/gemini-3-pro-image-preview",
displayName: "Nano Banana Pro",
inputTokenLimit: 131_072,
outputTokenLimit: 32_768,
temperature: 1,
thinking: true,
}, {
base_model: "google/gemini-3-pro-image-preview",
name: "Nano Banana Pro",
family: "gemini-pro",
release_date: "2025-11-20",
last_updated: "2025-11-20",
attachment: true,
reasoning: true,
temperature: true,
tool_call: false,
knowledge: "2025-01",
open_weights: false,
cost: { input: 2, output: 120 },
limit: { context: 65_536, output: 32_768 },
modalities: { input: ["text", "image"], output: ["text", "image"] },
});
expect(synced).toEqual({
base_model: "google/gemini-3-pro-image-preview",
cost: { input: 2, output: 120 },
limit: { context: 131_072 },
});
});
-227
View File
@@ -1,227 +0,0 @@
import { expect, test } from "bun:test";
import path from "node:path";
import { mkdtemp, mkdir, readlink, symlink } from "node:fs/promises";
import os from "node:os";
import { AuthoredModelShape } from "../src/schema.js";
import { syncProvider, type SyncProvider, type SyncedFullModel } from "../src/sync/index.js";
const model: SyncedFullModel = {
name: "Test model",
release_date: "2026-01-01",
last_updated: "2026-01-01",
attachment: false,
reasoning: false,
tool_call: false,
open_weights: false,
cost: { input: 1, output: 2 },
limit: { context: 1_000, output: 100 },
modalities: { input: ["text"], output: ["text"] },
};
test("reasoning budgets allow only the -1 negative sentinel", () => {
const authored = { id: "model", ...model };
expect(AuthoredModelShape.safeParse({
...authored,
reasoning_options: [{ type: "budget_tokens", min: -1, max: 32_768 }],
}).success).toBe(true);
expect(AuthoredModelShape.safeParse({
...authored,
reasoning_options: [{ type: "budget_tokens", min: -2, max: 32_768 }],
}).success).toBe(false);
});
test("reasoning efforts accept the provider default value", () => {
expect(AuthoredModelShape.safeParse({
id: "model",
...model,
reasoning: true,
reasoning_options: [{ type: "effort", values: ["none", "default"] }],
}).success).toBe(true);
});
async function fixture() {
const root = await mkdtemp(path.join(os.tmpdir(), "models-dev-sync-"));
const modelsDir = path.join(root, "providers", "test", "models");
await mkdir(modelsDir, { recursive: true });
return { root, modelsDir };
}
function provider(
modelsDir: string,
ids: string[],
deleteMissing = true,
preserveSymlinks = false,
): SyncProvider<string> {
return {
id: "test",
name: "Test",
modelsDir,
deleteMissing,
preserveSymlinks,
missingNotice: (paths) => paths.map((item) => `missing: ${item}`),
async fetchModels() {
return ids;
},
parseModels(raw) {
return raw as string[];
},
translateModel(id) {
return { id, model };
},
};
}
test("sync repairs a broken symlink returned by the source", async () => {
const { modelsDir } = await fixture();
const filePath = path.join(modelsDir, "model.toml");
await symlink("missing.toml", filePath);
const result = await syncProvider(provider(modelsDir, ["model"]));
expect(result.created).toBe(1);
expect(await Bun.file(filePath).text()).toContain('name = "Test model"');
expect(readlink(filePath)).rejects.toThrow();
});
test("sync preserves valid symlink aliases when configured", async () => {
const { root, modelsDir } = await fixture();
const targetPath = path.join(root, "target.toml");
const filePath = path.join(modelsDir, "model.toml");
await Bun.write(targetPath, `name = "Alias target"\n`);
await symlink(targetPath, filePath);
const result = await syncProvider(provider(modelsDir, ["model"], true, true));
expect(result.updated).toBe(0);
expect(await readlink(filePath)).toBe(targetPath);
});
test("sync removes a broken symlink absent from the source", async () => {
const { modelsDir } = await fixture();
const filePath = path.join(modelsDir, "model.toml");
await symlink("missing.toml", filePath);
const result = await syncProvider(provider(modelsDir, []));
expect(result.deleted).toBe(1);
expect(await Bun.file(filePath).exists()).toBe(false);
});
test("non-deleting sync reports missing broken symlinks", async () => {
const { modelsDir } = await fixture();
const filePath = path.join(modelsDir, "model.toml");
await symlink("missing.toml", filePath);
const result = await syncProvider(provider(modelsDir, [], false));
expect(result.deleted).toBe(0);
expect(result.notices).toEqual(["missing: model.toml"]);
expect(await readlink(filePath)).toBe("missing.toml");
});
test("sync preserves authored reasoning options omitted by a translator", async () => {
const { modelsDir } = await fixture();
const filePath = path.join(modelsDir, "model.toml");
await Bun.write(filePath, `name = "Old name"
release_date = "2026-01-01"
last_updated = "2026-01-01"
attachment = false
reasoning = true
tool_call = false
open_weights = false
[[reasoning_options]]
type = "effort"
values = ["low", "high"]
[[reasoning_options]]
type = "budget_tokens"
min = -1
max = 32768
[cost]
input = 1
output = 2
[limit]
context = 1000
output = 100
[modalities]
input = ["text"]
output = ["text"]
`);
const sync = provider(modelsDir, ["model"]);
sync.translateModel = (id) => ({
id,
model: { ...model, reasoning: true },
});
const first = await syncProvider(sync);
const content = await Bun.file(filePath).text();
const second = await syncProvider(sync);
expect(first.updated).toBe(1);
expect(content).toContain("[[reasoning_options]]");
expect(content).toContain('values = ["low", "high"]');
expect(content).toContain("min = -1");
expect(content).toContain("max = 32_768");
expect(second.updated).toBe(0);
expect(second.unchanged).toBe(1);
});
test("sync writes metadata returned by a provider translator", async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "models-dev-sync-metadata-"));
const modelsDir = path.join(root, "providers", "test", "models");
await mkdir(modelsDir, { recursive: true });
const sync = provider(modelsDir, ["model"]);
sync.translateModel = () => ({
id: "model",
model: {
base_model: "test/model",
reasoning_options: [],
cost: { input: 1, output: 2 },
},
metadata: {
id: "test/model",
model: {
name: "Model",
release_date: "2026-06-10",
last_updated: "2026-06-10",
attachment: false,
reasoning: false,
tool_call: true,
open_weights: false,
limit: { context: 1_000, output: 100 },
modalities: { input: ["text"], output: ["text"] },
},
},
});
const first = await syncProvider(sync);
const second = await syncProvider(sync);
expect(first).toMatchObject({ created: 2, updated: 0 });
expect(second).toMatchObject({ created: 0, updated: 0 });
expect(await Bun.file(path.join(root, "models", "test", "model.toml")).text()).toContain('name = "Model"');
});
test("sync removes missing metadata only from its owned namespace", async () => {
const { root, modelsDir } = await fixture();
const ownedDir = path.join(root, "models", "test");
const otherDir = path.join(root, "models", "other");
await mkdir(ownedDir, { recursive: true });
await mkdir(otherDir, { recursive: true });
await Bun.write(path.join(ownedDir, "stale.toml"), 'name = "Stale"\n');
await Bun.write(path.join(otherDir, "retained.toml"), 'name = "Retained"\n');
const sync = provider(modelsDir, []);
sync.metadataNamespace = "test";
const result = await syncProvider(sync);
expect(result.deleted).toBe(1);
expect(await Bun.file(path.join(ownedDir, "stale.toml")).exists()).toBe(false);
expect(await Bun.file(path.join(otherDir, "retained.toml")).exists()).toBe(true);
});
-167
View File
@@ -1,167 +0,0 @@
import { expect, test } from "bun:test";
import { readdirSync } from "node:fs";
import path from "node:path";
import {
buildVeniceModel,
resolveVeniceBaseModel,
venice,
VeniceResponse,
type VeniceModel,
} from "../src/sync/providers/venice.js";
const catalogModel: VeniceModel = {
id: "openai-gpt-54",
created: 1_772_668_800,
model_spec: {
name: "GPT-5.4",
availableContextTokens: 400_000,
maxCompletionTokens: 128_000,
modelSource: "OpenAI",
capabilities: {
supportsVision: true,
supportsReasoning: true,
supportsReasoningEffort: true,
reasoningEffortOptions: ["none", "low", "medium", "high"],
supportsFunctionCalling: true,
supportsResponseSchema: true,
},
pricing: {
input: { usd: 3.13 },
output: { usd: 18.75 },
cache_input: { usd: 0.313 },
extended: {
context_token_threshold: 200_000,
input: { usd: 6.26 },
output: { usd: 28.125 },
},
},
},
};
test("Venice resolves flattened IDs to canonical metadata", () => {
expect(resolveVeniceBaseModel("openai-gpt-54", "GPT-5.4")).toBe("openai/gpt-5.4");
expect(resolveVeniceBaseModel("claude-opus-4-8-fast", "Claude Opus 4.8 Fast"))
.toBe("anthropic/claude-opus-4-8");
});
test("Venice emits empty reasoning options when efforts are unavailable", () => {
const synced = buildVeniceModel({
...catalogModel,
id: "reasoning-without-efforts",
model_spec: {
...catalogModel.model_spec,
name: "Reasoning Without Efforts",
capabilities: {
...catalogModel.model_spec.capabilities,
reasoningEffortOptions: [],
},
},
}, undefined, undefined, "2026-06-10");
expect(synced).toMatchObject({ reasoning: true, reasoning_options: [] });
});
test("Venice does not infer temperature support", () => {
const synced = buildVeniceModel(catalogModel, undefined, null, "2026-06-10");
expect(synced.temperature).toBeUndefined();
});
test("Venice skips E2EE models", () => {
const translated = venice.translateModel({
...catalogModel,
id: "e2ee-test-model",
model_spec: {
...catalogModel.model_spec,
capabilities: { ...catalogModel.model_spec.capabilities, supportsE2EE: true },
},
}, { existing: () => undefined });
expect(translated).toBeUndefined();
});
test("Venice uses boundary-aware family matching", () => {
const synced = buildVeniceModel({
...catalogModel,
id: "google-gemma-4-31b-it",
model_spec: { ...catalogModel.model_spec, name: "Google Gemma 4 31B Instruct" },
}, undefined, null, "2026-06-10");
expect(synced).toMatchObject({ family: "gemma" });
});
test("Venice maps API fields without bumping inherited model timestamps", () => {
const synced = buildVeniceModel(catalogModel, {
base_model: "openai/gpt-5.4",
name: "GPT-5.4",
family: "gpt",
release_date: "2026-03-05",
last_updated: "2026-03-09",
attachment: true,
reasoning: true,
tool_call: true,
structured_output: true,
temperature: true,
open_weights: false,
interleaved: { field: "reasoning_content" },
cost: { input: 3, output: 18, input_audio: 4 },
limit: { context: 400_000, output: 128_000 },
modalities: { input: ["text", "image", "pdf"], output: ["text"] },
}, "openai/gpt-5.4", "2026-06-10");
expect(synced).toMatchObject({
base_model: "openai/gpt-5.4",
base_model_omit: ["limit.input"],
last_updated: "2026-03-09",
reasoning_options: [{ type: "effort", values: ["none", "low", "medium", "high"] }],
interleaved: { field: "reasoning_content" },
cost: {
input: 3.13,
output: 18.75,
cache_read: 0.313,
input_audio: 4,
tiers: [{ tier: { type: "context", size: 200_000 }, input: 6.26, output: 28.125 }],
},
});
expect(synced).not.toHaveProperty("family");
expect(synced).not.toHaveProperty("release_date");
expect(synced).not.toHaveProperty("open_weights");
expect(synced).not.toHaveProperty("modalities");
expect(synced).not.toHaveProperty("temperature");
});
test("Venice preserves last_updated when authoritative data is unchanged", () => {
const providerModel = {
...catalogModel,
id: "venice-only-test-model",
model_spec: { ...catalogModel.model_spec, name: "Venice Only Test Model" },
};
const full = buildVeniceModel(providerModel, undefined, undefined, "2026-06-10");
if ("base_model" in full) throw new Error("Expected a full provider model fixture");
const synced = buildVeniceModel(providerModel, full, undefined, "2026-06-11");
expect(synced).toMatchObject({ last_updated: "2026-06-10" });
});
test("Venice rejects malformed responses", () => {
expect(() => VeniceResponse.parse({ data: [{ id: "broken" }] })).toThrow();
});
test("Venice models use only canonical metadata and declare reasoning options", async () => {
const root = path.join(import.meta.dirname, "..", "..", "..");
const modelsDir = path.join(root, "providers", "venice", "models");
for (const file of readdirSync(modelsDir).filter((item) => item.endsWith(".toml"))) {
const model = Bun.TOML.parse(await Bun.file(path.join(modelsDir, file)).text()) as {
base_model?: string;
reasoning_options?: unknown[];
};
expect(model.reasoning_options, file).toBeDefined();
if (model.base_model !== undefined) {
expect(model.base_model.startsWith("venice/"), file).toBe(false);
expect(await Bun.file(path.join(root, "models", `${model.base_model}.toml`)).exists(), file).toBe(true);
}
expect(file.startsWith("e2ee-"), file).toBe(false);
}
});
-113
View File
@@ -1,113 +0,0 @@
import { expect, test } from "bun:test";
import { buildVercelModel, type VercelModel, vercel } from "../src/sync/providers/vercel.js";
const model: VercelModel = {
id: "openai/gpt-test",
name: "GPT Test",
created: 1_700_000_000,
released: 1_710_000_000,
context_window: 128_000,
max_tokens: 32_000,
type: "language",
tags: ["reasoning", "tool-use", "vision", "file-input"],
pricing: {
input: "0.000001",
output: "0.000004",
input_cache_read: "0.0000001",
},
};
test("Vercel models translate gateway metadata", () => {
const synced = buildVercelModel(model, undefined);
expect(synced).toMatchObject({
name: "GPT Test",
release_date: "2024-03-09",
last_updated: "2024-03-09",
attachment: true,
reasoning: true,
tool_call: true,
open_weights: false,
cost: { input: 1, output: 4, cache_read: 0.1 },
limit: { context: 128_000, input: 96_000, output: 32_000 },
modalities: { input: ["text", "image", "pdf"], output: ["text"] },
});
});
test("Vercel models preserve curated metadata and missing limits", () => {
const synced = buildVercelModel({
...model,
context_window: 0,
max_tokens: 0,
}, {
name: "Curated name",
release_date: "2024-01-01",
last_updated: "2025-01-01",
reasoning_options: [{ type: "effort", values: ["low", "high"] }],
cost: {
input: 2,
output: 8,
tiers: [{
tier: { type: "context", size: 200_000 },
input: 3,
output: 12,
}],
},
limit: { context: 64_000, input: 48_000, output: 16_000 },
});
expect(synced.name).toBe("Curated name");
expect(synced.last_updated).toBe("2025-01-01");
expect(synced.reasoning_options).toEqual([{ type: "effort", values: ["low", "high"] }]);
expect(synced.cost?.tiers).toHaveLength(1);
expect(synced.limit).toEqual({ context: 64_000, input: 48_000, output: 16_000 });
});
test("Vercel non-language models use API tool capabilities", () => {
const synced = buildVercelModel({
...model,
type: "image",
tags: [],
}, {
tool_call: true,
});
expect(synced.tool_call).toBe(false);
});
test("Vercel sync includes non-language model types", () => {
for (const [type, output] of [
["image", ["image"]],
["video", ["video"]],
["reranking", ["text"]],
] as const) {
const source = {
...model,
id: `test/${type}`,
type,
tags: [],
context_window: 0,
max_tokens: 0,
pricing: undefined,
};
expect(vercel.translateModel(source, { existing: () => undefined })).toBeDefined();
expect(buildVercelModel(source, undefined)).toMatchObject({
tool_call: false,
modalities: { input: ["text"], output },
});
}
});
test("Vercel models use canonical metadata when available", () => {
const synced = buildVercelModel({
...model,
id: "nvidia/nemotron-3-ultra-550b-a55b",
name: "Nemotron 3 Ultra",
}, undefined);
expect("base_model" in synced ? synced.base_model : undefined)
.toBe("nvidia/nemotron-3-ultra-550b-a55b");
expect("last_updated" in synced ? synced.last_updated : undefined).toBeUndefined();
});
-30
View File
@@ -1,30 +0,0 @@
import { expect, test } from "bun:test";
import { buildXAIModel, type XAIModel } from "../src/sync/providers/xai.js";
const model: XAIModel = {
id: "grok-test",
created: 1_700_000_000,
input_modalities: ["text"],
output_modalities: ["text"],
prompt_text_token_price: 10_000,
completion_text_token_price: 20_000,
};
test("xAI sync preserves reasoning options", () => {
const synced = buildXAIModel(model, {
name: "Grok Test",
release_date: "2024-01-01",
last_updated: "2024-01-01",
attachment: false,
reasoning: true,
reasoning_options: [{ type: "effort", values: ["none", "high"] }],
tool_call: true,
open_weights: false,
limit: { context: 2_000_000, output: 30_000 },
modalities: { input: ["text"], output: ["text"] },
});
expect(synced.reasoning_options).toEqual([{ type: "effort", values: ["none", "high"] }]);
expect(synced.limit?.context).toBe(2_000_000);
});
@@ -4,7 +4,6 @@ release_date = "2024-11-28"
last_updated = "2024-11-28"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-07-01"
last_updated = "2025-07-01"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-04-29"
last_updated = "2025-04-29"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-07-22"
last_updated = "2025-07-22"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-02-19"
last_updated = "2025-02-19"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2024-10-31"
@@ -4,7 +4,6 @@ release_date = "2025-10-15"
last_updated = "2025-10-15"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-02-28"
@@ -4,7 +4,6 @@ release_date = "2025-08-05"
last_updated = "2025-08-05"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = false
@@ -4,7 +4,6 @@ release_date = "2025-05-14"
last_updated = "2025-05-14"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = false
@@ -4,7 +4,6 @@ release_date = "2025-11-01"
last_updated = "2025-11-01"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-03-31"
@@ -4,7 +4,6 @@ release_date = "2026-02-05"
last_updated = "2026-02-05"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-05-31"
@@ -4,7 +4,6 @@ release_date = "2025-05-14"
last_updated = "2025-05-14"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = false
@@ -4,7 +4,6 @@ release_date = "2025-09-29"
last_updated = "2025-09-29"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-07-31"
@@ -4,7 +4,6 @@ release_date = "2026-02-17"
last_updated = "2026-02-17"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-08-31"
@@ -4,7 +4,6 @@ release_date = "2025-01-20"
last_updated = "2025-01-20"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-06-01"
last_updated = "2025-06-01"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-06-15"
last_updated = "2025-06-15"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-01-20"
last_updated = "2025-01-20"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2025-03-20"
last_updated = "2025-06-05"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-01"
@@ -4,7 +4,6 @@ release_date = "2025-03-25"
last_updated = "2025-03-25"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-01"
@@ -4,7 +4,6 @@ release_date = "2025-12-17"
last_updated = "2025-12-17"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
knowledge = "2025-01"
@@ -4,7 +4,6 @@ release_date = "2026-03-01"
last_updated = "2026-03-01"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
structured_output = true
@@ -4,7 +4,6 @@ release_date = "2026-02-19"
last_updated = "2026-02-19"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
structured_output = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-09-15"
last_updated = "2025-09-15"
attachment = false
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-09-30"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-08-07"
last_updated = "2025-08-07"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-05-30"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-08-07"
last_updated = "2025-08-07"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-05-30"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2025-11-13"
last_updated = "2025-11-13"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-09-30"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2025-11-13"
last_updated = "2025-11-13"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-09-30"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2025-11-13"
last_updated = "2025-11-13"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-09-30"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-11-13"
last_updated = "2025-11-13"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-09-30"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2026-01-01"
last_updated = "2026-01-01"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
knowledge = "2024-09-30"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2025-12-11"
last_updated = "2025-12-11"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2025-08-31"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-12-11"
last_updated = "2025-12-11"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2025-08-31"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2026-03-01"
last_updated = "2026-03-01"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = false
@@ -4,7 +4,6 @@ release_date = "2026-02-05"
last_updated = "2026-02-05"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2025-08-31"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2026-02-05"
last_updated = "2026-02-05"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2025-08-31"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2026-03-05"
last_updated = "2026-03-05"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2025-08-31"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-08-07"
last_updated = "2025-08-07"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-09-30"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-07-09"
last_updated = "2025-07-09"
attachment = true
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = false
@@ -1,5 +1,5 @@
name = "Kimi K2 Turbo Preview"
family = "kimi-k2"
family = "kimi"
release_date = "2025-07-08"
last_updated = "2025-07-08"
attachment = false
+1 -2
View File
@@ -1,10 +1,9 @@
name = "Kimi K2.5"
family = "kimi-k2"
family = "kimi"
release_date = "2026-01"
last_updated = "2026-01"
attachment = false
reasoning = true
reasoning_options = []
structured_output = true
temperature = true
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2024-12-20"
last_updated = "2025-01-29"
attachment = false
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-05"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-06-10"
last_updated = "2025-06-10"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-05"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-04-16"
last_updated = "2025-04-16"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-05"
tool_call = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-04-16"
last_updated = "2025-04-16"
attachment = true
reasoning = true
reasoning_options = []
temperature = false
knowledge = "2024-05"
tool_call = true
@@ -4,7 +4,6 @@ release_date = "2025-08-05"
last_updated = "2025-08-05"
attachment = true
reasoning = true
reasoning_options = [{ type = "effort", values = ["low", "medium", "high"] }]
temperature = true
tool_call = true
open_weights = true
-1
View File
@@ -4,7 +4,6 @@ release_date = "2025-05-28"
last_updated = "2025-05-28"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = false
@@ -4,7 +4,6 @@ release_date = "2025-07-28"
last_updated = "2025-07-28"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -4,7 +4,6 @@ release_date = "2026-02-11"
last_updated = "2026-02-11"
attachment = false
reasoning = true
reasoning_options = []
temperature = true
tool_call = true
open_weights = true
@@ -1,5 +1,4 @@
base_model = "xiaomi/mimo-v2.5-pro"
reasoning_options = [{ type = "toggle" }]
name = "Coding Xiaomi MiMo-V2.5-Pro"
family = "mimo-v2.5-pro"
last_updated = "2026-05-13"
@@ -1,5 +1,4 @@
base_model = "xiaomi/mimo-v2.5"
reasoning_options = [{ type = "toggle" }]
name = "Coding Xiaomi MiMo-V2.5"
family = "mimo-v2.5"
last_updated = "2026-05-13"
+1 -1
View File
@@ -1,5 +1,5 @@
name = "Kimi K2.5"
family = "kimi-k2"
family = "kimi-k2.5"
release_date = "2026-01"
last_updated = "2026-01"
attachment = true
+1 -1
View File
@@ -1,5 +1,5 @@
name = "Kimi K2.6"
family = "kimi-k2"
family = "kimi-k2.6"
release_date = "2026-04-21"
last_updated = "2026-04-21"
attachment = true
Loaded 100 of 1886 files, more files were not shown because too many files have changed in this diff. Show more