@agentproto/catalog-sync 0.5.0 → 0.5.1

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.
package/README.md CHANGED
@@ -67,6 +67,21 @@ Source: `https://openrouter.ai/api/v1/models` (pinned snapshot:
67
67
  `LLMPricing`-compatible.
68
68
  - Unpriced routes (`openrouter/auto`) are skipped.
69
69
 
70
+ ### `llm:requesty`
71
+
72
+ Source: `https://router.requesty.ai/v1/models` (pinned snapshot:
73
+ `snapshots/llm-requesty.json`). Emits
74
+ `packages/model-catalog/src/llm/requesty-routes.generated.ts` — a drop-in
75
+ `REQUESTY_ROUTES: Record<string, LLMPricing>` plus the derived
76
+ `REQUESTY_PROVIDERS` list.
77
+
78
+ - Per-token USD prices (JSON numbers) → `inputPer1M` / `outputPer1M`.
79
+ - `cached_price` is emitted as `cacheReadMultiplier` only when the source also
80
+ marks `supports_caching: true`; Requesty has no cache-write price, so
81
+ `cacheWriteMultiplier` is never emitted.
82
+ - Live refresh requires `REQUESTY_API_KEY` to be set; without it the generator
83
+ reuses the committed snapshot.
84
+
70
85
  ### `llm:context-windows`
71
86
 
72
87
  Sources: Anthropic, Groq, xAI, and Moonshot models-list endpoints (pinned
package/dist/bin.mjs CHANGED
@@ -246,7 +246,134 @@ var llmRequestyGenerator = defineGenerator({
246
246
  sources: sources2,
247
247
  generate: generate2
248
248
  });
249
- var OUTPUT_PATH3 = "packages/model-catalog/src/llm/context-windows.generated.ts";
249
+ var HUGGINGFACE_MODELS_URL = "https://router.huggingface.co/v1/models";
250
+ var OUTPUT_PATH3 = "packages/model-catalog/src/llm/huggingface-routes.generated.ts";
251
+ var HFProviderSchema = z.object({
252
+ provider: z.string(),
253
+ status: z.string(),
254
+ context_length: z.number().optional(),
255
+ pricing: z.object({
256
+ input: z.number().optional(),
257
+ output: z.number().optional()
258
+ }).optional(),
259
+ supports_tools: z.boolean().optional(),
260
+ supports_structured_output: z.boolean().optional()
261
+ }).passthrough();
262
+ var HFModelSchema = z.object({
263
+ id: z.string(),
264
+ providers: z.array(HFProviderSchema).optional()
265
+ }).passthrough();
266
+ var SnapshotSchema3 = z.object({
267
+ data: z.array(HFModelSchema)
268
+ });
269
+ function round4(n) {
270
+ return Math.round(n * 1e4) / 1e4;
271
+ }
272
+ function serializeProvider(p) {
273
+ const fields = [
274
+ `provider: ${JSON.stringify(p.provider)}`,
275
+ `status: ${JSON.stringify(p.status)}`
276
+ ];
277
+ if (p.contextLength !== void 0) fields.push(`contextLength: ${p.contextLength}`);
278
+ if (p.inputPer1M !== void 0) fields.push(`inputPer1M: ${p.inputPer1M}`);
279
+ if (p.outputPer1M !== void 0) fields.push(`outputPer1M: ${p.outputPer1M}`);
280
+ if (p.supportsTools !== void 0) fields.push(`supportsTools: ${p.supportsTools}`);
281
+ if (p.supportsStructuredOutput !== void 0) {
282
+ fields.push(`supportsStructuredOutput: ${p.supportsStructuredOutput}`);
283
+ }
284
+ return ` {
285
+ ${fields.join(",\n ")},
286
+ }`;
287
+ }
288
+ function serializeEntry3(id, e) {
289
+ const providerLines = e.providers.map(serializeProvider).join(",\n");
290
+ return [
291
+ ` ${JSON.stringify(id)}: {`,
292
+ ` wireId: ${JSON.stringify(e.wireId)},`,
293
+ ` providers: [`,
294
+ providerLines,
295
+ ` ],`,
296
+ ` },`
297
+ ].join("\n");
298
+ }
299
+ function serializeFile3(entries) {
300
+ const ids = Object.keys(entries).sort();
301
+ const lines = [
302
+ "// AUTO-GENERATED by @agentproto/catalog-sync (llm:huggingface).",
303
+ "// Do not edit by hand \u2014 re-run `pnpm --filter @agentproto/catalog-sync generate`.",
304
+ `// Source: ${HUGGINGFACE_MODELS_URL}`,
305
+ "// Per-model LIVE inference providers from the HuggingFace router. HF wire",
306
+ "// ids are case-sensitive and preserved verbatim. Provider entries are",
307
+ "// SPARSE on some models \u2014 every field below except provider/status is",
308
+ "// optional and emitted only when the upstream response carries it. Only",
309
+ '// providers with status === "live" are kept; models with zero live',
310
+ "// providers are skipped. inputPer1M/outputPer1M are USD per 1M tokens",
311
+ "// (HuggingFace router convention \u2014 already at that scale, unlike",
312
+ "// OpenRouter's per-token strings).",
313
+ "",
314
+ "export interface HuggingFaceRouteProvider {",
315
+ " provider: string",
316
+ " status: string",
317
+ " contextLength?: number",
318
+ " inputPer1M?: number",
319
+ " outputPer1M?: number",
320
+ " supportsTools?: boolean",
321
+ " supportsStructuredOutput?: boolean",
322
+ "}",
323
+ "",
324
+ "export interface HuggingFaceRoute {",
325
+ " wireId: string",
326
+ " providers: HuggingFaceRouteProvider[]",
327
+ "}",
328
+ "",
329
+ "export const HUGGINGFACE_ROUTES: Record<string, HuggingFaceRoute> = {"
330
+ ];
331
+ for (const id of ids) {
332
+ lines.push(serializeEntry3(id, entries[id]));
333
+ }
334
+ lines.push("}");
335
+ lines.push("");
336
+ return lines.join("\n");
337
+ }
338
+ async function generate3(ctx) {
339
+ const src = sources3[0];
340
+ if (!src) throw new Error("llm:huggingface: no source configured");
341
+ const parsed = SnapshotSchema3.parse(await ctx.fetchSource(src));
342
+ const entries = {};
343
+ for (const model of parsed.data) {
344
+ const liveProviders = (model.providers ?? []).filter((p) => p.status === "live");
345
+ if (liveProviders.length === 0) continue;
346
+ const providers = liveProviders.map((p) => {
347
+ const entry = {
348
+ provider: p.provider,
349
+ status: p.status
350
+ };
351
+ if (p.context_length !== void 0) entry.contextLength = p.context_length;
352
+ if (p.pricing?.input !== void 0) entry.inputPer1M = round4(p.pricing.input);
353
+ if (p.pricing?.output !== void 0) entry.outputPer1M = round4(p.pricing.output);
354
+ if (p.supports_tools !== void 0) entry.supportsTools = p.supports_tools;
355
+ if (p.supports_structured_output !== void 0) {
356
+ entry.supportsStructuredOutput = p.supports_structured_output;
357
+ }
358
+ return entry;
359
+ }).sort((a, b) => a.provider.localeCompare(b.provider));
360
+ entries[model.id] = { wireId: model.id, providers };
361
+ }
362
+ return { [OUTPUT_PATH3]: serializeFile3(entries) };
363
+ }
364
+ var sources3 = [
365
+ {
366
+ id: "llm-huggingface",
367
+ url: HUGGINGFACE_MODELS_URL
368
+ }
369
+ ];
370
+ var llmHuggingfaceGenerator = defineGenerator({
371
+ name: "llm:huggingface",
372
+ modality: "llm",
373
+ sources: sources3,
374
+ generate: generate3
375
+ });
376
+ var OUTPUT_PATH4 = "packages/model-catalog/src/llm/context-windows.generated.ts";
250
377
  var AnthropicModelSchema = z.object({
251
378
  id: z.string(),
252
379
  display_name: z.string().optional(),
@@ -270,14 +397,14 @@ var MoonshotModelSchema = z.object({
270
397
  context_length: z.number().optional()
271
398
  }).passthrough();
272
399
  var MoonshotSnapshotSchema = z.object({ data: z.array(MoonshotModelSchema) });
273
- function serializeEntry3(e) {
400
+ function serializeEntry4(e) {
274
401
  const fields = [`contextWindow: ${e.contextWindow}`];
275
402
  if (e.maxOutput !== void 0) fields.push(`maxOutput: ${e.maxOutput}`);
276
403
  if (e.displayName !== void 0) fields.push(`displayName: ${JSON.stringify(e.displayName)}`);
277
404
  fields.push(`provider: ${JSON.stringify(e.provider)}`);
278
405
  return `{ ${fields.join(", ")} }`;
279
406
  }
280
- function serializeFile3(entries) {
407
+ function serializeFile4(entries) {
281
408
  const ids = Object.keys(entries).sort();
282
409
  const lines = [
283
410
  "// AUTO-GENERATED by @agentproto/catalog-sync (llm:context-windows).",
@@ -297,15 +424,15 @@ function serializeFile3(entries) {
297
424
  "export const CONTEXT_WINDOWS: Record<string, ContextWindowEntry> = {"
298
425
  ];
299
426
  for (const id of ids) {
300
- lines.push(` ${JSON.stringify(id)}: ${serializeEntry3(entries[id])},`);
427
+ lines.push(` ${JSON.stringify(id)}: ${serializeEntry4(entries[id])},`);
301
428
  }
302
429
  lines.push("}");
303
430
  lines.push("");
304
431
  return lines.join("\n");
305
432
  }
306
- async function generate3(ctx) {
433
+ async function generate4(ctx) {
307
434
  const entries = {};
308
- const anthropicSrc = sources3.find((s) => s.id === "llm-anthropic");
435
+ const anthropicSrc = sources4.find((s) => s.id === "llm-anthropic");
309
436
  if (anthropicSrc) {
310
437
  const parsed = AnthropicSnapshotSchema.parse(await ctx.fetchSource(anthropicSrc));
311
438
  for (const m of parsed.data) {
@@ -318,7 +445,7 @@ async function generate3(ctx) {
318
445
  };
319
446
  }
320
447
  }
321
- const groqSrc = sources3.find((s) => s.id === "llm-groq");
448
+ const groqSrc = sources4.find((s) => s.id === "llm-groq");
322
449
  if (groqSrc) {
323
450
  const parsed = GroqSnapshotSchema.parse(await ctx.fetchSource(groqSrc));
324
451
  for (const m of parsed.data) {
@@ -330,7 +457,7 @@ async function generate3(ctx) {
330
457
  };
331
458
  }
332
459
  }
333
- const xaiSrc = sources3.find((s) => s.id === "llm-xai");
460
+ const xaiSrc = sources4.find((s) => s.id === "llm-xai");
334
461
  if (xaiSrc) {
335
462
  const parsed = XaiSnapshotSchema.parse(await ctx.fetchSource(xaiSrc));
336
463
  for (const m of parsed.data) {
@@ -338,7 +465,7 @@ async function generate3(ctx) {
338
465
  entries[m.id] = { contextWindow: m.context_length, provider: "xai" };
339
466
  }
340
467
  }
341
- const moonshotSrc = sources3.find((s) => s.id === "llm-moonshot");
468
+ const moonshotSrc = sources4.find((s) => s.id === "llm-moonshot");
342
469
  if (moonshotSrc) {
343
470
  const parsed = MoonshotSnapshotSchema.parse(await ctx.fetchSource(moonshotSrc));
344
471
  for (const m of parsed.data) {
@@ -346,9 +473,9 @@ async function generate3(ctx) {
346
473
  entries[m.id] = { contextWindow: m.context_length, provider: "moonshot" };
347
474
  }
348
475
  }
349
- return { [OUTPUT_PATH3]: serializeFile3(entries) };
476
+ return { [OUTPUT_PATH4]: serializeFile4(entries) };
350
477
  }
351
- var sources3 = [
478
+ var sources4 = [
352
479
  {
353
480
  id: "llm-anthropic",
354
481
  url: "https://api.anthropic.com/v1/models?limit=1000",
@@ -376,8 +503,8 @@ var sources3 = [
376
503
  var llmContextWindowsGenerator = defineGenerator({
377
504
  name: "llm:context-windows",
378
505
  modality: "llm",
379
- sources: sources3,
380
- generate: generate3
506
+ sources: sources4,
507
+ generate: generate4
381
508
  });
382
509
 
383
510
  // src/generators/serialize-voices.ts
@@ -422,7 +549,7 @@ var ELEVENLABS_SOURCE = {
422
549
  // Live refresh needs the account key; offline reads ignore this.
423
550
  headers: { "xi-api-key": "env:ELEVENLABS_API_KEY" }
424
551
  };
425
- var OUTPUT_PATH4 = "packages/catalog-sync/generated/voice-elevenlabs.generated.ts";
552
+ var OUTPUT_PATH5 = "packages/catalog-sync/generated/voice-elevenlabs.generated.ts";
426
553
  var voiceElevenlabs = defineGenerator({
427
554
  name: "voice:elevenlabs",
428
555
  modality: "voice",
@@ -433,7 +560,7 @@ var voiceElevenlabs = defineGenerator({
433
560
  );
434
561
  const voices = mapElevenLabsVoices(snapshot);
435
562
  return {
436
- [OUTPUT_PATH4]: serializeVoiceModule(
563
+ [OUTPUT_PATH5]: serializeVoiceModule(
437
564
  "voice:elevenlabs",
438
565
  "ELEVENLABS_VOICES",
439
566
  voices
@@ -453,7 +580,7 @@ var MINIMAX_SOURCE = {
453
580
  },
454
581
  body: { voice_type: "system" }
455
582
  };
456
- var OUTPUT_PATH5 = "packages/catalog-sync/generated/voice-minimax.generated.ts";
583
+ var OUTPUT_PATH6 = "packages/catalog-sync/generated/voice-minimax.generated.ts";
457
584
  var voiceMinimax = defineGenerator({
458
585
  name: "voice:minimax",
459
586
  modality: "voice",
@@ -464,7 +591,7 @@ var voiceMinimax = defineGenerator({
464
591
  );
465
592
  const voices = mapMinimaxVoices(snapshot);
466
593
  return {
467
- [OUTPUT_PATH5]: serializeVoiceModule(
594
+ [OUTPUT_PATH6]: serializeVoiceModule(
468
595
  "voice:minimax",
469
596
  "MINIMAX_VOICES",
470
597
  voices
@@ -878,6 +1005,7 @@ var check = flags.has("--check");
878
1005
  var generators = [
879
1006
  llmOpenRouterGenerator,
880
1007
  llmRequestyGenerator,
1008
+ llmHuggingfaceGenerator,
881
1009
  llmContextWindowsGenerator,
882
1010
  voiceElevenlabs,
883
1011
  voiceMinimax,