Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89b834086a | ||
|
|
1ab2ff8163 | ||
|
|
9468676683 | ||
|
|
6cdd2f054b | ||
|
|
b13abc9141 | ||
|
|
e5ba264751 | ||
|
|
a7811fb522 | ||
|
|
605fae75d9 | ||
|
|
26b05268ae | ||
|
|
1aee13d2e5 | ||
|
|
0a924e6bb2 | ||
|
|
9769b2b11d | ||
|
|
1b0db099cf | ||
|
|
16ed78587c | ||
|
|
0b88965165 | ||
|
|
acc704ce39 | ||
|
|
51ad3b264e | ||
|
|
146b6c7084 | ||
|
|
604d4d66a4 | ||
|
|
f5090028b8 | ||
|
|
4bad8faf29 | ||
|
|
0df2ccf586 | ||
|
|
9420048dfe | ||
|
|
8db6c27634 |
No files matched your search
@@ -1,483 +1,5 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import path from "node:path";
|
||||
import { mkdir, readdir, rm } from "node:fs/promises";
|
||||
import { z } from "zod";
|
||||
import { main } from "../src/sync/index.js";
|
||||
|
||||
import { AuthoredModel, AuthoredModelShape } from "../src/schema.js";
|
||||
import { cloudflareWorkersAi } from "./sync/cloudflare-workers-ai.js";
|
||||
import { google } from "./sync/google.js";
|
||||
import { openrouter } from "./sync/openrouter.js";
|
||||
import { xai } from "./sync/xai.js";
|
||||
|
||||
const ExtendsConfig = z
|
||||
.object({
|
||||
from: z.string(),
|
||||
omit: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
const ExistingExtendsConfig = z
|
||||
.object({
|
||||
from: z.string(),
|
||||
omit: z.array(z.string()).optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
const ExistingModel = AuthoredModelShape.partial()
|
||||
.extend({
|
||||
extends: ExistingExtendsConfig.optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
const SyncedExtendsModel = AuthoredModelShape.partial()
|
||||
.extend({
|
||||
id: z.string(),
|
||||
extends: ExtendsConfig,
|
||||
})
|
||||
.strict();
|
||||
|
||||
const SyncedAuthoredModel = z.union([AuthoredModel, SyncedExtendsModel]);
|
||||
|
||||
export type ExistingModel = z.infer<typeof ExistingModel>;
|
||||
export type SyncedFullModel = Omit<z.infer<typeof AuthoredModelShape>, "id">;
|
||||
export type SyncedExtendsModel = Omit<z.infer<typeof SyncedExtendsModel>, "id">;
|
||||
export type SyncedModel = SyncedFullModel | SyncedExtendsModel;
|
||||
|
||||
export interface SyncProvider<SourceModel> {
|
||||
id: string;
|
||||
name: string;
|
||||
modelsDir: string;
|
||||
skipCreates?: boolean;
|
||||
sourceID?(model: SourceModel): string;
|
||||
skippedNotice?(ids: string[]): string[];
|
||||
fetchModels(): Promise<unknown>;
|
||||
parseModels(raw: unknown): SourceModel[];
|
||||
translateModel(
|
||||
model: SourceModel,
|
||||
context: { existing(id: string): ExistingModel | undefined },
|
||||
): { id: string; model: SyncedModel } | undefined;
|
||||
}
|
||||
|
||||
export interface SyncResult {
|
||||
id: string;
|
||||
name: string;
|
||||
status: "changed" | "unchanged";
|
||||
created: number;
|
||||
updated: number;
|
||||
deleted: number;
|
||||
unchanged: number;
|
||||
notices: string[];
|
||||
files: Array<{ status: "created" | "updated" | "deleted"; path: string }>;
|
||||
}
|
||||
|
||||
export const providers: {
|
||||
"cloudflare-workers-ai": SyncProvider<any>;
|
||||
google: SyncProvider<any>;
|
||||
openrouter: SyncProvider<any>;
|
||||
xai: SyncProvider<any>;
|
||||
} = {
|
||||
"cloudflare-workers-ai": cloudflareWorkersAi,
|
||||
google,
|
||||
openrouter,
|
||||
xai,
|
||||
};
|
||||
|
||||
export const groups = {
|
||||
aggregators: ["openrouter"],
|
||||
cloudflare: ["cloudflare-workers-ai"],
|
||||
direct: ["google", "xai"],
|
||||
} as const;
|
||||
|
||||
type ProviderID = keyof typeof providers;
|
||||
|
||||
interface SyncOptions {
|
||||
dryRun?: boolean;
|
||||
newOnly?: boolean;
|
||||
}
|
||||
|
||||
export async function syncProviderByID(id: ProviderID, options: SyncOptions = {}) {
|
||||
return syncProvider(providers[id], options);
|
||||
}
|
||||
|
||||
export async function syncProvider<SourceModel>(
|
||||
provider: SyncProvider<SourceModel>,
|
||||
options: SyncOptions = {},
|
||||
): Promise<SyncResult> {
|
||||
console.log(`\nSyncing ${provider.name}...`);
|
||||
|
||||
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 skippedRemote: string[] = [];
|
||||
|
||||
for (const sourceModel of sourceModels) {
|
||||
const translated = provider.translateModel(sourceModel, {
|
||||
existing(id) {
|
||||
return existing.get(`${id}.toml`)?.toml;
|
||||
},
|
||||
});
|
||||
if (translated === undefined) {
|
||||
if (provider.skipCreates) skippedRemote.push(provider.sourceID?.(sourceModel) ?? "unknown");
|
||||
continue;
|
||||
}
|
||||
|
||||
const relativePath = `${translated.id}.toml`;
|
||||
if (provider.skipCreates && !existing.has(relativePath)) {
|
||||
skippedRemote.push(translated.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (desired.has(relativePath)) {
|
||||
throw new Error(`Duplicate synced model path: ${provider.id}/${relativePath}`);
|
||||
}
|
||||
|
||||
const parsed = SyncedAuthoredModel.safeParse({
|
||||
id: translated.id,
|
||||
...translated.model,
|
||||
});
|
||||
if (!parsed.success) {
|
||||
parsed.error.cause = { provider: provider.id, path: relativePath };
|
||||
throw parsed.error;
|
||||
}
|
||||
|
||||
desired.set(relativePath, {
|
||||
model: parsed.data,
|
||||
content: formatToml(parsed.data),
|
||||
});
|
||||
}
|
||||
|
||||
const files: SyncResult["files"] = [];
|
||||
let unchanged = 0;
|
||||
|
||||
for (const [relativePath, file] of desired) {
|
||||
const filePath = path.join(provider.modelsDir, relativePath);
|
||||
const current = existing.get(relativePath);
|
||||
|
||||
if (current === undefined) {
|
||||
files.push({ status: "created", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would create ${relativePath}`);
|
||||
} else {
|
||||
await mkdir(path.dirname(filePath), { recursive: true });
|
||||
await Bun.write(filePath, file.content);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sameModel(relativePath, current.toml, file.model)) {
|
||||
if (options.newOnly) {
|
||||
unchanged++;
|
||||
continue;
|
||||
}
|
||||
|
||||
files.push({ status: "updated", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would update ${relativePath}`);
|
||||
} else {
|
||||
if (current.symlink) await rm(filePath, { force: true });
|
||||
await Bun.write(filePath, file.content);
|
||||
}
|
||||
} else {
|
||||
unchanged++;
|
||||
}
|
||||
}
|
||||
|
||||
for (const relativePath of existing.keys()) {
|
||||
if (desired.has(relativePath)) continue;
|
||||
if (options.newOnly) {
|
||||
console.log(`Skipping removal in new-only mode: ${relativePath}`);
|
||||
unchanged++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const filePath = path.join(provider.modelsDir, relativePath);
|
||||
files.push({ status: "deleted", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would remove ${relativePath}`);
|
||||
} else {
|
||||
await rm(filePath, { force: true });
|
||||
}
|
||||
}
|
||||
|
||||
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`,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function syncTargets(target: string, options: SyncOptions = {}) {
|
||||
const ids = target in groups
|
||||
? groups[target as keyof typeof groups]
|
||||
: target in providers
|
||||
? [target as ProviderID]
|
||||
: undefined;
|
||||
|
||||
if (ids === undefined) {
|
||||
throw new Error(`Unknown sync target: ${target}`);
|
||||
}
|
||||
|
||||
const results: SyncResult[] = [];
|
||||
for (const id of ids) {
|
||||
results.push(await syncProviderByID(id as ProviderID, options));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
export function syncProviderMatrix() {
|
||||
return {
|
||||
include: Object.values(providers).map((provider) => ({
|
||||
provider: provider.id,
|
||||
name: provider.name,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
async function readExisting(modelsDir: string) {
|
||||
const existing = new Map<string, { text: string; toml: ExistingModel; symlink: boolean }>();
|
||||
|
||||
for (const { file, symlink } of await tomlFiles(modelsDir)) {
|
||||
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: path.join(modelsDir, file) };
|
||||
throw parsed.error;
|
||||
}
|
||||
existing.set(file, { text, toml: parsed.data, symlink });
|
||||
}
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
async function tomlFiles(root: string, dir = "") {
|
||||
const result: Array<{ file: string; symlink: boolean }> = [];
|
||||
|
||||
for (const entry of await readdir(path.join(root, dir), { withFileTypes: true })) {
|
||||
const file = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
result.push(...await tomlFiles(root, file));
|
||||
} else if (entry.name.endsWith(".toml") && (entry.isFile() || entry.isSymbolicLink())) {
|
||||
result.push({ file, symlink: entry.isSymbolicLink() });
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function summarize(
|
||||
provider: { id: string; name: string },
|
||||
files: SyncResult["files"],
|
||||
unchanged: number,
|
||||
notices: string[],
|
||||
): SyncResult {
|
||||
return {
|
||||
id: provider.id,
|
||||
name: provider.name,
|
||||
status: files.length > 0 ? "changed" : "unchanged",
|
||||
created: files.filter((file) => file.status === "created").length,
|
||||
updated: files.filter((file) => file.status === "updated").length,
|
||||
deleted: files.filter((file) => file.status === "deleted").length,
|
||||
unchanged,
|
||||
notices,
|
||||
files,
|
||||
};
|
||||
}
|
||||
|
||||
function sameModel(
|
||||
relativePath: string,
|
||||
current: ExistingModel,
|
||||
desired: z.infer<typeof SyncedAuthoredModel>,
|
||||
) {
|
||||
const parsed = SyncedAuthoredModel.safeParse({
|
||||
id: relativePath.slice(0, -5),
|
||||
...current,
|
||||
});
|
||||
return parsed.success && stable(parsed.data) === stable(desired);
|
||||
}
|
||||
|
||||
function stable(value: unknown): string {
|
||||
if (Array.isArray(value)) {
|
||||
const items = value.map(stable);
|
||||
const ordered = value.every((item) => item === null || typeof item !== "object")
|
||||
? items.sort()
|
||||
: items;
|
||||
return `[${ordered.join(",")}]`;
|
||||
}
|
||||
if (value !== null && typeof value === "object") {
|
||||
return `{${Object.entries(value)
|
||||
.filter(([, item]) => item !== undefined)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([key, item]) => `${JSON.stringify(key)}:${stable(item)}`)
|
||||
.join(",")}}`;
|
||||
}
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
|
||||
async function writeReport(target: string, results: SyncResult[]) {
|
||||
await mkdir(".sync", { recursive: true });
|
||||
|
||||
const lines = [
|
||||
`Updates model TOMLs for the \`${target}\` sync target.`,
|
||||
"",
|
||||
"| Provider | Status | Created | Updated | Deleted |",
|
||||
"| --- | --- | ---: | ---: | ---: |",
|
||||
];
|
||||
|
||||
for (const result of results) {
|
||||
lines.push(
|
||||
`| ${result.name} | ${result.status} | ${result.created} | ${result.updated} | ${result.deleted} |`,
|
||||
);
|
||||
}
|
||||
|
||||
for (const result of results.filter((item) => item.files.length > 0)) {
|
||||
lines.push("", `<details><summary>${result.name} changed files</summary>`, "");
|
||||
for (const file of result.files) {
|
||||
lines.push(`- ${file.status}: \`${file.path}\``);
|
||||
}
|
||||
lines.push("", "</details>");
|
||||
}
|
||||
|
||||
const noticeResults = results.filter((item) => item.notices.length > 0);
|
||||
if (noticeResults.length > 0) {
|
||||
lines.push("", "## Notices");
|
||||
for (const result of noticeResults) {
|
||||
lines.push("", `### ${result.name}`);
|
||||
for (const notice of result.notices) {
|
||||
lines.push(`- ${notice}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lines.push("", "This PR was created automatically by the daily model sync workflow.");
|
||||
await Bun.write(".sync/model-sync-report.md", `${lines.join("\n")}\n`);
|
||||
}
|
||||
|
||||
function quote(value: string) {
|
||||
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
||||
}
|
||||
|
||||
function formatInteger(n: number) {
|
||||
return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
|
||||
}
|
||||
|
||||
function formatNumber(n: number) {
|
||||
return Number.isInteger(n) ? formatInteger(n) : String(n);
|
||||
}
|
||||
|
||||
function formatToml(model: z.infer<typeof SyncedAuthoredModel>) {
|
||||
const lines: string[] = [];
|
||||
const extendsLines: string[] = [];
|
||||
|
||||
if ("extends" in model) {
|
||||
extendsLines.push("[extends]");
|
||||
extendsLines.push(`from = ${quote(model.extends.from)}`);
|
||||
if (model.extends.omit !== undefined) {
|
||||
extendsLines.push(`omit = [${model.extends.omit.map(quote).join(", ")}]`);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.name !== undefined) lines.push(`name = ${quote(model.name)}`);
|
||||
if (model.family !== undefined) lines.push(`family = ${quote(model.family)}`);
|
||||
if (model.release_date !== undefined) lines.push(`release_date = ${quote(model.release_date)}`);
|
||||
if (model.last_updated !== undefined) lines.push(`last_updated = ${quote(model.last_updated)}`);
|
||||
if (model.attachment !== undefined) lines.push(`attachment = ${model.attachment}`);
|
||||
if (model.reasoning !== undefined) lines.push(`reasoning = ${model.reasoning}`);
|
||||
if (model.temperature !== undefined) lines.push(`temperature = ${model.temperature}`);
|
||||
if (model.tool_call !== undefined) lines.push(`tool_call = ${model.tool_call}`);
|
||||
if (model.structured_output !== undefined) {
|
||||
lines.push(`structured_output = ${model.structured_output}`);
|
||||
}
|
||||
if (model.knowledge !== undefined) lines.push(`knowledge = ${quote(model.knowledge)}`);
|
||||
if (model.open_weights !== undefined) lines.push(`open_weights = ${model.open_weights}`);
|
||||
if (model.status !== undefined) lines.push(`status = ${quote(model.status)}`);
|
||||
|
||||
if (extendsLines.length > 0) {
|
||||
if (lines.length > 0) lines.push("");
|
||||
lines.push(...extendsLines);
|
||||
}
|
||||
|
||||
if (model.interleaved !== undefined) {
|
||||
lines.push("");
|
||||
if (model.interleaved === true) {
|
||||
lines.push("interleaved = true");
|
||||
} else {
|
||||
lines.push("[interleaved]");
|
||||
lines.push(`field = ${quote(model.interleaved.field)}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.cost !== undefined) {
|
||||
lines.push("", "[cost]");
|
||||
lines.push(`input = ${formatNumber(model.cost.input)}`);
|
||||
lines.push(`output = ${formatNumber(model.cost.output)}`);
|
||||
if (model.cost.reasoning !== undefined) {
|
||||
lines.push(`reasoning = ${formatNumber(model.cost.reasoning)}`);
|
||||
}
|
||||
if (model.cost.cache_read !== undefined) {
|
||||
lines.push(`cache_read = ${formatNumber(model.cost.cache_read)}`);
|
||||
}
|
||||
if (model.cost.cache_write !== undefined) {
|
||||
lines.push(`cache_write = ${formatNumber(model.cost.cache_write)}`);
|
||||
}
|
||||
if (model.cost.input_audio !== undefined) {
|
||||
lines.push(`input_audio = ${formatNumber(model.cost.input_audio)}`);
|
||||
}
|
||||
if (model.cost.output_audio !== undefined) {
|
||||
lines.push(`output_audio = ${formatNumber(model.cost.output_audio)}`);
|
||||
}
|
||||
|
||||
for (const tier of model.cost.tiers ?? []) {
|
||||
lines.push("", "[[cost.tiers]]");
|
||||
lines.push(`tier = { 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)}`);
|
||||
if (tier.cache_read !== undefined) lines.push(`cache_read = ${formatNumber(tier.cache_read)}`);
|
||||
if (tier.cache_write !== undefined) lines.push(`cache_write = ${formatNumber(tier.cache_write)}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.limit !== undefined) {
|
||||
lines.push("", "[limit]");
|
||||
if (model.limit.context !== undefined) lines.push(`context = ${formatInteger(model.limit.context)}`);
|
||||
if (model.limit.input !== undefined) lines.push(`input = ${formatInteger(model.limit.input)}`);
|
||||
if (model.limit.output !== undefined) lines.push(`output = ${formatInteger(model.limit.output)}`);
|
||||
}
|
||||
|
||||
if (model.modalities !== undefined) {
|
||||
lines.push("", "[modalities]");
|
||||
if (model.modalities.input !== undefined) {
|
||||
lines.push(`input = [${model.modalities.input.map(quote).join(", ")}]`);
|
||||
}
|
||||
if (model.modalities.output !== undefined) {
|
||||
lines.push(`output = [${model.modalities.output.map(quote).join(", ")}]`);
|
||||
}
|
||||
}
|
||||
|
||||
return `${lines.join("\n")}\n`;
|
||||
}
|
||||
|
||||
export async function main(args = process.argv.slice(2)) {
|
||||
if (args.includes("--list-providers")) {
|
||||
console.log(JSON.stringify(syncProviderMatrix()));
|
||||
return;
|
||||
}
|
||||
|
||||
const target = args.find((arg) => !arg.startsWith("-")) ?? "aggregators";
|
||||
const results = await syncTargets(target, {
|
||||
dryRun: args.includes("--dry-run"),
|
||||
newOnly: args.includes("--new-only"),
|
||||
});
|
||||
|
||||
await writeReport(target, results);
|
||||
|
||||
console.log("\nSync summary");
|
||||
for (const result of results) {
|
||||
console.log(
|
||||
`${result.name}: ${result.created} created, ${result.updated} updated, ${result.deleted} deleted`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) await main();
|
||||
await main();
|
||||
@@ -0,0 +1,481 @@
|
||||
import path from "node:path";
|
||||
import { mkdir, readdir, rm } from "node:fs/promises";
|
||||
import { z } from "zod";
|
||||
|
||||
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 { xai } from "./providers/xai.js";
|
||||
|
||||
const ExtendsConfig = z
|
||||
.object({
|
||||
from: z.string(),
|
||||
omit: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
const ExistingExtendsConfig = z
|
||||
.object({
|
||||
from: z.string(),
|
||||
omit: z.array(z.string()).optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
const ExistingModel = AuthoredModelShape.partial()
|
||||
.extend({
|
||||
extends: ExistingExtendsConfig.optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
const SyncedExtendsModel = AuthoredModelShape.partial()
|
||||
.extend({
|
||||
id: z.string(),
|
||||
extends: ExtendsConfig,
|
||||
})
|
||||
.strict();
|
||||
|
||||
const SyncedAuthoredModel = z.union([AuthoredModel, SyncedExtendsModel]);
|
||||
|
||||
export type ExistingModel = z.infer<typeof ExistingModel>;
|
||||
export type SyncedFullModel = Omit<z.infer<typeof AuthoredModelShape>, "id">;
|
||||
export type SyncedExtendsModel = Omit<z.infer<typeof SyncedExtendsModel>, "id">;
|
||||
export type SyncedModel = SyncedFullModel | SyncedExtendsModel;
|
||||
|
||||
export interface SyncProvider<SourceModel> {
|
||||
id: string;
|
||||
name: string;
|
||||
modelsDir: string;
|
||||
skipCreates?: boolean;
|
||||
sourceID?(model: SourceModel): string;
|
||||
skippedNotice?(ids: string[]): string[];
|
||||
fetchModels(): Promise<unknown>;
|
||||
parseModels(raw: unknown): SourceModel[];
|
||||
translateModel(
|
||||
model: SourceModel,
|
||||
context: { existing(id: string): ExistingModel | undefined },
|
||||
): { id: string; model: SyncedModel } | undefined;
|
||||
}
|
||||
|
||||
export interface SyncResult {
|
||||
id: string;
|
||||
name: string;
|
||||
status: "changed" | "unchanged";
|
||||
created: number;
|
||||
updated: number;
|
||||
deleted: number;
|
||||
unchanged: number;
|
||||
notices: string[];
|
||||
files: Array<{ status: "created" | "updated" | "deleted"; path: string }>;
|
||||
}
|
||||
|
||||
export const providers: {
|
||||
"cloudflare-workers-ai": SyncProvider<any>;
|
||||
google: SyncProvider<any>;
|
||||
openrouter: SyncProvider<any>;
|
||||
xai: SyncProvider<any>;
|
||||
} = {
|
||||
"cloudflare-workers-ai": cloudflareWorkersAi,
|
||||
google,
|
||||
openrouter,
|
||||
xai,
|
||||
};
|
||||
|
||||
export const groups = {
|
||||
aggregators: ["openrouter"],
|
||||
cloudflare: ["cloudflare-workers-ai"],
|
||||
direct: ["google", "xai"],
|
||||
} as const;
|
||||
|
||||
type ProviderID = keyof typeof providers;
|
||||
|
||||
interface SyncOptions {
|
||||
dryRun?: boolean;
|
||||
newOnly?: boolean;
|
||||
}
|
||||
|
||||
export async function syncProviderByID(id: ProviderID, options: SyncOptions = {}) {
|
||||
return syncProvider(providers[id], options);
|
||||
}
|
||||
|
||||
export async function syncProvider<SourceModel>(
|
||||
provider: SyncProvider<SourceModel>,
|
||||
options: SyncOptions = {},
|
||||
): Promise<SyncResult> {
|
||||
console.log(`\nSyncing ${provider.name}...`);
|
||||
|
||||
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 skippedRemote: string[] = [];
|
||||
|
||||
for (const sourceModel of sourceModels) {
|
||||
const translated = provider.translateModel(sourceModel, {
|
||||
existing(id) {
|
||||
return existing.get(`${id}.toml`)?.toml;
|
||||
},
|
||||
});
|
||||
if (translated === undefined) {
|
||||
if (provider.skipCreates) skippedRemote.push(provider.sourceID?.(sourceModel) ?? "unknown");
|
||||
continue;
|
||||
}
|
||||
|
||||
const relativePath = `${translated.id}.toml`;
|
||||
if (provider.skipCreates && !existing.has(relativePath)) {
|
||||
skippedRemote.push(translated.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (desired.has(relativePath)) {
|
||||
throw new Error(`Duplicate synced model path: ${provider.id}/${relativePath}`);
|
||||
}
|
||||
|
||||
const parsed = SyncedAuthoredModel.safeParse({
|
||||
id: translated.id,
|
||||
...translated.model,
|
||||
});
|
||||
if (!parsed.success) {
|
||||
parsed.error.cause = { provider: provider.id, path: relativePath };
|
||||
throw parsed.error;
|
||||
}
|
||||
|
||||
desired.set(relativePath, {
|
||||
model: parsed.data,
|
||||
content: formatToml(parsed.data),
|
||||
});
|
||||
}
|
||||
|
||||
const files: SyncResult["files"] = [];
|
||||
let unchanged = 0;
|
||||
|
||||
for (const [relativePath, file] of desired) {
|
||||
const filePath = path.join(provider.modelsDir, relativePath);
|
||||
const current = existing.get(relativePath);
|
||||
|
||||
if (current === undefined) {
|
||||
files.push({ status: "created", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would create ${relativePath}`);
|
||||
} else {
|
||||
await mkdir(path.dirname(filePath), { recursive: true });
|
||||
await Bun.write(filePath, file.content);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sameModel(relativePath, current.toml, file.model)) {
|
||||
if (options.newOnly) {
|
||||
unchanged++;
|
||||
continue;
|
||||
}
|
||||
|
||||
files.push({ status: "updated", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would update ${relativePath}`);
|
||||
} else {
|
||||
if (current.symlink) await rm(filePath, { force: true });
|
||||
await Bun.write(filePath, file.content);
|
||||
}
|
||||
} else {
|
||||
unchanged++;
|
||||
}
|
||||
}
|
||||
|
||||
for (const relativePath of existing.keys()) {
|
||||
if (desired.has(relativePath)) continue;
|
||||
if (options.newOnly) {
|
||||
console.log(`Skipping removal in new-only mode: ${relativePath}`);
|
||||
unchanged++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const filePath = path.join(provider.modelsDir, relativePath);
|
||||
files.push({ status: "deleted", path: filePath });
|
||||
if (options.dryRun) {
|
||||
console.log(`Would remove ${relativePath}`);
|
||||
} else {
|
||||
await rm(filePath, { force: true });
|
||||
}
|
||||
}
|
||||
|
||||
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`,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function syncTargets(target: string, options: SyncOptions = {}) {
|
||||
const ids = target in groups
|
||||
? groups[target as keyof typeof groups]
|
||||
: target in providers
|
||||
? [target as ProviderID]
|
||||
: undefined;
|
||||
|
||||
if (ids === undefined) {
|
||||
throw new Error(`Unknown sync target: ${target}`);
|
||||
}
|
||||
|
||||
const results: SyncResult[] = [];
|
||||
for (const id of ids) {
|
||||
results.push(await syncProviderByID(id as ProviderID, options));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
export function syncProviderMatrix() {
|
||||
return {
|
||||
include: Object.values(providers).map((provider) => ({
|
||||
provider: provider.id,
|
||||
name: provider.name,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
async function readExisting(modelsDir: string) {
|
||||
const existing = new Map<string, { text: string; toml: ExistingModel; symlink: boolean }>();
|
||||
|
||||
for (const { file, symlink } of await tomlFiles(modelsDir)) {
|
||||
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: path.join(modelsDir, file) };
|
||||
throw parsed.error;
|
||||
}
|
||||
existing.set(file, { text, toml: parsed.data, symlink });
|
||||
}
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
async function tomlFiles(root: string, dir = "") {
|
||||
const result: Array<{ file: string; symlink: boolean }> = [];
|
||||
|
||||
for (const entry of await readdir(path.join(root, dir), { withFileTypes: true })) {
|
||||
const file = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
result.push(...await tomlFiles(root, file));
|
||||
} else if (entry.name.endsWith(".toml") && (entry.isFile() || entry.isSymbolicLink())) {
|
||||
result.push({ file, symlink: entry.isSymbolicLink() });
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function summarize(
|
||||
provider: { id: string; name: string },
|
||||
files: SyncResult["files"],
|
||||
unchanged: number,
|
||||
notices: string[],
|
||||
): SyncResult {
|
||||
return {
|
||||
id: provider.id,
|
||||
name: provider.name,
|
||||
status: files.length > 0 ? "changed" : "unchanged",
|
||||
created: files.filter((file) => file.status === "created").length,
|
||||
updated: files.filter((file) => file.status === "updated").length,
|
||||
deleted: files.filter((file) => file.status === "deleted").length,
|
||||
unchanged,
|
||||
notices,
|
||||
files,
|
||||
};
|
||||
}
|
||||
|
||||
function sameModel(
|
||||
relativePath: string,
|
||||
current: ExistingModel,
|
||||
desired: z.infer<typeof SyncedAuthoredModel>,
|
||||
) {
|
||||
const parsed = SyncedAuthoredModel.safeParse({
|
||||
id: relativePath.slice(0, -5),
|
||||
...current,
|
||||
});
|
||||
return parsed.success && stable(parsed.data) === stable(desired);
|
||||
}
|
||||
|
||||
function stable(value: unknown): string {
|
||||
if (Array.isArray(value)) {
|
||||
const items = value.map(stable);
|
||||
const ordered = value.every((item) => item === null || typeof item !== "object")
|
||||
? items.sort()
|
||||
: items;
|
||||
return `[${ordered.join(",")}]`;
|
||||
}
|
||||
if (value !== null && typeof value === "object") {
|
||||
return `{${Object.entries(value)
|
||||
.filter(([, item]) => item !== undefined)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([key, item]) => `${JSON.stringify(key)}:${stable(item)}`)
|
||||
.join(",")}}`;
|
||||
}
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
|
||||
async function writeReport(target: string, results: SyncResult[]) {
|
||||
await mkdir(".sync", { recursive: true });
|
||||
|
||||
const lines = [
|
||||
`Updates model TOMLs for the \`${target}\` sync target.`,
|
||||
"",
|
||||
"| Provider | Status | Created | Updated | Deleted |",
|
||||
"| --- | --- | ---: | ---: | ---: |",
|
||||
];
|
||||
|
||||
for (const result of results) {
|
||||
lines.push(
|
||||
`| ${result.name} | ${result.status} | ${result.created} | ${result.updated} | ${result.deleted} |`,
|
||||
);
|
||||
}
|
||||
|
||||
for (const result of results.filter((item) => item.files.length > 0)) {
|
||||
lines.push("", `<details><summary>${result.name} changed files</summary>`, "");
|
||||
for (const file of result.files) {
|
||||
lines.push(`- ${file.status}: \`${file.path}\``);
|
||||
}
|
||||
lines.push("", "</details>");
|
||||
}
|
||||
|
||||
const noticeResults = results.filter((item) => item.notices.length > 0);
|
||||
if (noticeResults.length > 0) {
|
||||
lines.push("", "## Notices");
|
||||
for (const result of noticeResults) {
|
||||
lines.push("", `### ${result.name}`);
|
||||
for (const notice of result.notices) {
|
||||
lines.push(`- ${notice}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lines.push("", "This PR was created automatically by the daily model sync workflow.");
|
||||
await Bun.write(".sync/model-sync-report.md", `${lines.join("\n")}\n`);
|
||||
}
|
||||
|
||||
function quote(value: string) {
|
||||
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
||||
}
|
||||
|
||||
function formatInteger(n: number) {
|
||||
return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
|
||||
}
|
||||
|
||||
function formatNumber(n: number) {
|
||||
return Number.isInteger(n) ? formatInteger(n) : String(n);
|
||||
}
|
||||
|
||||
function formatToml(model: z.infer<typeof SyncedAuthoredModel>) {
|
||||
const lines: string[] = [];
|
||||
const extendsLines: string[] = [];
|
||||
|
||||
if ("extends" in model) {
|
||||
extendsLines.push("[extends]");
|
||||
extendsLines.push(`from = ${quote(model.extends.from)}`);
|
||||
if (model.extends.omit !== undefined) {
|
||||
extendsLines.push(`omit = [${model.extends.omit.map(quote).join(", ")}]`);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.name !== undefined) lines.push(`name = ${quote(model.name)}`);
|
||||
if (model.family !== undefined) lines.push(`family = ${quote(model.family)}`);
|
||||
if (model.release_date !== undefined) lines.push(`release_date = ${quote(model.release_date)}`);
|
||||
if (model.last_updated !== undefined) lines.push(`last_updated = ${quote(model.last_updated)}`);
|
||||
if (model.attachment !== undefined) lines.push(`attachment = ${model.attachment}`);
|
||||
if (model.reasoning !== undefined) lines.push(`reasoning = ${model.reasoning}`);
|
||||
if (model.temperature !== undefined) lines.push(`temperature = ${model.temperature}`);
|
||||
if (model.tool_call !== undefined) lines.push(`tool_call = ${model.tool_call}`);
|
||||
if (model.structured_output !== undefined) {
|
||||
lines.push(`structured_output = ${model.structured_output}`);
|
||||
}
|
||||
if (model.knowledge !== undefined) lines.push(`knowledge = ${quote(model.knowledge)}`);
|
||||
if (model.open_weights !== undefined) lines.push(`open_weights = ${model.open_weights}`);
|
||||
if (model.status !== undefined) lines.push(`status = ${quote(model.status)}`);
|
||||
|
||||
if (extendsLines.length > 0) {
|
||||
if (lines.length > 0) lines.push("");
|
||||
lines.push(...extendsLines);
|
||||
}
|
||||
|
||||
if (model.interleaved !== undefined) {
|
||||
lines.push("");
|
||||
if (model.interleaved === true) {
|
||||
lines.push("interleaved = true");
|
||||
} else {
|
||||
lines.push("[interleaved]");
|
||||
lines.push(`field = ${quote(model.interleaved.field)}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.cost !== undefined) {
|
||||
lines.push("", "[cost]");
|
||||
lines.push(`input = ${formatNumber(model.cost.input)}`);
|
||||
lines.push(`output = ${formatNumber(model.cost.output)}`);
|
||||
if (model.cost.reasoning !== undefined) {
|
||||
lines.push(`reasoning = ${formatNumber(model.cost.reasoning)}`);
|
||||
}
|
||||
if (model.cost.cache_read !== undefined) {
|
||||
lines.push(`cache_read = ${formatNumber(model.cost.cache_read)}`);
|
||||
}
|
||||
if (model.cost.cache_write !== undefined) {
|
||||
lines.push(`cache_write = ${formatNumber(model.cost.cache_write)}`);
|
||||
}
|
||||
if (model.cost.input_audio !== undefined) {
|
||||
lines.push(`input_audio = ${formatNumber(model.cost.input_audio)}`);
|
||||
}
|
||||
if (model.cost.output_audio !== undefined) {
|
||||
lines.push(`output_audio = ${formatNumber(model.cost.output_audio)}`);
|
||||
}
|
||||
|
||||
for (const tier of model.cost.tiers ?? []) {
|
||||
lines.push("", "[[cost.tiers]]");
|
||||
lines.push(`tier = { 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)}`);
|
||||
if (tier.cache_read !== undefined) lines.push(`cache_read = ${formatNumber(tier.cache_read)}`);
|
||||
if (tier.cache_write !== undefined) lines.push(`cache_write = ${formatNumber(tier.cache_write)}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.limit !== undefined) {
|
||||
lines.push("", "[limit]");
|
||||
if (model.limit.context !== undefined) lines.push(`context = ${formatInteger(model.limit.context)}`);
|
||||
if (model.limit.input !== undefined) lines.push(`input = ${formatInteger(model.limit.input)}`);
|
||||
if (model.limit.output !== undefined) lines.push(`output = ${formatInteger(model.limit.output)}`);
|
||||
}
|
||||
|
||||
if (model.modalities !== undefined) {
|
||||
lines.push("", "[modalities]");
|
||||
if (model.modalities.input !== undefined) {
|
||||
lines.push(`input = [${model.modalities.input.map(quote).join(", ")}]`);
|
||||
}
|
||||
if (model.modalities.output !== undefined) {
|
||||
lines.push(`output = [${model.modalities.output.map(quote).join(", ")}]`);
|
||||
}
|
||||
}
|
||||
|
||||
return `${lines.join("\n")}\n`;
|
||||
}
|
||||
|
||||
export async function main(args = process.argv.slice(2)) {
|
||||
if (args.includes("--list-providers")) {
|
||||
console.log(JSON.stringify(syncProviderMatrix()));
|
||||
return;
|
||||
}
|
||||
|
||||
const target = args.find((arg) => !arg.startsWith("-")) ?? "aggregators";
|
||||
const results = await syncTargets(target, {
|
||||
dryRun: args.includes("--dry-run"),
|
||||
newOnly: args.includes("--new-only"),
|
||||
});
|
||||
|
||||
await writeReport(target, results);
|
||||
|
||||
console.log("\nSync summary");
|
||||
for (const result of results) {
|
||||
console.log(
|
||||
`${result.name}: ${result.created} created, ${result.updated} updated, ${result.deleted} deleted`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) await main();
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ExistingModel, SyncProvider } from "../sync-models.js";
|
||||
import type { ExistingModel, SyncProvider } from "../index.js";
|
||||
import {
|
||||
buildOpenRouterModel,
|
||||
OpenRouterModel,
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ExistingModel, SyncProvider, SyncedModel } from "../sync-models.js";
|
||||
import type { ExistingModel, SyncProvider, SyncedModel } from "../index.js";
|
||||
|
||||
const API_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/models";
|
||||
|
||||
+3
-3
@@ -2,11 +2,11 @@ import { z } from "zod";
|
||||
import { readFileSync, readdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { ModelFamilyValues } from "../../src/family.js";
|
||||
import type { ExistingModel, SyncProvider, SyncedFullModel, SyncedModel } from "../sync-models.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 PROVIDERS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "providers");
|
||||
const PROVIDERS_DIR = path.join(import.meta.dirname, "..", "..", "..", "..", "..", "providers");
|
||||
const modelFilesByProvider = new Map<string, Set<string>>();
|
||||
const canonicalTomlByModel = new Map<string, Record<string, unknown>>();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ExistingModel, SyncProvider, SyncedModel } from "../sync-models.js";
|
||||
import type { ExistingModel, SyncProvider, SyncedModel } from "../index.js";
|
||||
|
||||
const API_BASE = "https://api.x.ai/v1";
|
||||
|
||||
@@ -137,6 +137,11 @@ function tokenPrice(value: number | undefined) {
|
||||
return value / 10_000;
|
||||
}
|
||||
|
||||
function preservedCostTiers(existing: ExistingModel) {
|
||||
// The xAI models API exposes base pricing only; long-context tiers are curated from xAI docs/console.
|
||||
return existing.cost?.tiers;
|
||||
}
|
||||
|
||||
function cost(model: XAIModel, existing: ExistingModel) {
|
||||
const input = tokenPrice(model.prompt_text_token_price);
|
||||
const output = tokenPrice(model.completion_text_token_price);
|
||||
@@ -150,7 +155,7 @@ function cost(model: XAIModel, existing: ExistingModel) {
|
||||
cache_write: existing.cost?.cache_write,
|
||||
input_audio: existing.cost?.input_audio,
|
||||
output_audio: existing.cost?.output_audio,
|
||||
tiers: existing.cost?.tiers,
|
||||
tiers: preservedCostTiers(existing),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
name = "Qwen3.7 Max"
|
||||
family = "qwen"
|
||||
release_date = "2026-05-21"
|
||||
last_updated = "2026-05-21"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 2.50
|
||||
output = 7.50
|
||||
cache_read = 0.50
|
||||
cache_write = 3.125
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 65_536
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,22 @@
|
||||
name = "DeepSeek V3.2"
|
||||
family = "deepseek"
|
||||
release_date = "2025-07-22"
|
||||
last_updated = "2025-07-22"
|
||||
attachment = false
|
||||
reasoning = false
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 0.28
|
||||
output = 0.38
|
||||
cache_read = 0.06
|
||||
|
||||
[limit]
|
||||
context = 163_840
|
||||
output = 163_840
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "deepseek/deepseek-v4-flash"
|
||||
|
||||
[cost]
|
||||
input = 0.12
|
||||
output = 0.21
|
||||
cache_read = 0.02
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 131_072
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,26 @@
|
||||
name = "DeepSeek V4 Pro (Precision)"
|
||||
family = "deepseek-thinking"
|
||||
release_date = "2026-04-24"
|
||||
last_updated = "2026-04-24"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 1.25
|
||||
output = 2.50
|
||||
cache_read = 0.10
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 131_072
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "deepseek/deepseek-v4-pro"
|
||||
|
||||
[cost]
|
||||
input = 0.40
|
||||
output = 0.85
|
||||
cache_read = 0.003
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 131_072
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "google/gemma-4-31b-it"
|
||||
|
||||
[cost]
|
||||
input = 0.10
|
||||
output = 0.30
|
||||
cache_read = 0.02
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 262_144
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,10 @@
|
||||
[extends]
|
||||
from = "zhipuai/glm-4.7-flash"
|
||||
|
||||
[cost]
|
||||
input = 0.04
|
||||
output = 0.30
|
||||
cache_read = 0.008
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "zhipuai/glm-4.7"
|
||||
|
||||
[cost]
|
||||
input = 0.25
|
||||
output = 1.10
|
||||
cache_read = 0.05
|
||||
|
||||
[limit]
|
||||
context = 202_752
|
||||
output = 202_752
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,26 @@
|
||||
name = "GLM 5.1 (Precision)"
|
||||
family = "glm"
|
||||
release_date = "2026-03-27"
|
||||
last_updated = "2026-03-27"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.75
|
||||
output = 2.90
|
||||
cache_read = 0.15
|
||||
|
||||
[limit]
|
||||
context = 202_752
|
||||
output = 202_752
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "zhipuai/glm-5.1"
|
||||
|
||||
[cost]
|
||||
input = 0.45
|
||||
output = 2.10
|
||||
cache_read = 0.09
|
||||
|
||||
[limit]
|
||||
context = 202_752
|
||||
output = 202_752
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "zhipuai/glm-5"
|
||||
|
||||
[cost]
|
||||
input = 0.48
|
||||
output = 1.90
|
||||
cache_read = 0.10
|
||||
|
||||
[limit]
|
||||
context = 202_752
|
||||
output = 202_752
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,21 @@
|
||||
name = "Experiment!: Greg"
|
||||
release_date = "2026-01-27"
|
||||
last_updated = "2026-01-27"
|
||||
attachment = false
|
||||
reasoning = false
|
||||
temperature = true
|
||||
tool_call = false
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 0.10
|
||||
output = 0.20
|
||||
cache_read = 0.02
|
||||
|
||||
[limit]
|
||||
context = 229_376
|
||||
output = 229_376
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,26 @@
|
||||
name = "Kimi K2.5 (Lightning)"
|
||||
family = "kimi-k2.5"
|
||||
release_date = "2026-02-06"
|
||||
last_updated = "2026-02-06"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = false
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 1.00
|
||||
output = 3.00
|
||||
cache_read = 0.20
|
||||
|
||||
[limit]
|
||||
context = 131_072
|
||||
output = 32_768
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,10 @@
|
||||
[extends]
|
||||
from = "moonshotai/kimi-k2.5"
|
||||
|
||||
[cost]
|
||||
input = 0.35
|
||||
output = 1.70
|
||||
cache_read = 0.07
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,26 @@
|
||||
name = "Kimi K2.6 (Precision)"
|
||||
family = "kimi-k2.6"
|
||||
release_date = "2026-04-21"
|
||||
last_updated = "2026-04-21"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.55
|
||||
output = 2.70
|
||||
cache_read = 0.11
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 262_144
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,10 @@
|
||||
[extends]
|
||||
from = "moonshotai/kimi-k2.6"
|
||||
|
||||
[cost]
|
||||
input = 0.50
|
||||
output = 1.99
|
||||
cache_read = 0.10
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,25 @@
|
||||
name = "MiMo-V2.5-Pro (Precision)"
|
||||
family = "mimo"
|
||||
release_date = "2026-04-22"
|
||||
last_updated = "2026-04-22"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = true
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.80
|
||||
output = 2.50
|
||||
cache_read = 0.16
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 131_072
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,10 @@
|
||||
[extends]
|
||||
from = "xiaomi/mimo-v2.5-pro"
|
||||
|
||||
[cost]
|
||||
input = 0.50
|
||||
output = 1.50
|
||||
cache_read = 0.10
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,12 @@
|
||||
reasoning = false
|
||||
|
||||
[extends]
|
||||
from = "minimax/MiniMax-M2.5"
|
||||
|
||||
[cost]
|
||||
input = 0.11
|
||||
output = 0.95
|
||||
cache_read = 0.02
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "alibaba/qwen3.5-397b-a17b"
|
||||
|
||||
[cost]
|
||||
input = 0.35
|
||||
output = 1.75
|
||||
cache_read = 0.07
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 262_144
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,26 @@
|
||||
name = "Qwen3.5 9B"
|
||||
family = "qwen"
|
||||
release_date = "2026-03-13"
|
||||
last_updated = "2026-03-13"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0.04
|
||||
output = 0.15
|
||||
cache_read = 0.008
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 262_144
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video", "audio"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,14 @@
|
||||
[extends]
|
||||
from = "alibaba/qwen3.6-27b"
|
||||
|
||||
[cost]
|
||||
input = 0.20
|
||||
output = 1.50
|
||||
cache_read = 0.04
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 262_144
|
||||
|
||||
[provider]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
@@ -0,0 +1,5 @@
|
||||
name = "CrofAI"
|
||||
env = ["CROF_API_KEY"]
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
api = "https://crof.ai/v1"
|
||||
doc = "https://crof.ai/docs"
|
||||
@@ -0,0 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90.158706 90.190743" fill="currentColor">
|
||||
<g transform="matrix(0.32039341,0,0,0.32039341,-193.03703,-175.63967)">
|
||||
<polygon points="720.6,711.5 602.5,711.5 691.7,622.3 809.8,622.3" />
|
||||
<polygon points="720.6,711.5 809.8,622.3 809.8,711.5" />
|
||||
<polygon points="720.6,711.5 809.8,711.5 809.8,739.5 719.7,829.6 719.2,829.6 719.2,712.8" />
|
||||
<polygon points="602.5,711.5 720.6,711.5 602.5,829.6" />
|
||||
<path d="m 809.8,739.5 v 89.7 c -0.1,0.1 -0.3,0.3 -0.5,0.5 h -89.7 z" />
|
||||
<polygon points="691.7,622.3 602.5,622.3 676.5,548.2 765.7,548.2" />
|
||||
<polygon points="825.9,606.2 707.8,606.2 765.7,548.2 883.9,548.2" />
|
||||
<polygon points="602.5,622.3 691.7,622.3 602.5,711.5" />
|
||||
<polygon points="602.5,829.6 719.2,712.8 719.2,829.6" />
|
||||
<path d="m 809.8,622.3 74,-74 c 0,0 0,130.6 0,206.9 -23.2,23.2 -49.3,49.3 -74,74 z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 889 B |
@@ -0,0 +1,15 @@
|
||||
name = "MiniMax M2.5"
|
||||
structured_output = true
|
||||
|
||||
[extends]
|
||||
from = "minimax/MiniMax-M2.5"
|
||||
|
||||
[cost]
|
||||
input = 0.24
|
||||
output = 0.9
|
||||
cache_read = 0.03
|
||||
cache_write = 0
|
||||
|
||||
[limit]
|
||||
context = 196608
|
||||
output = 196608
|
||||
@@ -0,0 +1,12 @@
|
||||
[extends]
|
||||
from = "moonshotai/kimi-k2.6"
|
||||
|
||||
[cost]
|
||||
input = 0.78
|
||||
output = 3.5
|
||||
cache_read = 0.2
|
||||
cache_write = 0
|
||||
|
||||
[modalities]
|
||||
input = [ "text", "image" ]
|
||||
output = [ "text" ]
|
||||
@@ -0,0 +1,15 @@
|
||||
name = "Llama 3.3 70B Instruct"
|
||||
structured_output = true
|
||||
|
||||
[extends]
|
||||
from = "llama/llama-3.3-70b-instruct"
|
||||
|
||||
[cost]
|
||||
input = 0.12
|
||||
output = 0.38
|
||||
cache_read = 0
|
||||
cache_write = 0
|
||||
|
||||
[limit]
|
||||
context = 131072
|
||||
output = 131072
|
||||
@@ -0,0 +1,14 @@
|
||||
name = "GLM 5.1"
|
||||
|
||||
[extends]
|
||||
from = "zai/glm-5.1"
|
||||
|
||||
[cost]
|
||||
input = 1.4
|
||||
output = 4.4
|
||||
cache_read = 0.26
|
||||
cache_write = 0
|
||||
|
||||
[limit]
|
||||
context = 202752
|
||||
output = 202752
|
||||
@@ -0,0 +1,5 @@
|
||||
name = "Inceptron"
|
||||
npm = "@ai-sdk/openai-compatible"
|
||||
env = ["INCEPTRON_API_KEY"]
|
||||
api = "https://api.inceptron.io/v1"
|
||||
doc = "https://docs.inceptron.io"
|
||||
@@ -0,0 +1,2 @@
|
||||
[extends]
|
||||
from = "google/gemini-3.5-flash"
|
||||
@@ -0,0 +1,2 @@
|
||||
[extends]
|
||||
from = "xai/grok-4.20-0309-non-reasoning"
|
||||
@@ -0,0 +1,2 @@
|
||||
[extends]
|
||||
from = "xai/grok-4.20-0309-reasoning"
|
||||
@@ -0,0 +1,2 @@
|
||||
[extends]
|
||||
from = "alibaba/qwen3.7-max"
|
||||
@@ -8,6 +8,7 @@ temperature = true
|
||||
tool_call = true
|
||||
knowledge = "2025-04"
|
||||
open_weights = false
|
||||
status = "deprecated"
|
||||
|
||||
[cost]
|
||||
input = 0
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
name = "Trinity Large Preview"
|
||||
family = "trinity"
|
||||
release_date = "2026-01-27"
|
||||
last_updated = "2026-01-27"
|
||||
attachment = false
|
||||
reasoning = false
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[cost]
|
||||
input = 0.15
|
||||
output = 0.45
|
||||
|
||||
[limit]
|
||||
context = 131_000
|
||||
output = 131_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -10,12 +10,12 @@ structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[cost]
|
||||
input = 0.32
|
||||
input = 0.317
|
||||
output = 3.2
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
output = 81_920
|
||||
context = 262_140
|
||||
output = 262_140
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
|
||||
@@ -10,8 +10,9 @@ structured_output = true
|
||||
open_weights = true
|
||||
|
||||
[cost]
|
||||
input = 0.149
|
||||
input = 0.15
|
||||
output = 1
|
||||
cache_read = 0.05
|
||||
|
||||
[limit]
|
||||
context = 262_144
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
name = "Qwen3.7 Max"
|
||||
family = "qwen"
|
||||
release_date = "2026-05-21"
|
||||
last_updated = "2026-05-21"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 2.5
|
||||
output = 7.5
|
||||
cache_write = 3.125
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 65_536
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -4,17 +4,18 @@ structured_output = true
|
||||
|
||||
[extends]
|
||||
from = "zai/glm-5.1"
|
||||
omit = ["cost.cache_read", "cost.cache_write"]
|
||||
omit = ["cost.cache_write"]
|
||||
|
||||
[interleaved]
|
||||
field = "reasoning_content"
|
||||
|
||||
[cost]
|
||||
input = 0
|
||||
output = 0
|
||||
input = 0.98
|
||||
output = 3.08
|
||||
cache_read = 0.182
|
||||
|
||||
[limit]
|
||||
context = 202_800
|
||||
context = 202_752
|
||||
output = 202_800
|
||||
|
||||
[modalities]
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
name = "Qwen 3.7 Max"
|
||||
family = "qwen"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
temperature = true
|
||||
release_date = "2026-05-21"
|
||||
last_updated = "2026-05-21"
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 2.5
|
||||
output = 7.5
|
||||
cache_read = 0.5
|
||||
cache_write = 3.125
|
||||
|
||||
[limit]
|
||||
context = 991_000
|
||||
output = 64_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,22 @@
|
||||
name = "Gemini 3.5 Flash"
|
||||
family = "gemini"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
temperature = true
|
||||
release_date = "2026-05-19"
|
||||
last_updated = "2026-05-21"
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 1.5
|
||||
output = 9
|
||||
cache_read = 0.15
|
||||
|
||||
[limit]
|
||||
context = 1_000_000
|
||||
output = 64_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,21 @@
|
||||
name = "Mistral Medium Latest"
|
||||
family = "mistral-medium"
|
||||
attachment = false
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
temperature = true
|
||||
release_date = "2026-05-21"
|
||||
last_updated = "2026-05-21"
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 1.5
|
||||
output = 7.5
|
||||
|
||||
[limit]
|
||||
context = 256_000
|
||||
output = 256_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
output = ["text"]
|
||||
@@ -0,0 +1,22 @@
|
||||
name = "Grok Build 0.1"
|
||||
family = "grok-build"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
tool_call = true
|
||||
temperature = true
|
||||
release_date = "2026-05-20"
|
||||
last_updated = "2026-05-21"
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 1
|
||||
output = 2
|
||||
cache_read = 0.19999999999999998
|
||||
|
||||
[limit]
|
||||
context = 256_000
|
||||
output = 256_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
@@ -15,8 +15,8 @@ cache_read = 0.2
|
||||
|
||||
[[cost.tiers]]
|
||||
tier = { size = 200_000 }
|
||||
input = 4
|
||||
output = 12
|
||||
input = 2.5
|
||||
output = 5
|
||||
cache_read = 0.4
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -15,8 +15,8 @@ cache_read = 0.2
|
||||
|
||||
[[cost.tiers]]
|
||||
tier = { size = 200_000 }
|
||||
input = 4
|
||||
output = 12
|
||||
input = 2.5
|
||||
output = 5
|
||||
cache_read = 0.4
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -15,8 +15,8 @@ cache_read = 0.2
|
||||
|
||||
[[cost.tiers]]
|
||||
tier = { size = 200_000 }
|
||||
input = 4
|
||||
output = 12
|
||||
input = 2.5
|
||||
output = 5
|
||||
cache_read = 0.4
|
||||
|
||||
[limit]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name = "Grok Build 0.1"
|
||||
family = "grok-build"
|
||||
release_date = "2026-05-20"
|
||||
last_updated = "2026-05-20"
|
||||
release_date = "2026-04-16"
|
||||
last_updated = "2026-04-16"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
@@ -10,9 +10,15 @@ structured_output = true
|
||||
open_weights = false
|
||||
|
||||
[cost]
|
||||
input = 1.00
|
||||
output = 2.00
|
||||
cache_read = 0.20
|
||||
input = 1
|
||||
output = 2
|
||||
cache_read = 0.2
|
||||
|
||||
[[cost.tiers]]
|
||||
tier = { size = 200_000 }
|
||||
input = 2.00
|
||||
output = 4.00
|
||||
cache_read = 0.40
|
||||
|
||||
[limit]
|
||||
context = 256_000
|
||||
|
||||
@@ -13,5 +13,5 @@ context = 8_000
|
||||
output = 0
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["image"]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["image", "pdf"]
|
||||
@@ -13,5 +13,5 @@ context = 8_000
|
||||
output = 0
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
output = ["image"]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["image", "pdf"]
|
||||
@@ -13,5 +13,5 @@ context = 1_024
|
||||
output = 0
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image"]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["video"]
|
||||
@@ -20,5 +20,5 @@ context = 400_000
|
||||
output = 128_000
|
||||
|
||||
[modalities]
|
||||
input = ["text"]
|
||||
input = ["text", "image"]
|
||||
output = ["text"]
|
||||
@@ -2,7 +2,7 @@ TODO: delete
|
||||
|
||||
# Model Sync Scripts
|
||||
|
||||
Model syncs are centralized in `packages/core/script/sync-models.ts`. The runner owns file IO, TOML formatting, validation, reporting, dry runs, and deletion behavior. Individual provider sync modules only fetch source data, parse it, and translate each source model into the catalog schema.
|
||||
Model syncs are centralized in `packages/core/src/sync/index.ts`. The runner owns file IO, TOML formatting, validation, reporting, dry runs, and deletion behavior. `packages/core/script/sync-models.ts` is only the CLI wrapper for `bun models:sync`. Individual provider sync modules only fetch source data, parse it, and translate each source model into the catalog schema.
|
||||
|
||||
The grouped sync targets are available for local convenience, but CI syncs each provider separately so every provider gets its own reusable automation PR.
|
||||
|
||||
@@ -23,7 +23,7 @@ Sync runs also write `.sync/model-sync-report.md` for the automation workflow PR
|
||||
|
||||
## Runner Responsibilities
|
||||
|
||||
`packages/core/script/sync-models.ts` handles the shared behavior:
|
||||
`packages/core/src/sync/index.ts` handles the shared behavior:
|
||||
|
||||
- Reads existing TOML files from the provider `modelsDir`.
|
||||
- Parses existing files with `Bun.TOML.parse` and `AuthoredModelShape.partial()`.
|
||||
@@ -39,7 +39,7 @@ Because the runner removes files missing from the desired set, a provider module
|
||||
|
||||
## Provider Modules
|
||||
|
||||
Provider modules live in `packages/core/script/sync/`. A provider exports an object satisfying `SyncProvider<SourceModel>`:
|
||||
Provider modules live in `packages/core/src/sync/providers/`. A provider exports an object satisfying `SyncProvider<SourceModel>`:
|
||||
|
||||
```ts
|
||||
export const provider = {
|
||||
@@ -74,10 +74,10 @@ Do not put TOML scanning, writing, deletion, reporting, or generic comparison lo
|
||||
|
||||
## Adding A Provider
|
||||
|
||||
1. Create `packages/core/script/sync/<provider>.ts`.
|
||||
1. Create `packages/core/src/sync/providers/<provider>.ts`.
|
||||
2. Define strict-enough Zod schemas for the provider response.
|
||||
3. Export a `SyncProvider` implementation with `fetchModels`, `parseModels`, and `translateModel`.
|
||||
4. Add the provider to `providers` in `packages/core/script/sync-models.ts`.
|
||||
4. Add the provider to `providers` in `packages/core/src/sync/index.ts`.
|
||||
5. Add the provider ID to an existing group or create a new group in `groups`.
|
||||
6. Add any required API secrets to `.github/workflows/sync-models.yml` if the provider needs new credentials.
|
||||
7. Run `bun models:sync <provider> --dry-run` to inspect the first diff.
|
||||
@@ -103,13 +103,13 @@ The workflow:
|
||||
|
||||
Each provider job checks out `dev` and writes to a fixed provider branch like `automation/sync-models-openrouter`. If that provider's sync PR is already open, later scheduled runs force-update the same branch and edit the existing PR instead of creating another one. Provider jobs do not share unmerged changes with each other; OpenRouter only extends from canonical provider TOMLs already present on `dev`.
|
||||
|
||||
CI automatically picks up providers registered in `providers` in `packages/core/script/sync-models.ts`. Adding a new sync provider there is enough to get an hourly provider-specific sync job, branch, labels, title, and PR naming convention. The workflow only needs manual updates when a new provider requires new secrets or other environment variables.
|
||||
CI automatically picks up providers registered in `providers` in `packages/core/src/sync/index.ts`. Adding a new sync provider there is enough to get an hourly provider-specific sync job, branch, labels, title, and PR naming convention. The workflow only needs manual updates when a new provider requires new secrets or other environment variables.
|
||||
|
||||
Actions are pinned by commit SHA. Keep new workflow actions pinned the same way.
|
||||
|
||||
## OpenRouter Notes
|
||||
|
||||
OpenRouter is implemented in `packages/core/script/sync/openrouter.ts`.
|
||||
OpenRouter is implemented in `packages/core/src/sync/providers/openrouter.ts`.
|
||||
|
||||
- Source endpoint: `https://openrouter.ai/api/v1/models`.
|
||||
- Optional auth: `OPENROUTER_API_KEY`.
|
||||
@@ -120,7 +120,7 @@ OpenRouter is implemented in `packages/core/script/sync/openrouter.ts`.
|
||||
|
||||
## Cloudflare Workers AI Notes
|
||||
|
||||
Cloudflare Workers AI is implemented in `packages/core/script/sync/cloudflare-workers-ai.ts`.
|
||||
Cloudflare Workers AI is implemented in `packages/core/src/sync/providers/cloudflare-workers-ai.ts`.
|
||||
|
||||
- Source endpoint: `https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID/ai/models/search?format=openrouter`.
|
||||
- Required auth: `CLOUDFLARE_WORKERS_AI_SYNC_ACCOUNT_ID` and `CLOUDFLARE_WORKERS_AI_SYNC_API_TOKEN`.
|
||||
@@ -131,7 +131,7 @@ Cloudflare Workers AI is implemented in `packages/core/script/sync/cloudflare-wo
|
||||
|
||||
## Google Notes
|
||||
|
||||
Google is implemented in `packages/core/script/sync/google.ts`.
|
||||
Google is implemented in `packages/core/src/sync/providers/google.ts`.
|
||||
|
||||
- Source endpoint: `https://generativelanguage.googleapis.com/v1beta/models`.
|
||||
- Required auth: `GOOGLE_API_KEY`, `GEMINI_API_KEY`, or `GOOGLE_GENERATIVE_AI_API_KEY`.
|
||||
@@ -142,7 +142,7 @@ Google is implemented in `packages/core/script/sync/google.ts`.
|
||||
|
||||
## xAI Notes
|
||||
|
||||
xAI is implemented in `packages/core/script/sync/xai.ts`.
|
||||
xAI is implemented in `packages/core/src/sync/providers/xai.ts`.
|
||||
|
||||
- Source endpoints: `https://api.x.ai/v1/language-models`, `https://api.x.ai/v1/image-generation-models`, and `https://api.x.ai/v1/video-generation-models`.
|
||||
- Required auth: `XAI_API_KEY`.
|
||||
|
||||
Reference in new issue
Block a user