@agentproto/catalog-sync 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/generators/llm-openrouter.ts","../src/generators/serialize-voices.ts","../src/generators/voice-elevenlabs.ts","../src/generators/voice-minimax.ts","../src/generators/image-replicate.ts","../src/runner.ts","../src/bin.ts"],"names":["OUTPUT_PATH","__dirname","files","changed"],"mappings":";;;;;;;;;;;;;;;AAsDO,SAAS,gBAAgB,CAAA,EAAuC;AACrE,EAAA,OAAO,CAAA;AACT;;;AC9CA,IAAM,qBAAA,GAAwB,qCAAA;AAG9B,IAAM,WAAA,GAAc,+DAAA;AAYpB,IAAM,aAAA,GAAgB,EACnB,MAAA,CAAO;AAAA,EACN,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,gBAAA,EAAkB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACtC,iBAAA,EAAmB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAChC,CAAC,EACA,WAAA,EAAY;AAEf,IAAM,WAAA,GAAc,EACjB,MAAA,CAAO;AAAA,EACN,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA,EACb,OAAA,EAAS,cAAc,QAAA;AACzB,CAAC,EACA,WAAA,EAAY;AAEf,IAAM,cAAA,GAAiB,EAAE,MAAA,CAAO;AAAA,EAC9B,IAAA,EAAM,CAAA,CAAE,KAAA,CAAM,WAAW;AAC3B,CAAC,CAAA;AAuBD,SAAS,OAAO,CAAA,EAAmB;AACjC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,CAAA,GAAI,GAAS,CAAA,GAAI,GAAA;AACrC;AAGA,SAAS,MAAM,UAAA,EAAoD;AACjE,EAAA,IAAI,U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;AAEA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACtB,EAAA,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,CAAA,oBAAA,EAAuB,OAAA,CAAQ,MAAM,CAAA;AAAA,CAAa,CAAA;AACvE,EAAA,KAAA,MAAW,KAAK,OAAA,EAAS,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,KAAK,CAAC;AAAA,CAAI,CAAA;AAC1D,CAAA,MAAO;AACL,EAAA,OAAA,CAAQ,OAAO,KAAA,CAAM,CAAA;AAAA,CAA6B,CAAA;AACpD;AACA,OAAA,CAAQ,KAAK,CAAC,CAAA","file":"bin.mjs","sourcesContent":["/**\n * catalog-sync generator contract.\n *\n * FROZEN — a sibling agent builds provider generators against this surface.\n * Do not change field names, shapes, or the `defineGenerator` signature\n * without coordinating. Adding new generators is the expected extension\n * path; editing this file is not.\n */\n\nexport interface CatalogSource {\n id: string\n url: string\n /** HTTP method for the live (`--refresh`) fetch. Default `\"GET\"`. */\n method?: \"GET\" | \"POST\"\n /**\n * Request headers for the live fetch. A value may embed `env:VAR_NAME`\n * tokens, resolved from `process.env` at fetch time (e.g.\n * `{ \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" }` or\n * `{ Authorization: \"Bearer env:MINIMAX_API_KEY\" }`). If any referenced env\n * var is unset, the source is treated as un-refreshable — the committed\n * snapshot is reused rather than fetched without auth. Offline reads\n * (default, no `--refresh`) ignore headers entirely.\n */\n headers?: Record<string, string>\n /** JSON request body for POST sources (e.g. MiniMax `get_voice`). */\n body?: unknown\n}\n\nexport interface GeneratorContext {\n /**\n * Reads the pinned snapshot at `snapshots/<src.id>.json`; if missing and\n * `refresh=true`, fetches `src.url` and writes the snapshot. Returns\n * parsed JSON.\n *\n * Offline by default: when no snapshot exists and `refresh` is false this\n * throws — generators MUST be runnable without network access so CI and\n * tests are deterministic. The only network path is behind `--refresh`.\n */\n fetchSource(src: CatalogSource): Promise<unknown>\n refresh: boolean\n}\n\n/** Repo-relative path → TS source text. */\nexport type GeneratedFiles = Record<string, string>\n\nexport interface CatalogGenerator {\n /** e.g. \"llm:openrouter\" */\n name: string\n modality: \"llm\" | \"image\" | \"video\" | \"audio\" | \"voice\"\n sources: CatalogSource[]\n generate(ctx: GeneratorContext): Promise<GeneratedFiles>\n}\n\n/** Identity helper — lets a generator module declare itself with type inference. */\nexport function defineGenerator(g: CatalogGenerator): CatalogGenerator {\n return g\n}\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * PINNED source. The OpenRouter `/api/v1/models` payload lists every route\n * the router exposes with per-token USD pricing. We never fetch it at build\n * or test time — only behind `--refresh`, which writes\n * `snapshots/llm-openrouter.json` so the next offline run is deterministic.\n */\nconst OPENROUTER_MODELS_URL = \"https://openrouter.ai/api/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/openrouter-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// OpenRouter prices are STRINGS of USD-per-token (e.g. \"0.000003\" = $3/1M).\n// `input_cache_read` / `input_cache_write` are optional and only present for\n// models that support prompt caching (Anthropic, etc.). These are the REAL\n// OpenRouter field names (verified against the live /v1/models payload) — an\n// earlier draft used `cache_read`/`cache_write`, which never matched, so cache\n// multipliers were silently always absent. passthrough() keeps the other live\n// keys (web_search, image, audio, internal_reasoning, input_cache_write_1h)\n// forward-compatible without a regenerate — we only read what we model.\n\nconst PricingSchema = z\n .object({\n prompt: z.string().optional(),\n completion: z.string().optional(),\n input_cache_read: z.string().optional(),\n input_cache_write: z.string().optional(),\n })\n .passthrough()\n\nconst ModelSchema = z\n .object({\n id: z.string(),\n pricing: PricingSchema.optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(ModelSchema),\n})\n\n// ── Output shape (mirrors model-catalog's LLMPricing) ────────────────────\n// Drop-in for `packages/model-catalog/src/llm/openrouter-routes.generated.ts`.\n// Structurally identical to LLMPricing — inputPer1M / outputPer1M in USD per\n// 1M tokens, plus cacheReadMultiplier / cacheWriteMultiplier WHEN the source\n// carries cache_read / cache_write. The existing committed file omits cache\n// fields; this generator emits them when present (per the P3 spec: \"plus\n// cache fields if the source has them\"). Fields are optional on LLMPricing,\n// so the output remains drop-in compatible.\n\ninterface LLMPricingEntry {\n inputPer1M: number\n outputPer1M: number\n cacheReadMultiplier?: number\n cacheWriteMultiplier?: number\n vendor: string\n provider: \"openrouter\"\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 6 decimal places, killing binary-float noise from the per-token × 1e6 product. */\nfunction round6(n: number): number {\n return Math.round(n * 1_000_000) / 1_000_000\n}\n\n/** Convert a per-token USD string to USD-per-1M-tokens, or undefined if unpriced. */\nfunction per1m(tokenPrice: string | undefined): number | undefined {\n if (tokenPrice === undefined) return undefined\n const n = Number(tokenPrice)\n if (!Number.isFinite(n)) return undefined\n return round6(n * 1_000_000)\n}\n\n/** Shortest faithful decimal string (matches existing file: 1, 0.5, 0.7448, 1.25). */\nfunction fmt(n: number): string {\n if (!Number.isFinite(n)) return \"0\"\n return `${round6(n)}`\n}\n\n/** Vendor slug = first segment of the OpenRouter route id (`vendor/model`). */\nfunction vendorOf(id: string): string {\n if (!id.includes(\"/\")) return id\n return id.split(\"/\")[0] ?? id\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: LLMPricingEntry): string {\n const fields: string[] = [\n `inputPer1M: ${fmt(e.inputPer1M)}`,\n `outputPer1M: ${fmt(e.outputPer1M)}`,\n ]\n if (e.cacheReadMultiplier !== undefined) {\n fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`)\n }\n if (e.cacheWriteMultiplier !== undefined) {\n fields.push(`cacheWriteMultiplier: ${fmt(e.cacheWriteMultiplier)}`)\n }\n fields.push(`vendor: ${JSON.stringify(e.vendor)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeFile(entries: Record<string, LLMPricingEntry>): string {\n const ids = Object.keys(entries).sort()\n const providers = Array.from(new Set(ids.map(vendorOf))).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:openrouter).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${OPENROUTER_MODELS_URL}`,\n \"// Pricing carries provider USD (inputPer1M / outputPer1M) plus cache\",\n \"// multipliers (cacheReadMultiplier / cacheWriteMultiplier) derived from the\",\n \"// source's input_cache_read / input_cache_write per-token fields when present.\",\n \"\",\n 'import type { LLMPricing } from \"./catalog.js\"',\n \"\",\n \"export const OPENROUTER_ROUTES: Record<string, LLMPricing> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n lines.push(\"/** Provider slugs treated as OpenRouter routes by the picker. */\")\n lines.push(\"export const OPENROUTER_PROVIDERS: readonly string[] = [\")\n for (const p of providers) {\n lines.push(` ${JSON.stringify(p)},`)\n }\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:openrouter: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, LLMPricingEntry> = {}\n for (const model of parsed.data) {\n const pricing = model.pricing\n if (!pricing) continue\n const inputPer1M = per1m(pricing.prompt)\n const outputPer1M = per1m(pricing.completion)\n if (inputPer1M === undefined || outputPer1M === undefined) continue\n // Skip unpriced routes (e.g. openrouter/auto, which carries \"0\" pricing).\n if (inputPer1M === 0 && outputPer1M === 0) continue\n\n const entry: LLMPricingEntry = {\n inputPer1M,\n outputPer1M,\n vendor: vendorOf(model.id),\n provider: \"openrouter\",\n }\n\n const cacheReadPer1M = per1m(pricing.input_cache_read)\n const cacheWritePer1M = per1m(pricing.input_cache_write)\n if (cacheReadPer1M !== undefined && cacheReadPer1M > 0 && inputPer1M > 0) {\n entry.cacheReadMultiplier = round6(cacheReadPer1M / inputPer1M)\n }\n if (cacheWritePer1M !== undefined && cacheWritePer1M > 0 && inputPer1M > 0) {\n entry.cacheWriteMultiplier = round6(cacheWritePer1M / inputPer1M)\n }\n\n entries[model.id] = entry\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources = [{ id: \"llm-openrouter\", url: OPENROUTER_MODELS_URL }]\n\nexport const llmOpenRouterGenerator = defineGenerator({\n name: \"llm:openrouter\",\n modality: \"llm\",\n sources,\n generate,\n})\n","/**\n * Shared CatalogVoice[] → TS-source serializer for the voice generators.\n *\n * The mapping (raw provider JSON → CatalogVoice) lives in\n * `@agentproto/model-catalog/providers` so build time and runtime share it;\n * this module only turns the mapped voices into a committed `*.generated.ts`.\n * Field emit order is fixed (matches the historical generator output) so the\n * generated file stays diff-stable across runs.\n */\n\nimport type { CatalogVoice } from \"@agentproto/model-catalog/schema/voice\"\n\nfunction serializeVoice(v: CatalogVoice): string {\n const lines: string[] = [\" {\"]\n lines.push(` catalogId: ${JSON.stringify(v.catalogId)},`)\n lines.push(` providerVoiceId: ${JSON.stringify(v.providerVoiceId)},`)\n lines.push(` provider: ${JSON.stringify(v.provider)},`)\n lines.push(` label: ${JSON.stringify(v.label)},`)\n lines.push(` description: ${JSON.stringify(v.description)},`)\n lines.push(` gender: ${JSON.stringify(v.gender)},`)\n lines.push(` primaryLanguage: ${JSON.stringify(v.primaryLanguage)},`)\n lines.push(\n ` supportedLanguages: [${v.supportedLanguages.map(l => JSON.stringify(l)).join(\", \")}],`,\n )\n if (v.quality !== undefined) lines.push(` quality: ${JSON.stringify(v.quality)},`)\n if (v.featured !== undefined) lines.push(` featured: ${v.featured},`)\n if (v.samplePath !== undefined) lines.push(` samplePath: ${JSON.stringify(v.samplePath)},`)\n if (v.age !== undefined) lines.push(` age: ${JSON.stringify(v.age)},`)\n lines.push(\" },\")\n return lines.join(\"\\n\")\n}\n\n/**\n * Render a full generated voice module.\n *\n * @param generatorName e.g. `voice:elevenlabs` (goes in the header comment)\n * @param exportName e.g. `ELEVENLABS_VOICES`\n * @param voices mapped voices, in emit order\n */\nexport function serializeVoiceModule(\n generatorName: string,\n exportName: string,\n voices: readonly CatalogVoice[],\n): string {\n const lines: string[] = [\n `// Generated by @agentproto/catalog-sync generator ${generatorName}`,\n \"// DO NOT EDIT MANUALLY — regenerate with catalog-sync\",\n \"\",\n 'import type { CatalogVoice } from \"@agentproto/model-catalog/schema/voice\"',\n \"\",\n `export const ${exportName}: readonly CatalogVoice[] = [`,\n ]\n for (const v of voices) lines.push(serializeVoice(v))\n lines.push(\"] as const\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n","/**\n * voice-elevenlabs generator — reads the ElevenLabs /v1/voices snapshot and\n * emits a CatalogVoice[]-shaped generated TS file.\n *\n * The raw → CatalogVoice mapping lives in\n * `@agentproto/model-catalog/providers` (shared with the runtime\n * live-on-setup path); this generator only fetches, validates, and\n * serializes. Provider-native ids only; no product-specific aliases.\n */\n\nimport {\n ElevenLabsVoicesSnapshotSchema,\n mapElevenLabsVoices,\n} from \"@agentproto/model-catalog/providers\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\nimport { serializeVoiceModule } from \"./serialize-voices.js\"\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (and is the single,\n// dist-safe reader; generators never touch the filesystem themselves).\nexport const ELEVENLABS_SOURCE: CatalogSource = {\n id: \"voice-elevenlabs\",\n url: \"https://api.elevenlabs.io/v1/voices\",\n // Live refresh needs the account key; offline reads ignore this.\n headers: { \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" },\n}\n\nconst OUTPUT_PATH = \"packages/catalog-sync/generated/voice-elevenlabs.generated.ts\"\n\nexport const voiceElevenlabs: CatalogGenerator = defineGenerator({\n name: \"voice:elevenlabs\",\n modality: \"voice\",\n sources: [ELEVENLABS_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const snapshot = ElevenLabsVoicesSnapshotSchema.parse(\n await ctx.fetchSource(ELEVENLABS_SOURCE),\n )\n const voices = mapElevenLabsVoices(snapshot)\n return {\n [OUTPUT_PATH]: serializeVoiceModule(\n \"voice:elevenlabs\",\n \"ELEVENLABS_VOICES\",\n voices,\n ),\n }\n },\n})\n","/**\n * voice-minimax generator — reads the MiniMax /v1/get_voice snapshot and\n * emits a CatalogVoice[]-shaped generated TS file.\n *\n * The raw → CatalogVoice mapping lives in\n * `@agentproto/model-catalog/providers` (shared with the runtime\n * live-on-setup path); this generator only fetches, validates, and\n * serializes. Provider-native ids only; no product-specific aliases.\n */\n\nimport {\n mapMinimaxVoices,\n MinimaxVoicesSnapshotSchema,\n} from \"@agentproto/model-catalog/providers\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\nimport { serializeVoiceModule } from \"./serialize-voices.js\"\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (single dist-safe reader;\n// generators never touch the filesystem themselves).\nexport const MINIMAX_SOURCE: CatalogSource = {\n id: \"voice-minimax\",\n url: \"https://api.minimax.io/v1/get_voice\",\n // get_voice is a POST; live refresh needs the account key (Bearer). Without\n // MINIMAX_API_KEY set, the framework reuses the committed snapshot.\n method: \"POST\",\n headers: {\n Authorization: \"Bearer env:MINIMAX_API_KEY\",\n \"Content-Type\": \"application/json\",\n },\n body: { voice_type: \"system\" },\n}\n\nconst OUTPUT_PATH = \"packages/catalog-sync/generated/voice-minimax.generated.ts\"\n\nexport const voiceMinimax: CatalogGenerator = defineGenerator({\n name: \"voice:minimax\",\n modality: \"voice\",\n sources: [MINIMAX_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const snapshot = MinimaxVoicesSnapshotSchema.parse(\n await ctx.fetchSource(MINIMAX_SOURCE),\n )\n const voices = mapMinimaxVoices(snapshot)\n return {\n [OUTPUT_PATH]: serializeVoiceModule(\n \"voice:minimax\",\n \"MINIMAX_VOICES\",\n voices,\n ),\n }\n },\n})\n","/**\n * image-replicate generator — reads a curated Replicate image-models\n * snapshot and emits ImageModelDefinition[]-shaped generated TS entries.\n *\n * Mirrors the shape from packages/model-catalog/src/image/catalog.ts exactly.\n * Provider-native ids only; no product-specific aliases.\n */\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\n\n// ── Replicate snapshot shapes ───────────────────────────────────────────\n\ninterface ReplicateOpenApiSchema {\n input: { type: string; properties: Record<string, { type: string; items?: { type: string }; format?: string }> }\n output: { type: string; items?: { type: string; format?: string }; format?: string }\n}\n\ninterface ReplicateLatestVersion {\n id: string\n created_at: string\n openapi_schema: ReplicateOpenApiSchema\n}\n\ninterface ReplicateModel {\n owner: string\n name: string\n description: string\n visibility: string\n run_count: number\n cover_image_url: string | null\n latest_version: ReplicateLatestVersion\n}\n\ninterface ReplicateSnapshot {\n _meta: Record<string, unknown>\n models: ReplicateModel[]\n}\n\n// ── ImageModelDefinition mirror (from packages/model-catalog/src/image/catalog.ts) ──\n\ninterface ImageModelPricing {\n costPerImage: number\n costTier: \"low\" | \"medium\" | \"high\"\n billingUnit: \"per_image\"\n baseCost: number\n creditCost?: number\n overrideCreditCost?: number\n}\n\ninterface ImageModelCapabilities {\n generate: boolean\n edit: boolean\n upscale?: boolean\n}\n\ninterface ImageModelReferenceImages {\n supported: boolean\n fieldName: \"image_input\" | \"input_images\" | \"input_image\" | \"none\"\n maxCount: number\n singular: boolean\n}\n\ninterface ImageModelAspectRatio {\n supported: string[]\n default: string\n}\n\ninterface ImageModelEntry {\n id: string\n name: string\n providerId: string\n provider: string\n capabilities: ImageModelCapabilities\n referenceImages: ImageModelReferenceImages\n aspectRatio: ImageModelAspectRatio\n output: \"string\" | \"array\"\n pricing: ImageModelPricing\n description: string\n agentVisible: boolean\n triggerWord?: string\n}\n\n// ── Pricing (hand-authored, mirrors model-catalog) ──────────────────────\n\ninterface PricingRecord {\n costPerImage: number\n costTier: \"low\" | \"medium\" | \"high\"\n baseCost: number\n creditCost?: number\n overrideCreditCost?: number\n}\n\nconst PRICING: Record<string, PricingRecord> = {\n \"nano-banana-pro\": { costPerImage: 0.15, costTier: \"high\", baseCost: 0.15, creditCost: 10 },\n \"nano-banana-2\": { costPerImage: 0.06, costTier: \"medium\", baseCost: 0.06, creditCost: 5 },\n \"nano-banana\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"flux-2-dev\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 3 },\n \"flux-kontext-pro\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"flux-kontext-max\": { costPerImage: 0.08, costTier: \"medium\", baseCost: 0.08, creditCost: 8 },\n \"flux-1.1-pro-ultra\": { costPerImage: 0.06, costTier: \"medium\", baseCost: 0.06, creditCost: 8 },\n \"seedream-4\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 3 },\n \"recraft-v3\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"image-01\": { costPerImage: 0.02, costTier: \"low\", baseCost: 0.02, creditCost: 2 },\n \"gpt-image-1\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"ideogram-v3-turbo\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 4 },\n \"flux-1.1-pro\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n}\n\n// Models visible to agents (the active generation ones)\nconst AGENT_VISIBLE = new Set([\n \"nano-banana-pro\",\n \"nano-banana-2\",\n \"nano-banana\",\n \"flux-2-dev\",\n \"flux-kontext-pro\",\n \"flux-kontext-max\",\n \"flux-1.1-pro-ultra\",\n \"seedream-4\",\n \"recraft-v3\",\n \"image-01\",\n \"gpt-image-1\",\n \"ideogram-v3-turbo\",\n])\n\nconst ASPECT_RATIOS_DEFAULT: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_WIDE: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\", \"4:5\", \"5:4\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_ULTRA: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"21:9\", \"9:21\", \"3:4\", \"4:3\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_NBPRO: ImageModelAspectRatio = {\n supported: [\n \"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\",\n \"4:5\", \"5:4\", \"21:9\",\n ],\n default: \"match_input_image\",\n}\n\nconst ASPECT_RATIOS_NB2: ImageModelAspectRatio = {\n supported: [\n \"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\",\n \"4:5\", \"5:4\",\n ],\n default: \"match_input_image\",\n}\n\nconst ASPECT_RATIOS_SQUARE: ImageModelAspectRatio = {\n supported: [\"1:1\"],\n default: \"1:1\",\n}\n\ninterface ModelSpec {\n id: string\n name: string\n capabilities: ImageModelCapabilities\n referenceImages: ImageModelReferenceImages\n aspectRatio: ImageModelAspectRatio\n output: \"string\" | \"array\"\n triggerWord?: string\n}\n\nconst MODEL_SPECS: Record<string, ModelSpec> = {\n \"nano-banana-pro\": {\n id: \"nano-banana-pro\",\n name: \"Nano Banana Pro\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 14, singular: false },\n aspectRatio: ASPECT_RATIOS_NBPRO,\n output: \"string\",\n },\n \"nano-banana-2\": {\n id: \"nano-banana-2\",\n name: \"Nano Banana 2\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 4, singular: false },\n aspectRatio: ASPECT_RATIOS_NB2,\n output: \"string\",\n },\n \"nano-banana\": {\n id: \"nano-banana\",\n name: \"Nano Banana\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 4, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-2-dev\": {\n id: \"flux-2-dev\",\n name: \"Flux 2 Dev\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_images\", maxCount: 5, singular: false },\n aspectRatio: ASPECT_RATIOS_WIDE,\n output: \"string\",\n },\n \"flux-kontext-pro\": {\n id: \"flux-kontext-pro\",\n name: \"Flux Kontext Pro\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-kontext-max\": {\n id: \"flux-kontext-max\",\n name: \"Flux Kontext Max\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-1.1-pro-ultra\": {\n id: \"flux-1.1-pro-ultra\",\n name: \"Flux 1.1 Pro Ultra\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_ULTRA,\n output: \"string\",\n },\n \"seedream-4\": {\n id: \"seedream-4\",\n name: \"SeedReam 4\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 10, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"recraft-v3\": {\n id: \"recraft\",\n name: \"Recraft V3\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_SQUARE,\n output: \"string\",\n },\n \"image-01\": {\n id: \"minimax\",\n name: \"MiniMax Image\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\", \"3:4\", \"4:3\"], default: \"1:1\" },\n output: \"array\",\n },\n \"gpt-image-1\": {\n id: \"gpt-image-1\",\n name: \"OpenAI GPT Image 1\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: { supported: [\"1:1\", \"2:3\", \"3:2\"], default: \"1:1\" },\n output: \"string\",\n },\n \"ideogram-v3-turbo\": {\n id: \"ideogram-v3\",\n name: \"Ideogram v3\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\"], default: \"1:1\" },\n output: \"string\",\n },\n \"flux-1.1-pro\": {\n id: \"flux\",\n name: \"Flux 1.1 Pro\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\"], default: \"1:1\" },\n output: \"string\",\n },\n}\n\nfunction mapModel(raw: ReplicateModel): ImageModelEntry {\n const providerId = `${raw.owner}/${raw.name}`\n const spec = MODEL_SPECS[raw.name] ?? {\n id: raw.name,\n name: raw.name,\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\" as const, maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\" as const,\n }\n\n const pricing = PRICING[raw.name] ?? {\n costPerImage: 0.03,\n costTier: \"low\" as const,\n baseCost: 0.03,\n creditCost: 3,\n }\n\n return {\n id: spec.id,\n name: spec.name,\n providerId,\n provider: raw.owner === \"openai\" ? \"openai\" : raw.owner === \"minimax\" ? \"minimax\" : \"replicate\",\n capabilities: spec.capabilities,\n referenceImages: spec.referenceImages,\n aspectRatio: spec.aspectRatio,\n output: spec.output,\n pricing: {\n costPerImage: pricing.costPerImage,\n costTier: pricing.costTier,\n billingUnit: \"per_image\" as const,\n baseCost: pricing.baseCost,\n ...(pricing.creditCost !== undefined ? { creditCost: pricing.creditCost } : {}),\n ...(pricing.overrideCreditCost !== undefined ? { overrideCreditCost: pricing.overrideCreditCost } : {}),\n },\n description: raw.description,\n agentVisible: AGENT_VISIBLE.has(raw.name),\n ...(spec.triggerWord ? { triggerWord: spec.triggerWord } : {}),\n }\n}\n\n// ── Generator ────────────────────────────────────────────────────────────\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (single dist-safe reader;\n// generators never touch the filesystem themselves).\nexport const REPLICATE_SOURCE: CatalogSource = {\n id: \"image-replicate\",\n url: \"https://api.replicate.com/v1/models?query=image+generation\",\n}\n\nexport const imageReplicate: CatalogGenerator = defineGenerator({\n name: \"image:replicate\",\n modality: \"image\",\n sources: [REPLICATE_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const data = (await ctx.fetchSource(REPLICATE_SOURCE)) as ReplicateSnapshot\n\n const entries = data.models.map(mapModel)\n\n const lines: string[] = [\n \"// Generated by @agentproto/catalog-sync generator image:replicate\",\n \"// DO NOT EDIT MANUALLY — regenerate with catalog-sync\",\n \"\",\n \"import type { ImageModelDefinition } from \\\"@agentproto/model-catalog/image\\\"\",\n \"\",\n \"export const REPLICATE_IMAGE_MODELS: Record<string, ImageModelDefinition> = {\",\n ]\n\n for (const e of entries) {\n const trigger = e.triggerWord ? `,\\n triggerWord: ${JSON.stringify(e.triggerWord)}` : \"\"\n const creditCost = e.pricing.creditCost !== undefined\n ? `,\\n creditCost: ${e.pricing.creditCost}`\n : \"\"\n const override = e.pricing.overrideCreditCost !== undefined\n ? `,\\n overrideCreditCost: ${e.pricing.overrideCreditCost}`\n : \"\"\n\n lines.push(` ${JSON.stringify(e.id)}: {`)\n lines.push(` id: ${JSON.stringify(e.id)},`)\n lines.push(` name: ${JSON.stringify(e.name)},`)\n lines.push(` providerId: ${JSON.stringify(e.providerId)},`)\n lines.push(` provider: ${JSON.stringify(e.provider)},`)\n lines.push(` capabilities: { generate: ${e.capabilities.generate}, edit: ${e.capabilities.edit}${e.capabilities.upscale ? `, upscale: ${e.capabilities.upscale}` : \"\"} },`)\n lines.push(` referenceImages: {`)\n lines.push(` supported: ${e.referenceImages.supported},`)\n lines.push(` fieldName: ${JSON.stringify(e.referenceImages.fieldName)},`)\n lines.push(` maxCount: ${e.referenceImages.maxCount},`)\n lines.push(` singular: ${e.referenceImages.singular},`)\n lines.push(` },`)\n lines.push(` aspectRatio: {`)\n lines.push(` supported: [${e.aspectRatio.supported.map(a => JSON.stringify(a)).join(\", \")}],`)\n lines.push(` default: ${JSON.stringify(e.aspectRatio.default)},`)\n lines.push(` },`)\n lines.push(` output: ${JSON.stringify(e.output)},`)\n lines.push(` pricing: {`)\n lines.push(` costPerImage: ${e.pricing.costPerImage},`)\n lines.push(` costTier: ${JSON.stringify(e.pricing.costTier)},`)\n lines.push(` billingUnit: ${JSON.stringify(e.pricing.billingUnit)},`)\n lines.push(` baseCost: ${e.pricing.baseCost},${creditCost}${override}`)\n lines.push(` },`)\n lines.push(` description: ${JSON.stringify(e.description)},`)\n lines.push(` agentVisible: ${e.agentVisible},${trigger}`)\n lines.push(` },`)\n }\n\n lines.push(\"}\")\n lines.push(\"\")\n\n const outputPath = \"packages/catalog-sync/generated/image-replicate.generated.ts\"\n return { [outputPath]: lines.join(\"\\n\") }\n },\n})\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { dirname, join, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"./types.js\"\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\n/**\n * The catalog-sync package directory. Resolves the same way whether the\n * module is loaded from `src/` (vitest, type-checking) or `dist/` (built) —\n * both sit one level below the package root, so walking up one directory\n * from this file lands on `packages/catalog-sync/`.\n */\nfunction catalogSyncDir(): string {\n return resolve(__dirname, \"..\")\n}\n\n/** Absolute path to a committed/pinned source snapshot. */\nfunction snapshotPath(id: string): string {\n return join(catalogSyncDir(), \"snapshots\", `${id}.json`)\n}\n\n/**\n * The monorepo root. Resolved by walking up from the catalog-sync package\n * until `pnpm-workspace.yaml` is found. Generated-file paths in\n * {@link GeneratedFiles} are repo-relative and are resolved against this.\n */\nfunction repoRoot(): string {\n let dir = catalogSyncDir()\n for (let i = 0; i < 12; i++) {\n if (existsSync(join(dir, \"pnpm-workspace.yaml\"))) return dir\n const parent = dirname(dir)\n if (parent === dir) break\n dir = parent\n }\n // Fallback: catalog-sync lives at <root>/packages/catalog-sync.\n return dirname(dirname(catalogSyncDir()))\n}\n\n/** Reads an existing file as UTF-8, or returns undefined when absent. */\nfunction readIfExists(absPath: string): string | undefined {\n if (!existsSync(absPath)) return undefined\n return readFileSync(absPath, \"utf8\")\n}\n\n/**\n * Resolve `env:VAR_NAME` tokens inside header values from `process.env`.\n * Returns the materialized headers plus the names of any referenced env vars\n * that are unset — the caller uses `missing` to decide whether the source can\n * be refreshed (we never fetch an authed endpoint without its key).\n */\nfunction resolveHeaders(headers?: Record<string, string>): {\n headers: Record<string, string>\n missing: string[]\n} {\n const out: Record<string, string> = {}\n const missing: string[] = []\n if (!headers) return { headers: out, missing }\n for (const [key, value] of Object.entries(headers)) {\n out[key] = value.replace(/env:([A-Z0-9_]+)/g, (_match, name: string) => {\n const v = process.env[name]\n if (v === undefined || v === \"\") {\n missing.push(name)\n return \"\"\n }\n return v\n })\n }\n return { headers: out, missing }\n}\n\nexport interface RunGeneratorsOptions {\n /** When true, missing snapshots are fetched from their pinned `url`. */\n refresh: boolean\n /** When true, generated files are written to disk at their repo-relative path. */\n write: boolean\n}\n\nexport interface RunGeneratorsResult {\n files: GeneratedFiles\n /** Repo-relative paths whose generated content differs from what is on disk. */\n changed: string[]\n}\n\n/**\n * Runs each generator, gathering its emitted files, then (optionally) writes\n * them. `changed` is ALWAYS computed — it is the diff of generated content\n * vs disk — so `--check` (write=false) can surface drift without mutating\n * anything. Writes only happen when `write=true` AND a path differs.\n */\nexport async function runGenerators(\n gens: CatalogGenerator[],\n opts: RunGeneratorsOptions\n): Promise<RunGeneratorsResult> {\n const files: GeneratedFiles = {}\n\n for (const gen of gens) {\n const ctx: GeneratorContext = {\n refresh: opts.refresh,\n async fetchSource(src: CatalogSource): Promise<unknown> {\n const path = snapshotPath(src.id)\n const existing = readIfExists(path)\n\n // Offline path (default): reuse the committed snapshot; error if none.\n if (!opts.refresh) {\n if (existing !== undefined) return JSON.parse(existing)\n throw new Error(\n `catalog-sync: no committed snapshot for source \"${src.id}\" ` +\n `(${path}), and --refresh is not set. Run ` +\n `\\`catalog-sync generate --refresh\\` to fetch ${src.url}.`\n )\n }\n\n // --refresh: force a live re-fetch (do NOT short-circuit on an existing\n // snapshot — refreshing is the whole point). Auth headers may embed\n // `env:VAR` tokens; if a referenced var is unset we can't authenticate,\n // so reuse the committed snapshot rather than fetch unauthenticated.\n const { headers, missing } = resolveHeaders(src.headers)\n if (missing.length > 0) {\n if (existing !== undefined) {\n process.stderr.write(\n `catalog-sync: skipping refresh of \"${src.id}\" — missing env ` +\n `${missing.join(\", \")}; reusing committed snapshot.\\n`\n )\n return JSON.parse(existing)\n }\n throw new Error(\n `catalog-sync: cannot refresh \"${src.id}\" — missing env ` +\n `${missing.join(\", \")} and no committed snapshot.`\n )\n }\n const res = await fetch(src.url, {\n method: src.method ?? \"GET\",\n headers,\n ...(src.body !== undefined\n ? { body: JSON.stringify(src.body) }\n : {}),\n })\n if (!res.ok) {\n throw new Error(\n `catalog-sync: fetch ${src.url} failed: ${res.status} ${res.statusText}`\n )\n }\n const text = await res.text()\n const parsed: unknown = JSON.parse(text)\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf8\")\n return parsed\n },\n }\n\n const out = await gen.generate(ctx)\n for (const [path, content] of Object.entries(out)) {\n files[path] = content\n }\n }\n\n const root = repoRoot()\n const changed: string[] = []\n for (const [relPath, content] of Object.entries(files)) {\n const abs = join(root, relPath)\n const existing = readIfExists(abs)\n if (existing !== content) {\n changed.push(relPath)\n if (opts.write) {\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, content, \"utf8\")\n }\n }\n }\n\n return { files, changed }\n}\n","#!/usr/bin/env node\n\n/**\n * catalog-sync CLI.\n *\n * catalog-sync generate [--refresh] [--check]\n *\n * - `generate` (default) — generate from pinned snapshots, write changed files.\n * - `--refresh` — re-fetch each source's pinned URL into snapshots/.\n * - `--check` — generate in memory, diff vs committed files; exit 1\n * on drift. This is what CI runs. Never writes.\n */\n\nimport { llmOpenRouterGenerator } from \"./generators/llm-openrouter.js\"\nimport { voiceElevenlabs } from \"./generators/voice-elevenlabs.js\"\nimport { voiceMinimax } from \"./generators/voice-minimax.js\"\nimport { imageReplicate } from \"./generators/image-replicate.js\"\nimport { runGenerators } from \"./runner.js\"\n\nconst args = process.argv.slice(2)\nconst command = args[0] ?? \"\"\nconst flags = new Set(args.slice(1))\n\nconst KNOWN_FLAGS = new Set([\"--refresh\", \"--check\"])\nconst unknownFlags = [...flags].filter((f) => !KNOWN_FLAGS.has(f))\n\nif (command !== \"generate\" || unknownFlags.length > 0) {\n if (command !== \"generate\") {\n process.stderr.write(\n `catalog-sync: unknown command \"${command}\". Usage: catalog-sync generate [--refresh] [--check]\\n`\n )\n }\n if (unknownFlags.length > 0) {\n process.stderr.write(`catalog-sync: unknown flag(s) ${unknownFlags.join(\", \")}\\n`)\n }\n process.exit(2)\n}\n\nconst refresh = flags.has(\"--refresh\")\nconst check = flags.has(\"--check\")\nconst generators = [\n llmOpenRouterGenerator,\n voiceElevenlabs,\n voiceMinimax,\n imageReplicate,\n]\n\nconst { changed, files } = await runGenerators(generators, {\n refresh,\n write: !check,\n})\n\nif (check) {\n if (changed.length > 0) {\n process.stderr.write(\n `catalog-sync: drift detected — ${changed.length} file(s) differ from committed:\\n`\n )\n for (const p of changed) process.stderr.write(` ${p}\\n`)\n process.stderr.write(`Re-run \\`catalog-sync generate\\` to update.\\n`)\n process.exit(1)\n }\n process.stdout.write(\n `catalog-sync: no drift (${generators.length} generator(s), ${Object.keys(files).length} file(s) up to date).\\n`\n )\n process.exit(0)\n}\n\nif (changed.length > 0) {\n process.stdout.write(`catalog-sync: wrote ${changed.length} file(s):\\n`)\n for (const p of changed) process.stdout.write(` ${p}\\n`)\n} else {\n process.stdout.write(`catalog-sync: no changes.\\n`)\n}\nprocess.exit(0)\n"]}
@@ -0,0 +1,5 @@
1
+ import { CatalogGenerator } from '../types.js';
2
+
3
+ declare const llmOpenRouterGenerator: CatalogGenerator;
4
+
5
+ export { llmOpenRouterGenerator };
@@ -0,0 +1,134 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * @agentproto/catalog-sync v0.1.0
5
+ * Build-time generator framework for @agentproto/model-catalog.
6
+ * Generates *.generated.ts from pinned provider sources.
7
+ */
8
+
9
+
10
+ // src/types.ts
11
+ function defineGenerator(g) {
12
+ return g;
13
+ }
14
+
15
+ // src/generators/llm-openrouter.ts
16
+ var OPENROUTER_MODELS_URL = "https://openrouter.ai/api/v1/models";
17
+ var OUTPUT_PATH = "packages/model-catalog/src/llm/openrouter-routes.generated.ts";
18
+ var PricingSchema = z.object({
19
+ prompt: z.string().optional(),
20
+ completion: z.string().optional(),
21
+ input_cache_read: z.string().optional(),
22
+ input_cache_write: z.string().optional()
23
+ }).passthrough();
24
+ var ModelSchema = z.object({
25
+ id: z.string(),
26
+ pricing: PricingSchema.optional()
27
+ }).passthrough();
28
+ var SnapshotSchema = z.object({
29
+ data: z.array(ModelSchema)
30
+ });
31
+ function round6(n) {
32
+ return Math.round(n * 1e6) / 1e6;
33
+ }
34
+ function per1m(tokenPrice) {
35
+ if (tokenPrice === void 0) return void 0;
36
+ const n = Number(tokenPrice);
37
+ if (!Number.isFinite(n)) return void 0;
38
+ return round6(n * 1e6);
39
+ }
40
+ function fmt(n) {
41
+ if (!Number.isFinite(n)) return "0";
42
+ return `${round6(n)}`;
43
+ }
44
+ function vendorOf(id) {
45
+ if (!id.includes("/")) return id;
46
+ return id.split("/")[0] ?? id;
47
+ }
48
+ function serializeEntry(e) {
49
+ const fields = [
50
+ `inputPer1M: ${fmt(e.inputPer1M)}`,
51
+ `outputPer1M: ${fmt(e.outputPer1M)}`
52
+ ];
53
+ if (e.cacheReadMultiplier !== void 0) {
54
+ fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`);
55
+ }
56
+ if (e.cacheWriteMultiplier !== void 0) {
57
+ fields.push(`cacheWriteMultiplier: ${fmt(e.cacheWriteMultiplier)}`);
58
+ }
59
+ fields.push(`vendor: ${JSON.stringify(e.vendor)}`);
60
+ fields.push(`provider: ${JSON.stringify(e.provider)}`);
61
+ return `{
62
+ ${fields.join(",\n ")},
63
+ }`;
64
+ }
65
+ function serializeFile(entries) {
66
+ const ids = Object.keys(entries).sort();
67
+ const providers = Array.from(new Set(ids.map(vendorOf))).sort();
68
+ const lines = [
69
+ "// AUTO-GENERATED by @agentproto/catalog-sync (llm:openrouter).",
70
+ "// Do not edit by hand \u2014 re-run `pnpm --filter @agentproto/catalog-sync generate`.",
71
+ `// Source: ${OPENROUTER_MODELS_URL}`,
72
+ "// Pricing carries provider USD (inputPer1M / outputPer1M) plus cache",
73
+ "// multipliers (cacheReadMultiplier / cacheWriteMultiplier) derived from the",
74
+ "// source's input_cache_read / input_cache_write per-token fields when present.",
75
+ "",
76
+ 'import type { LLMPricing } from "./catalog.js"',
77
+ "",
78
+ "export const OPENROUTER_ROUTES: Record<string, LLMPricing> = {"
79
+ ];
80
+ for (const id of ids) {
81
+ lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id])},`);
82
+ }
83
+ lines.push("}");
84
+ lines.push("");
85
+ lines.push("/** Provider slugs treated as OpenRouter routes by the picker. */");
86
+ lines.push("export const OPENROUTER_PROVIDERS: readonly string[] = [");
87
+ for (const p of providers) {
88
+ lines.push(` ${JSON.stringify(p)},`);
89
+ }
90
+ lines.push("]");
91
+ lines.push("");
92
+ return lines.join("\n");
93
+ }
94
+ async function generate(ctx) {
95
+ const src = sources[0];
96
+ if (!src) throw new Error("llm:openrouter: no source configured");
97
+ const parsed = SnapshotSchema.parse(await ctx.fetchSource(src));
98
+ const entries = {};
99
+ for (const model of parsed.data) {
100
+ const pricing = model.pricing;
101
+ if (!pricing) continue;
102
+ const inputPer1M = per1m(pricing.prompt);
103
+ const outputPer1M = per1m(pricing.completion);
104
+ if (inputPer1M === void 0 || outputPer1M === void 0) continue;
105
+ if (inputPer1M === 0 && outputPer1M === 0) continue;
106
+ const entry = {
107
+ inputPer1M,
108
+ outputPer1M,
109
+ vendor: vendorOf(model.id),
110
+ provider: "openrouter"
111
+ };
112
+ const cacheReadPer1M = per1m(pricing.input_cache_read);
113
+ const cacheWritePer1M = per1m(pricing.input_cache_write);
114
+ if (cacheReadPer1M !== void 0 && cacheReadPer1M > 0 && inputPer1M > 0) {
115
+ entry.cacheReadMultiplier = round6(cacheReadPer1M / inputPer1M);
116
+ }
117
+ if (cacheWritePer1M !== void 0 && cacheWritePer1M > 0 && inputPer1M > 0) {
118
+ entry.cacheWriteMultiplier = round6(cacheWritePer1M / inputPer1M);
119
+ }
120
+ entries[model.id] = entry;
121
+ }
122
+ return { [OUTPUT_PATH]: serializeFile(entries) };
123
+ }
124
+ var sources = [{ id: "llm-openrouter", url: OPENROUTER_MODELS_URL }];
125
+ var llmOpenRouterGenerator = defineGenerator({
126
+ name: "llm:openrouter",
127
+ modality: "llm",
128
+ sources,
129
+ generate
130
+ });
131
+
132
+ export { llmOpenRouterGenerator };
133
+ //# sourceMappingURL=llm-openrouter.mjs.map
134
+ //# sourceMappingURL=llm-openrouter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types.ts","../../src/generators/llm-openrouter.ts"],"names":[],"mappings":";;;;;;;;;;AAsDO,SAAS,gBAAgB,CAAA,EAAuC;AACrE,EAAA,OAAO,CAAA;AACT;;;AC9CA,IAAM,qBAAA,GAAwB,qCAAA;AAG9B,IAAM,WAAA,GAAc,+DAAA;AAYpB,IAAM,aAAA,GAAgB,EACnB,MAAA,CAAO;AAAA,EACN,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,gBAAA,EAAkB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACtC,iBAAA,EAAmB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAChC,CAAC,EACA,WAAA,EAAY;AAEf,IAAM,WAAA,GAAc,EACjB,MAAA,CAAO;AAAA,EACN,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA,EACb,OAAA,EAAS,cAAc,QAAA;AACzB,CAAC,EACA,WAAA,EAAY;AAEf,IAAM,cAAA,GAAiB,EAAE,MAAA,CAAO;AAAA,EAC9B,IAAA,EAAM,CAAA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AAA,KACZ;AAEA,IAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,CAAQ,gBAAgB,CAAA;AACrD,IAAA,MAAM,eAAA,GAAkB,KAAA,CAAM,OAAA,CAAQ,iBAAiB,CAAA;AACvD,IAAA,IAAI,cAAA,KAAmB,MAAA,IAAa,cAAA,GAAiB,CAAA,IAAK,aAAa,CAAA,EAAG;AACxE,MAAA,KAAA,CAAM,mBAAA,GAAsB,MAAA,CAAO,cAAA,GAAiB,UAAU,CAAA;AAAA,IAChE;AACA,IAAA,IAAI,eAAA,KAAoB,MAAA,IAAa,eAAA,GAAkB,CAAA,IAAK,aAAa,CAAA,EAAG;AAC1E,MAAA,KAAA,CAAM,oBAAA,GAAuB,MAAA,CAAO,eAAA,GAAkB,UAAU,CAAA;AAAA,IAClE;AAEA,IAAA,OAAA,CAAQ,KAAA,CAAM,EAAE,CAAA,GAAI,KAAA;AAAA,EACtB;AAEA,EAAA,OAAO,EAAE,CAAC,WAAW,GAAG,aAAA,CAAc,OAAO,CAAA,EAAE;AACjD;AAEA,IAAM,UAAU,CAAC,EAAE,IAAI,gBAAA,EAAkB,GAAA,EAAK,uBAAuB,CAAA;AAE9D,IAAM,yBAAyB,eAAA,CAAgB;AAAA,EACpD,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,KAAA;AAAA,EACV,OAAA;AAAA,EACA;AACF,CAAC","file":"llm-openrouter.mjs","sourcesContent":["/**\n * catalog-sync generator contract.\n *\n * FROZEN — a sibling agent builds provider generators against this surface.\n * Do not change field names, shapes, or the `defineGenerator` signature\n * without coordinating. Adding new generators is the expected extension\n * path; editing this file is not.\n */\n\nexport interface CatalogSource {\n id: string\n url: string\n /** HTTP method for the live (`--refresh`) fetch. Default `\"GET\"`. */\n method?: \"GET\" | \"POST\"\n /**\n * Request headers for the live fetch. A value may embed `env:VAR_NAME`\n * tokens, resolved from `process.env` at fetch time (e.g.\n * `{ \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" }` or\n * `{ Authorization: \"Bearer env:MINIMAX_API_KEY\" }`). If any referenced env\n * var is unset, the source is treated as un-refreshable — the committed\n * snapshot is reused rather than fetched without auth. Offline reads\n * (default, no `--refresh`) ignore headers entirely.\n */\n headers?: Record<string, string>\n /** JSON request body for POST sources (e.g. MiniMax `get_voice`). */\n body?: unknown\n}\n\nexport interface GeneratorContext {\n /**\n * Reads the pinned snapshot at `snapshots/<src.id>.json`; if missing and\n * `refresh=true`, fetches `src.url` and writes the snapshot. Returns\n * parsed JSON.\n *\n * Offline by default: when no snapshot exists and `refresh` is false this\n * throws — generators MUST be runnable without network access so CI and\n * tests are deterministic. The only network path is behind `--refresh`.\n */\n fetchSource(src: CatalogSource): Promise<unknown>\n refresh: boolean\n}\n\n/** Repo-relative path → TS source text. */\nexport type GeneratedFiles = Record<string, string>\n\nexport interface CatalogGenerator {\n /** e.g. \"llm:openrouter\" */\n name: string\n modality: \"llm\" | \"image\" | \"video\" | \"audio\" | \"voice\"\n sources: CatalogSource[]\n generate(ctx: GeneratorContext): Promise<GeneratedFiles>\n}\n\n/** Identity helper — lets a generator module declare itself with type inference. */\nexport function defineGenerator(g: CatalogGenerator): CatalogGenerator {\n return g\n}\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * PINNED source. The OpenRouter `/api/v1/models` payload lists every route\n * the router exposes with per-token USD pricing. We never fetch it at build\n * or test time — only behind `--refresh`, which writes\n * `snapshots/llm-openrouter.json` so the next offline run is deterministic.\n */\nconst OPENROUTER_MODELS_URL = \"https://openrouter.ai/api/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/openrouter-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// OpenRouter prices are STRINGS of USD-per-token (e.g. \"0.000003\" = $3/1M).\n// `input_cache_read` / `input_cache_write` are optional and only present for\n// models that support prompt caching (Anthropic, etc.). These are the REAL\n// OpenRouter field names (verified against the live /v1/models payload) — an\n// earlier draft used `cache_read`/`cache_write`, which never matched, so cache\n// multipliers were silently always absent. passthrough() keeps the other live\n// keys (web_search, image, audio, internal_reasoning, input_cache_write_1h)\n// forward-compatible without a regenerate — we only read what we model.\n\nconst PricingSchema = z\n .object({\n prompt: z.string().optional(),\n completion: z.string().optional(),\n input_cache_read: z.string().optional(),\n input_cache_write: z.string().optional(),\n })\n .passthrough()\n\nconst ModelSchema = z\n .object({\n id: z.string(),\n pricing: PricingSchema.optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(ModelSchema),\n})\n\n// ── Output shape (mirrors model-catalog's LLMPricing) ────────────────────\n// Drop-in for `packages/model-catalog/src/llm/openrouter-routes.generated.ts`.\n// Structurally identical to LLMPricing — inputPer1M / outputPer1M in USD per\n// 1M tokens, plus cacheReadMultiplier / cacheWriteMultiplier WHEN the source\n// carries cache_read / cache_write. The existing committed file omits cache\n// fields; this generator emits them when present (per the P3 spec: \"plus\n// cache fields if the source has them\"). Fields are optional on LLMPricing,\n// so the output remains drop-in compatible.\n\ninterface LLMPricingEntry {\n inputPer1M: number\n outputPer1M: number\n cacheReadMultiplier?: number\n cacheWriteMultiplier?: number\n vendor: string\n provider: \"openrouter\"\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 6 decimal places, killing binary-float noise from the per-token × 1e6 product. */\nfunction round6(n: number): number {\n return Math.round(n * 1_000_000) / 1_000_000\n}\n\n/** Convert a per-token USD string to USD-per-1M-tokens, or undefined if unpriced. */\nfunction per1m(tokenPrice: string | undefined): number | undefined {\n if (tokenPrice === undefined) return undefined\n const n = Number(tokenPrice)\n if (!Number.isFinite(n)) return undefined\n return round6(n * 1_000_000)\n}\n\n/** Shortest faithful decimal string (matches existing file: 1, 0.5, 0.7448, 1.25). */\nfunction fmt(n: number): string {\n if (!Number.isFinite(n)) return \"0\"\n return `${round6(n)}`\n}\n\n/** Vendor slug = first segment of the OpenRouter route id (`vendor/model`). */\nfunction vendorOf(id: string): string {\n if (!id.includes(\"/\")) return id\n return id.split(\"/\")[0] ?? id\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: LLMPricingEntry): string {\n const fields: string[] = [\n `inputPer1M: ${fmt(e.inputPer1M)}`,\n `outputPer1M: ${fmt(e.outputPer1M)}`,\n ]\n if (e.cacheReadMultiplier !== undefined) {\n fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`)\n }\n if (e.cacheWriteMultiplier !== undefined) {\n fields.push(`cacheWriteMultiplier: ${fmt(e.cacheWriteMultiplier)}`)\n }\n fields.push(`vendor: ${JSON.stringify(e.vendor)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeFile(entries: Record<string, LLMPricingEntry>): string {\n const ids = Object.keys(entries).sort()\n const providers = Array.from(new Set(ids.map(vendorOf))).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:openrouter).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${OPENROUTER_MODELS_URL}`,\n \"// Pricing carries provider USD (inputPer1M / outputPer1M) plus cache\",\n \"// multipliers (cacheReadMultiplier / cacheWriteMultiplier) derived from the\",\n \"// source's input_cache_read / input_cache_write per-token fields when present.\",\n \"\",\n 'import type { LLMPricing } from \"./catalog.js\"',\n \"\",\n \"export const OPENROUTER_ROUTES: Record<string, LLMPricing> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n lines.push(\"/** Provider slugs treated as OpenRouter routes by the picker. */\")\n lines.push(\"export const OPENROUTER_PROVIDERS: readonly string[] = [\")\n for (const p of providers) {\n lines.push(` ${JSON.stringify(p)},`)\n }\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:openrouter: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, LLMPricingEntry> = {}\n for (const model of parsed.data) {\n const pricing = model.pricing\n if (!pricing) continue\n const inputPer1M = per1m(pricing.prompt)\n const outputPer1M = per1m(pricing.completion)\n if (inputPer1M === undefined || outputPer1M === undefined) continue\n // Skip unpriced routes (e.g. openrouter/auto, which carries \"0\" pricing).\n if (inputPer1M === 0 && outputPer1M === 0) continue\n\n const entry: LLMPricingEntry = {\n inputPer1M,\n outputPer1M,\n vendor: vendorOf(model.id),\n provider: \"openrouter\",\n }\n\n const cacheReadPer1M = per1m(pricing.input_cache_read)\n const cacheWritePer1M = per1m(pricing.input_cache_write)\n if (cacheReadPer1M !== undefined && cacheReadPer1M > 0 && inputPer1M > 0) {\n entry.cacheReadMultiplier = round6(cacheReadPer1M / inputPer1M)\n }\n if (cacheWritePer1M !== undefined && cacheWritePer1M > 0 && inputPer1M > 0) {\n entry.cacheWriteMultiplier = round6(cacheWritePer1M / inputPer1M)\n }\n\n entries[model.id] = entry\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources = [{ id: \"llm-openrouter\", url: OPENROUTER_MODELS_URL }]\n\nexport const llmOpenRouterGenerator = defineGenerator({\n name: \"llm:openrouter\",\n modality: \"llm\",\n sources,\n generate,\n})\n"]}
@@ -0,0 +1,40 @@
1
+ import { CatalogGenerator } from './types.js';
2
+ export { CatalogSource, GeneratedFiles, GeneratorContext, defineGenerator } from './types.js';
3
+ export { RunGeneratorsOptions, RunGeneratorsResult, runGenerators } from './runner.js';
4
+ export { llmOpenRouterGenerator } from './generators/llm-openrouter.js';
5
+
6
+ /**
7
+ * voice-elevenlabs generator — reads the ElevenLabs /v1/voices snapshot and
8
+ * emits a CatalogVoice[]-shaped generated TS file.
9
+ *
10
+ * The raw → CatalogVoice mapping lives in
11
+ * `@agentproto/model-catalog/providers` (shared with the runtime
12
+ * live-on-setup path); this generator only fetches, validates, and
13
+ * serializes. Provider-native ids only; no product-specific aliases.
14
+ */
15
+
16
+ declare const voiceElevenlabs: CatalogGenerator;
17
+
18
+ /**
19
+ * voice-minimax generator — reads the MiniMax /v1/get_voice snapshot and
20
+ * emits a CatalogVoice[]-shaped generated TS file.
21
+ *
22
+ * The raw → CatalogVoice mapping lives in
23
+ * `@agentproto/model-catalog/providers` (shared with the runtime
24
+ * live-on-setup path); this generator only fetches, validates, and
25
+ * serializes. Provider-native ids only; no product-specific aliases.
26
+ */
27
+
28
+ declare const voiceMinimax: CatalogGenerator;
29
+
30
+ /**
31
+ * image-replicate generator — reads a curated Replicate image-models
32
+ * snapshot and emits ImageModelDefinition[]-shaped generated TS entries.
33
+ *
34
+ * Mirrors the shape from packages/model-catalog/src/image/catalog.ts exactly.
35
+ * Provider-native ids only; no product-specific aliases.
36
+ */
37
+
38
+ declare const imageReplicate: CatalogGenerator;
39
+
40
+ export { CatalogGenerator, imageReplicate, voiceElevenlabs, voiceMinimax };