@agentproto/model-catalog 0.8.4 → 0.9.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.
Files changed (40) hide show
  1. package/dist/access/index.d.ts +3 -3
  2. package/dist/access/index.mjs +5 -2
  3. package/dist/catalog-Cg0AJJZ7.d.ts +1608 -0
  4. package/dist/{chunk-WTHHXXIK.mjs → chunk-BZ7O32GA.mjs} +6 -4
  5. package/dist/chunk-BZ7O32GA.mjs.map +1 -0
  6. package/dist/{chunk-K5Z4VDIW.mjs → chunk-LE7NKYLT.mjs} +4 -4
  7. package/dist/{chunk-K5Z4VDIW.mjs.map → chunk-LE7NKYLT.mjs.map} +1 -1
  8. package/dist/{chunk-TF7JGPTO.mjs → chunk-MR5ZPIUN.mjs} +1127 -945
  9. package/dist/chunk-MR5ZPIUN.mjs.map +1 -0
  10. package/dist/{chunk-C7NB3TTG.mjs → chunk-O7ZJEMH6.mjs} +4 -4
  11. package/dist/{chunk-C7NB3TTG.mjs.map → chunk-O7ZJEMH6.mjs.map} +1 -1
  12. package/dist/{chunk-HRRG2RZO.mjs → chunk-PUIEZ3G4.mjs} +3 -3
  13. package/dist/{chunk-HRRG2RZO.mjs.map → chunk-PUIEZ3G4.mjs.map} +1 -1
  14. package/dist/{chunk-6DLCFYAL.mjs → chunk-RK6MHEIS.mjs} +2026 -474
  15. package/dist/chunk-RK6MHEIS.mjs.map +1 -0
  16. package/dist/{chunk-HP6XQD3U.mjs → chunk-RKG52ASE.mjs} +21 -10
  17. package/dist/chunk-RKG52ASE.mjs.map +1 -0
  18. package/dist/{chunk-O7TXHU5W.mjs → chunk-ZTTWZ7PL.mjs} +19 -3
  19. package/dist/chunk-ZTTWZ7PL.mjs.map +1 -0
  20. package/dist/cost/index.mjs +6 -6
  21. package/dist/curation/index.d.ts +2 -2
  22. package/dist/curation/index.mjs +6 -6
  23. package/dist/{evaluate-CvrdzuYW.d.ts → evaluate-D3gXrAg-.d.ts} +1 -1
  24. package/dist/{index-CpxCXwo_.d.ts → index-BZfxAdXA.d.ts} +10 -2
  25. package/dist/{index-Bk5U4gcS.d.ts → index-DC8jecem.d.ts} +2 -2
  26. package/dist/index.d.ts +5 -5
  27. package/dist/index.mjs +10 -10
  28. package/dist/llm/index.d.ts +12 -2
  29. package/dist/llm/index.mjs +2 -2
  30. package/dist/overlay/index.d.ts +1 -1
  31. package/dist/picker/index.d.ts +4 -4
  32. package/dist/route-identity/index.d.ts +1 -1
  33. package/dist/route-identity/index.mjs +2 -2
  34. package/package.json +2 -2
  35. package/dist/catalog-IWd755ti.d.ts +0 -969
  36. package/dist/chunk-6DLCFYAL.mjs.map +0 -1
  37. package/dist/chunk-HP6XQD3U.mjs.map +0 -1
  38. package/dist/chunk-O7TXHU5W.mjs.map +0 -1
  39. package/dist/chunk-TF7JGPTO.mjs.map +0 -1
  40. package/dist/chunk-WTHHXXIK.mjs.map +0 -1
@@ -1,969 +0,0 @@
1
- import { b as CatalogProvider } from './base-B8IIoaqg.js';
2
-
3
- interface ContextWindowEntry {
4
- contextWindow: number;
5
- maxOutput?: number;
6
- displayName?: string;
7
- provider: "anthropic" | "groq" | "xai" | "moonshot";
8
- }
9
-
10
- /**
11
- * LLM Pricing Catalog — per-token costs for all LLM models.
12
- *
13
- * Migrated from `packages/core/src/config/llm-pricing.ts` (commit `eeb1acdc`
14
- * era). The original location now re-exports from here so every existing
15
- * consumer (orchestrator dynamic imports, agent-analytics) keeps working.
16
- *
17
- * Prices in USD per 1M tokens (input and output separated).
18
- * Credit costs are what we charge users (includes margin).
19
- */
20
-
21
- interface LLMPricing {
22
- /** Provider cost: $ per 1M input tokens */
23
- inputPer1M: number;
24
- /** Provider cost: $ per 1M output tokens */
25
- outputPer1M: number;
26
- /**
27
- * Strategic per-model centicredit override for input. Bypasses the
28
- * default `inputPer1M × text-markup / CC_USD_RATE` formula. Use only
29
- * for explicit loss-leader / promo models — formula path is
30
- * cost-plus-margin by construction and self-heals when providers
31
- * change rates.
32
- *
33
- * Unit: **centicredits per 1M input tokens** (1 displayed credit =
34
- * 100 cc). Example: `overrideCreditInputPer1M: 1000` charges 10
35
- * displayed credits per 1M input tokens.
36
- */
37
- overrideCreditInputPer1M?: number;
38
- /** Same as `overrideCreditInputPer1M`, for output tokens. Unit: cc/1M. */
39
- overrideCreditOutputPer1M?: number;
40
- /**
41
- * Provider-side discount for cache-read tokens (Anthropic prompt
42
- * caching: ~10% of base input). Default 1.0 — no cache discount —
43
- * for providers without prompt caching. Applies to BOTH the
44
- * provider-cost calculation AND the derived credit cost so the
45
- * margin holds for cached vs uncached tokens.
46
- */
47
- cacheReadMultiplier?: number;
48
- /**
49
- * Provider-side premium for cache-creation tokens (Anthropic prompt
50
- * caching: ~125% of base input — slightly more than uncached, but
51
- * the savings come from subsequent reads). Default 1.0. Applies to
52
- * BOTH sides like `cacheReadMultiplier`.
53
- */
54
- cacheWriteMultiplier?: number;
55
- /**
56
- * Router / SDK used to call the model. Same model can be reachable via
57
- * multiple providers — `claude-sonnet-4-5` is `provider: "anthropic"`
58
- * when called through the Anthropic SDK and `provider: "openrouter"`
59
- * when routed through OpenRouter. Distinct from `vendor`: this is HOW
60
- * we reach the model, not WHO made it.
61
- * - bare ids (`claude-sonnet-4-5`, `gpt-4o`, `gemini-2.5-flash`)
62
- * → `"anthropic" | "openai" | "google"` (direct providers)
63
- * - slash ids (`anthropic/claude-sonnet-4-5`, `qwen/qwen3-coder`)
64
- * → `"openrouter"` (always — the slash is the OpenRouter route
65
- * convention and the OpenRouter SDK is what runs them)
66
- *
67
- * The runtime can still pass an explicit `connectorUsed` to
68
- * `emitUsageEvent` — that wins over this default and covers the
69
- * edge case where a guild has multiple connectors and the
70
- * dispatcher routed to a non-default one.
71
- */
72
- provider?: CatalogProvider;
73
- /**
74
- * Who authored / built the model. Permanent attribute, independent of
75
- * the router: `claude-sonnet-4-5` is always `vendor: "anthropic"`
76
- * regardless of whether `provider` is `"anthropic"` (direct) or
77
- * `"openrouter"` (proxied). Used for display labels, BYOK gating, and
78
- * analytics grouping. Examples: `anthropic`, `openai`, `google`,
79
- * `moonshot`, `mistralai`, `minimax`, `meta`, `qwen`, `deepseek`.
80
- */
81
- vendor?: string;
82
- }
83
-
84
- declare const LLM_PRICING_CATALOG: {
85
- "claude-opus-4-5": {
86
- inputPer1M: number;
87
- outputPer1M: number;
88
- cacheReadMultiplier: number;
89
- cacheWriteMultiplier: number;
90
- vendor: string;
91
- provider: "anthropic";
92
- };
93
- "claude-sonnet-4-5": {
94
- inputPer1M: number;
95
- outputPer1M: number;
96
- cacheReadMultiplier: number;
97
- cacheWriteMultiplier: number;
98
- vendor: string;
99
- provider: "anthropic";
100
- };
101
- "claude-haiku-4-5": {
102
- inputPer1M: number;
103
- outputPer1M: number;
104
- cacheReadMultiplier: number;
105
- cacheWriteMultiplier: number;
106
- vendor: string;
107
- provider: "anthropic";
108
- };
109
- "claude-opus-4-8": {
110
- inputPer1M: number;
111
- outputPer1M: number;
112
- cacheReadMultiplier: number;
113
- cacheWriteMultiplier: number;
114
- vendor: string;
115
- provider: "anthropic";
116
- };
117
- "claude-sonnet-5": {
118
- inputPer1M: number;
119
- outputPer1M: number;
120
- cacheReadMultiplier: number;
121
- cacheWriteMultiplier: number;
122
- vendor: string;
123
- provider: "anthropic";
124
- };
125
- "claude-fable-5": {
126
- inputPer1M: number;
127
- outputPer1M: number;
128
- cacheReadMultiplier: number;
129
- cacheWriteMultiplier: number;
130
- vendor: string;
131
- provider: "anthropic";
132
- };
133
- "gemini-2.5-flash": {
134
- inputPer1M: number;
135
- outputPer1M: number;
136
- cacheReadMultiplier: number;
137
- vendor: string;
138
- provider: "google";
139
- };
140
- "gemini-2.5-pro": {
141
- inputPer1M: number;
142
- outputPer1M: number;
143
- cacheReadMultiplier: number;
144
- vendor: string;
145
- provider: "google";
146
- };
147
- "gemini-3.5-flash": {
148
- inputPer1M: number;
149
- outputPer1M: number;
150
- cacheReadMultiplier: number;
151
- vendor: string;
152
- provider: "google";
153
- };
154
- "gemini-2.5-flash-lite": {
155
- inputPer1M: number;
156
- outputPer1M: number;
157
- cacheReadMultiplier: number;
158
- vendor: string;
159
- provider: "google";
160
- };
161
- "gemini-3.1-pro-preview": {
162
- inputPer1M: number;
163
- outputPer1M: number;
164
- cacheReadMultiplier: number;
165
- vendor: string;
166
- provider: "google";
167
- };
168
- "gemini-3-flash-preview": {
169
- inputPer1M: number;
170
- outputPer1M: number;
171
- cacheReadMultiplier: number;
172
- vendor: string;
173
- provider: "google";
174
- };
175
- "gemini-3.1-flash-lite": {
176
- inputPer1M: number;
177
- outputPer1M: number;
178
- cacheReadMultiplier: number;
179
- vendor: string;
180
- provider: "google";
181
- };
182
- "gpt-5.5": {
183
- inputPer1M: number;
184
- outputPer1M: number;
185
- cacheReadMultiplier: number;
186
- vendor: string;
187
- provider: "openai";
188
- };
189
- "gpt-5.5-pro": {
190
- inputPer1M: number;
191
- outputPer1M: number;
192
- vendor: string;
193
- provider: "openai";
194
- };
195
- "gpt-5.4": {
196
- inputPer1M: number;
197
- outputPer1M: number;
198
- cacheReadMultiplier: number;
199
- vendor: string;
200
- provider: "openai";
201
- };
202
- "gpt-5.4-mini": {
203
- inputPer1M: number;
204
- outputPer1M: number;
205
- cacheReadMultiplier: number;
206
- vendor: string;
207
- provider: "openai";
208
- };
209
- "gpt-5.4-nano": {
210
- inputPer1M: number;
211
- outputPer1M: number;
212
- cacheReadMultiplier: number;
213
- vendor: string;
214
- provider: "openai";
215
- };
216
- "gpt-5.4-pro": {
217
- inputPer1M: number;
218
- outputPer1M: number;
219
- vendor: string;
220
- provider: "openai";
221
- };
222
- "gpt-5.2": {
223
- inputPer1M: number;
224
- outputPer1M: number;
225
- cacheReadMultiplier: number;
226
- vendor: string;
227
- provider: "openai";
228
- };
229
- "gpt-5.1": {
230
- inputPer1M: number;
231
- outputPer1M: number;
232
- cacheReadMultiplier: number;
233
- vendor: string;
234
- provider: "openai";
235
- };
236
- "gpt-5": {
237
- inputPer1M: number;
238
- outputPer1M: number;
239
- cacheReadMultiplier: number;
240
- vendor: string;
241
- provider: "openai";
242
- };
243
- "gpt-4.1": {
244
- inputPer1M: number;
245
- outputPer1M: number;
246
- vendor: string;
247
- provider: "openai";
248
- };
249
- "gpt-4.1-mini": {
250
- inputPer1M: number;
251
- outputPer1M: number;
252
- vendor: string;
253
- provider: "openai";
254
- };
255
- "gpt-4.1-nano": {
256
- inputPer1M: number;
257
- outputPer1M: number;
258
- cacheReadMultiplier: number;
259
- vendor: string;
260
- provider: "openai";
261
- };
262
- "gpt-4o": {
263
- inputPer1M: number;
264
- outputPer1M: number;
265
- vendor: string;
266
- provider: "openai";
267
- };
268
- "gpt-4o-mini": {
269
- inputPer1M: number;
270
- outputPer1M: number;
271
- vendor: string;
272
- provider: "openai";
273
- };
274
- o3: {
275
- inputPer1M: number;
276
- outputPer1M: number;
277
- vendor: string;
278
- provider: "openai";
279
- };
280
- "o4-mini": {
281
- inputPer1M: number;
282
- outputPer1M: number;
283
- cacheReadMultiplier: number;
284
- vendor: string;
285
- provider: "openai";
286
- };
287
- "o3-mini": {
288
- inputPer1M: number;
289
- outputPer1M: number;
290
- vendor: string;
291
- provider: "openai";
292
- };
293
- o1: {
294
- inputPer1M: number;
295
- outputPer1M: number;
296
- cacheReadMultiplier: number;
297
- vendor: string;
298
- provider: "openai";
299
- };
300
- "o1-mini": {
301
- inputPer1M: number;
302
- outputPer1M: number;
303
- vendor: string;
304
- provider: "openai";
305
- };
306
- "gpt-5.6-luna": {
307
- inputPer1M: number;
308
- outputPer1M: number;
309
- cacheReadMultiplier: number;
310
- vendor: string;
311
- provider: "openai";
312
- };
313
- "gpt-5.6-luna-pro": {
314
- inputPer1M: number;
315
- outputPer1M: number;
316
- cacheReadMultiplier: number;
317
- vendor: string;
318
- provider: "openai";
319
- };
320
- "gpt-5.6-terra": {
321
- inputPer1M: number;
322
- outputPer1M: number;
323
- cacheReadMultiplier: number;
324
- vendor: string;
325
- provider: "openai";
326
- };
327
- "gpt-5.6-terra-pro": {
328
- inputPer1M: number;
329
- outputPer1M: number;
330
- cacheReadMultiplier: number;
331
- vendor: string;
332
- provider: "openai";
333
- };
334
- "gpt-5.6-sol": {
335
- inputPer1M: number;
336
- outputPer1M: number;
337
- cacheReadMultiplier: number;
338
- vendor: string;
339
- provider: "openai";
340
- };
341
- "gpt-5.6-sol-pro": {
342
- inputPer1M: number;
343
- outputPer1M: number;
344
- cacheReadMultiplier: number;
345
- vendor: string;
346
- provider: "openai";
347
- };
348
- "gpt-5-mini": {
349
- inputPer1M: number;
350
- outputPer1M: number;
351
- cacheReadMultiplier: number;
352
- vendor: string;
353
- provider: "openai";
354
- };
355
- "gpt-5-nano": {
356
- inputPer1M: number;
357
- outputPer1M: number;
358
- cacheReadMultiplier: number;
359
- vendor: string;
360
- provider: "openai";
361
- };
362
- "gpt-5-codex": {
363
- inputPer1M: number;
364
- outputPer1M: number;
365
- cacheReadMultiplier: number;
366
- vendor: string;
367
- provider: "openai";
368
- };
369
- "gpt-5-pro": {
370
- inputPer1M: number;
371
- outputPer1M: number;
372
- vendor: string;
373
- provider: "openai";
374
- };
375
- "gpt-5-image": {
376
- inputPer1M: number;
377
- outputPer1M: number;
378
- cacheReadMultiplier: number;
379
- vendor: string;
380
- provider: "openai";
381
- };
382
- "gpt-5-image-mini": {
383
- inputPer1M: number;
384
- outputPer1M: number;
385
- cacheReadMultiplier: number;
386
- vendor: string;
387
- provider: "openai";
388
- };
389
- "gpt-audio": {
390
- inputPer1M: number;
391
- outputPer1M: number;
392
- vendor: string;
393
- provider: "openai";
394
- };
395
- "gpt-audio-mini": {
396
- inputPer1M: number;
397
- outputPer1M: number;
398
- vendor: string;
399
- provider: "openai";
400
- };
401
- "o3-pro": {
402
- inputPer1M: number;
403
- outputPer1M: number;
404
- vendor: string;
405
- provider: "openai";
406
- };
407
- "o3-deep-research": {
408
- inputPer1M: number;
409
- outputPer1M: number;
410
- cacheReadMultiplier: number;
411
- vendor: string;
412
- provider: "openai";
413
- };
414
- "o4-mini-high": {
415
- inputPer1M: number;
416
- outputPer1M: number;
417
- cacheReadMultiplier: number;
418
- vendor: string;
419
- provider: "openai";
420
- };
421
- "o4-mini-deep-research": {
422
- inputPer1M: number;
423
- outputPer1M: number;
424
- cacheReadMultiplier: number;
425
- vendor: string;
426
- provider: "openai";
427
- };
428
- "o1-pro": {
429
- inputPer1M: number;
430
- outputPer1M: number;
431
- vendor: string;
432
- provider: "openai";
433
- };
434
- "gpt-5.1-codex": {
435
- inputPer1M: number;
436
- outputPer1M: number;
437
- cacheReadMultiplier: number;
438
- vendor: string;
439
- provider: "openai";
440
- };
441
- "gpt-5.1-codex-mini": {
442
- inputPer1M: number;
443
- outputPer1M: number;
444
- cacheReadMultiplier: number;
445
- vendor: string;
446
- provider: "openai";
447
- };
448
- "gpt-5.1-codex-max": {
449
- inputPer1M: number;
450
- outputPer1M: number;
451
- cacheReadMultiplier: number;
452
- vendor: string;
453
- provider: "openai";
454
- };
455
- "gpt-5.2-codex": {
456
- inputPer1M: number;
457
- outputPer1M: number;
458
- cacheReadMultiplier: number;
459
- vendor: string;
460
- provider: "openai";
461
- };
462
- "gpt-5.2-pro": {
463
- inputPer1M: number;
464
- outputPer1M: number;
465
- vendor: string;
466
- provider: "openai";
467
- };
468
- "MiniMax-M2": {
469
- inputPer1M: number;
470
- outputPer1M: number;
471
- cacheReadMultiplier: number;
472
- cacheWriteMultiplier: number;
473
- vendor: string;
474
- provider: "minimax";
475
- };
476
- "M2-her": {
477
- inputPer1M: number;
478
- outputPer1M: number;
479
- cacheReadMultiplier: number;
480
- cacheWriteMultiplier: number;
481
- vendor: string;
482
- provider: "minimax";
483
- };
484
- "MiniMax-M2.1": {
485
- inputPer1M: number;
486
- outputPer1M: number;
487
- cacheReadMultiplier: number;
488
- cacheWriteMultiplier: number;
489
- vendor: string;
490
- provider: "minimax";
491
- };
492
- "MiniMax-M2.5": {
493
- inputPer1M: number;
494
- outputPer1M: number;
495
- cacheReadMultiplier: number;
496
- cacheWriteMultiplier: number;
497
- vendor: string;
498
- provider: "minimax";
499
- };
500
- "MiniMax-M2.7": {
501
- inputPer1M: number;
502
- outputPer1M: number;
503
- vendor: string;
504
- provider: "minimax";
505
- };
506
- "kimi-k3": {
507
- inputPer1M: number;
508
- outputPer1M: number;
509
- cacheReadMultiplier: number;
510
- vendor: string;
511
- provider: "moonshot";
512
- };
513
- "kimi-k2.7-code": {
514
- inputPer1M: number;
515
- outputPer1M: number;
516
- cacheReadMultiplier: number;
517
- vendor: string;
518
- provider: "moonshot";
519
- };
520
- "kimi-k2.6": {
521
- inputPer1M: number;
522
- outputPer1M: number;
523
- cacheReadMultiplier: number;
524
- vendor: string;
525
- provider: "moonshot";
526
- };
527
- "kimi-k2.5": {
528
- inputPer1M: number;
529
- outputPer1M: number;
530
- cacheReadMultiplier: number;
531
- vendor: string;
532
- provider: "moonshot";
533
- };
534
- "kimi-k2-0905-preview": {
535
- inputPer1M: number;
536
- outputPer1M: number;
537
- cacheReadMultiplier: number;
538
- vendor: string;
539
- provider: "moonshot";
540
- };
541
- "kimi-k2-turbo-preview": {
542
- inputPer1M: number;
543
- outputPer1M: number;
544
- cacheReadMultiplier: number;
545
- vendor: string;
546
- provider: "moonshot";
547
- };
548
- "kimi-k2-thinking": {
549
- inputPer1M: number;
550
- outputPer1M: number;
551
- cacheReadMultiplier: number;
552
- vendor: string;
553
- provider: "moonshot";
554
- };
555
- "kimi-k2-thinking-turbo": {
556
- inputPer1M: number;
557
- outputPer1M: number;
558
- cacheReadMultiplier: number;
559
- vendor: string;
560
- provider: "moonshot";
561
- };
562
- "grok-4.5": {
563
- inputPer1M: number;
564
- outputPer1M: number;
565
- vendor: string;
566
- provider: "xai";
567
- };
568
- "grok-4.20": {
569
- inputPer1M: number;
570
- outputPer1M: number;
571
- vendor: string;
572
- provider: "xai";
573
- };
574
- "grok-4.20-reasoning": {
575
- inputPer1M: number;
576
- outputPer1M: number;
577
- vendor: string;
578
- provider: "xai";
579
- };
580
- "grok-4.20-multi-agent": {
581
- inputPer1M: number;
582
- outputPer1M: number;
583
- vendor: string;
584
- provider: "xai";
585
- };
586
- "grok-4.3": {
587
- inputPer1M: number;
588
- outputPer1M: number;
589
- vendor: string;
590
- provider: "xai";
591
- };
592
- "grok-build-0.1": {
593
- inputPer1M: number;
594
- outputPer1M: number;
595
- vendor: string;
596
- provider: "xai";
597
- };
598
- "mistral-large-latest": {
599
- inputPer1M: number;
600
- outputPer1M: number;
601
- vendor: string;
602
- provider: "mistral";
603
- };
604
- "mistral-small-latest": {
605
- inputPer1M: number;
606
- outputPer1M: number;
607
- cacheReadMultiplier: number;
608
- vendor: string;
609
- provider: "mistral";
610
- };
611
- "mistral-medium-latest": {
612
- inputPer1M: number;
613
- outputPer1M: number;
614
- vendor: string;
615
- provider: "mistral";
616
- };
617
- "mistral-medium-3-5": {
618
- inputPer1M: number;
619
- outputPer1M: number;
620
- vendor: string;
621
- provider: "mistral";
622
- };
623
- "codestral-latest": {
624
- inputPer1M: number;
625
- outputPer1M: number;
626
- vendor: string;
627
- provider: "mistral";
628
- };
629
- "ministral-8b-latest": {
630
- inputPer1M: number;
631
- outputPer1M: number;
632
- vendor: string;
633
- provider: "mistral";
634
- };
635
- "devstral-latest": {
636
- inputPer1M: number;
637
- outputPer1M: number;
638
- vendor: string;
639
- provider: "mistral";
640
- };
641
- "magistral-small-latest": {
642
- inputPer1M: number;
643
- outputPer1M: number;
644
- vendor: string;
645
- provider: "mistral";
646
- };
647
- "devstral-medium-latest": {
648
- inputPer1M: number;
649
- outputPer1M: number;
650
- vendor: string;
651
- provider: "mistral";
652
- };
653
- "kimi-k2": {
654
- readonly inputPer1M: 0.57;
655
- readonly outputPer1M: 2.3;
656
- readonly vendor: "moonshot";
657
- readonly provider: "moonshot";
658
- };
659
- "kimi-k2-0905": {
660
- readonly inputPer1M: 0.6;
661
- readonly outputPer1M: 2.5;
662
- readonly vendor: "moonshot";
663
- readonly provider: "moonshot";
664
- };
665
- "kimi-k2.7-code:batch": {
666
- readonly inputPer1M: 0.475;
667
- readonly outputPer1M: 2;
668
- readonly vendor: "moonshot";
669
- readonly provider: "moonshot";
670
- };
671
- "codestral-2508": {
672
- readonly inputPer1M: 0.3;
673
- readonly outputPer1M: 0.9;
674
- readonly vendor: "mistral";
675
- readonly provider: "mistral";
676
- };
677
- "ministral-14b-2512": {
678
- readonly inputPer1M: 0.2;
679
- readonly outputPer1M: 0.2;
680
- readonly vendor: "mistral";
681
- readonly provider: "mistral";
682
- };
683
- "ministral-3b-2512": {
684
- readonly inputPer1M: 0.1;
685
- readonly outputPer1M: 0.1;
686
- readonly vendor: "mistral";
687
- readonly provider: "mistral";
688
- };
689
- "ministral-8b-2512": {
690
- readonly inputPer1M: 0.15;
691
- readonly outputPer1M: 0.15;
692
- readonly vendor: "mistral";
693
- readonly provider: "mistral";
694
- };
695
- "mistral-large-2512": {
696
- readonly inputPer1M: 0.5;
697
- readonly outputPer1M: 1.5;
698
- readonly vendor: "mistral";
699
- readonly provider: "mistral";
700
- };
701
- "mistral-medium-3": {
702
- readonly inputPer1M: 0.4;
703
- readonly outputPer1M: 2;
704
- readonly vendor: "mistral";
705
- readonly provider: "mistral";
706
- };
707
- "mistral-medium-3.5": {
708
- readonly inputPer1M: 1.5;
709
- readonly outputPer1M: 7.5;
710
- readonly vendor: "mistral";
711
- readonly provider: "mistral";
712
- };
713
- "mistral-small-2603": {
714
- readonly inputPer1M: 0.15;
715
- readonly outputPer1M: 0.6;
716
- readonly vendor: "mistral";
717
- readonly provider: "mistral";
718
- };
719
- };
720
- /**
721
- * Every canonical catalog model id — derived straight from the pricing
722
- * map keys (`satisfies` above preserves the literal keys). Downstream
723
- * curation/config should constrain their ids to this so a typo or a
724
- * removed model is a build error, not a broken row at runtime.
725
- */
726
- type LlmModelId = keyof typeof LLM_PRICING_CATALOG;
727
- declare const MODEL_ALIASES: {
728
- "claude-opus-4-6": string;
729
- "claude-sonnet-4-6": string;
730
- "claude-4-opus": string;
731
- "claude-4-sonnet": string;
732
- "claude-3-5-haiku": string;
733
- "claude-haiku-4-5-20251001": string;
734
- "claude-opus-4": string;
735
- "claude-sonnet-4": string;
736
- "claude-haiku-3.5": string;
737
- "gemini-3.1-flash-lite-preview": string;
738
- "google/gemini-3.1-pro-preview": string;
739
- "google/gemini-3.5-flash": string;
740
- "google/gemini-3-flash-preview": string;
741
- "google/gemini-3.1-flash-lite": string;
742
- "google/gemini-2.5-flash": string;
743
- "google/gemini-2.5-flash-lite": string;
744
- "google/gemini-2.5-pro": string;
745
- "openai/gpt-4.1": string;
746
- "openai/gpt-4.1-mini": string;
747
- "openai/gpt-4.1-nano": string;
748
- "openai/gpt-5": string;
749
- "openai/gpt-5.1": string;
750
- "openai/gpt-5.2": string;
751
- "openai/gpt-5.4": string;
752
- "openai/gpt-5.4-mini": string;
753
- "openai/gpt-5.4-nano": string;
754
- "openai/gpt-5.5": string;
755
- "openai/o3": string;
756
- "openai/o4-mini": string;
757
- "openai/o3-mini": string;
758
- "openai/o1": string;
759
- "openai/o1-mini": string;
760
- "minimax-m2": string;
761
- "minimax-m2.1": string;
762
- "minimax-m2.5": string;
763
- "minimax-m2.7": string;
764
- "kimi-k2": string;
765
- "moonshotai/kimi-k2.5": string;
766
- "moonshotai/kimi-k2.6": string;
767
- "moonshotai/kimi-k2.7-code": string;
768
- "moonshotai/kimi-k3": string;
769
- "mistralai/mistral-large-latest": string;
770
- "mistralai/mistral-small-latest": string;
771
- "mistralai/mistral-medium-latest": string;
772
- "mistralai/mistral-medium-3-5": string;
773
- "mistralai/codestral-latest": string;
774
- "mistralai/ministral-8b-latest": string;
775
- "mistralai/devstral-latest": string;
776
- "mistralai/magistral-small-latest": string;
777
- "mistralai/devstral-medium-latest": string;
778
- "grok-latest": string;
779
- };
780
- /** Every alias id that resolves to a canonical model — the alias keys. */
781
- type LlmModelAlias = keyof typeof MODEL_ALIASES;
782
- /** Any model id the catalog recognises — canonical key or alias. */
783
- type KnownLlmId = LlmModelId | LlmModelAlias;
784
- /**
785
- * Resolves a model id to its pricing entry. Tries direct match → alias →
786
- * partial-prefix match. Used both for cost computation and BYOK shadow
787
- * accounting; semantics are load-bearing for migration.
788
- */
789
- declare function resolvePricing(modelId: string): LLMPricing | undefined;
790
- /**
791
- * Like {@link resolvePricing} but WITHOUT the substring/partial-prefix
792
- * fallback — an id resolves ONLY on an exact catalog key or an exact alias.
793
- * The substring scan in `resolvePricing` (intended for dated snapshots like
794
- * `claude-sonnet-4-6-20260301` → `claude-sonnet-4`) also over-fires for
795
- * unrelated cross-product siblings (`gemini-2.5-flash-image` substring-hits
796
- * the `gemini-2.5-flash` row), so any caller that must PROVE a verbatim
797
- * first-party identity — e.g. the direct-vendor route restore in
798
- * `serviceableModelRoutes` — needs this exact form instead. Semantics of
799
- * `resolvePricing`/`resolveAlias` are intentionally left unchanged for their
800
- * existing callers.
801
- */
802
- declare function resolvePricingExact(modelId: string): LLMPricing | undefined;
803
- /**
804
- * Resolves a model id to its canonical catalog key (or the original id if no
805
- * match). Public surface for consumers that need the canonical id without
806
- * the pricing payload.
807
- */
808
- declare function resolveAlias(modelId: string): string;
809
- /**
810
- * Resolves a model id to its live context window (max input tokens) and max
811
- * output tokens, sourced from `CONTEXT_WINDOWS`
812
- * (`packages/catalog-sync/src/generators/llm-context-windows.ts` — re-synced
813
- * from each provider's live `/v1/models` endpoint; never hand-maintain these
814
- * numbers). Covers Anthropic, Groq, xAI, and Moonshot — the providers that
815
- * publish this data live. Handles bare aliases the provider's own API doesn't
816
- * use ("claude-haiku-4-5" vs. the dated live id "claude-haiku-4-5-20251001")
817
- * via prefix match, then falls back through the pricing alias table for
818
- * older aliases. Returns undefined for ids no synced provider carries.
819
- */
820
- declare function resolveContextWindow(modelId: string): ContextWindowEntry | undefined;
821
- /**
822
- * Resolve a model id to its DEFAULT provider — the single source of truth for
823
- * "which SDK reaches this model when no per-model override is set". Reads the
824
- * resolved catalog entry's `provider` field (direct id → alias → partial
825
- * prefix, same resolution as `resolvePricing`). Returns undefined for unknown
826
- * ids so callers can fall back to their own heuristic.
827
- *
828
- * This is the abstraction that decouples the provider from the model-id STRING:
829
- * instead of inferring "claude-* → anthropic" at each call site, the provider
830
- * is an explicit catalog attribute. A model reachable through more than one
831
- * provider (e.g. Claude via the direct Anthropic SDK vs. OpenRouter) is held as
832
- * distinct catalog entries — the bare id (`claude-haiku-4-5`, provider
833
- * `anthropic`) and the slash route (`anthropic/claude-haiku-4.5`, provider
834
- * `openrouter`) — each carrying its own `provider`.
835
- */
836
- declare function getModelProvider(modelId: string): CatalogProvider | undefined;
837
- /**
838
- * The unified registry view of a model: canonical id, default provider, vendor,
839
- * and pricing — everything the routing + billing layers need from ONE lookup.
840
- * Returns undefined for unknown ids.
841
- */
842
- interface ModelRoute {
843
- /** Canonical catalog key (post-alias). */
844
- canonicalId: string;
845
- /** Default provider — the SDK used when no per-model override is set. */
846
- provider?: CatalogProvider;
847
- /** Model author/vendor (permanent; independent of the routing provider). */
848
- vendor?: string;
849
- /** Billing pricing entry. */
850
- pricing: LLMPricing;
851
- }
852
- declare function resolveModelRoute(modelId: string): ModelRoute | undefined;
853
- /**
854
- * Default fallback: roughly gemini-flash pricing (cheapest). Unknown
855
- * model ids resolve to this — the formula path then computes credit
856
- * cost from `inputPer1M`/`outputPer1M`, so unknown models always price
857
- * at default markup × cheap-model rates, never at zero.
858
- */
859
- declare const DEFAULT_PRICING: LLMPricing;
860
- interface LLMCreditCostResult {
861
- /**
862
- * Total **centicredits** to charge — what `useAccountCredits` debits
863
- * directly (ledger column is cc). Reflects any per-model override or
864
- * per-app markup; never below `MIN_CREDITS_PER_TURN_CC`.
865
- *
866
- * Unit: cc (1 displayed credit = 100 cc). Format for display with
867
- * `displayCredits(cc) → cr`.
868
- */
869
- credits: number;
870
- /**
871
- * What the *pure formula* would have charged (provider cost ×
872
- * text-markup), independent of per-model overrides. Surfaced so
873
- * `usage_events.calculated_credits` can record the formula-derived
874
- * value next to the override-applied debit — easy reconciliation
875
- * against Langfuse traces. Unit: cc.
876
- */
877
- calculatedCredits: number;
878
- /** Breakdown of `credits` (each in cc). */
879
- inputCredits: number;
880
- outputCredits: number;
881
- cacheReadCredits: number;
882
- cacheWriteCredits: number;
883
- /** Production cost in USD (true provider cost, with cache multipliers applied). */
884
- productionCost: number;
885
- /** Model pricing used */
886
- pricing: LLMPricing;
887
- /** Whether fallback pricing was used */
888
- isFallback: boolean;
889
- /** Markup actually applied. Same as `pricingRegistry.getMarkup("text", appId)` when no override. */
890
- markup: number;
891
- /** True when a per-model `overrideCredit*Per1M` field bypassed the formula. */
892
- hasOverride: boolean;
893
- }
894
- interface LLMUsageBreakdown {
895
- /**
896
- * Input tokens that were NOT served from cache. With Anthropic prompt
897
- * caching, providers often report `inputTokens` already EXCLUDING
898
- * cached portions — pass the same number you'd pass to the legacy
899
- * 3-arg signature; cache fields are ADDED on top.
900
- */
901
- inputTokens: number;
902
- outputTokens: number;
903
- cacheReadInputTokens?: number;
904
- cacheCreationInputTokens?: number;
905
- }
906
- interface CalculateLLMCreditCostOptions {
907
- /**
908
- * App invoking the LLM. Routes per-app markup overrides registered
909
- * via `pricingRegistry.registerApp(appId, ...)`. When omitted, core
910
- * defaults apply.
911
- */
912
- appId?: string;
913
- /**
914
- * Direct markup override (escape hatch for tests / one-off
915
- * reconciliation). When set, bypasses `pricingRegistry` for both
916
- * formula and `calculatedCredits` math. Takes precedence over
917
- * `appId`.
918
- */
919
- markupOverride?: number;
920
- }
921
- declare function calculateLLMCreditCost(modelId: string, inputTokens: number, outputTokens: number): LLMCreditCostResult;
922
- declare function calculateLLMCreditCost(modelId: string, usage: LLMUsageBreakdown, opts?: CalculateLLMCreditCostOptions): LLMCreditCostResult;
923
- interface CacheStats {
924
- /**
925
- * Cache hit rate as a 0..1 fraction of total input tokens (raw + cache
926
- * read + cache create). 0 means no cache activity, 1 means everything
927
- * read from cache, 0 for output-only calls. `null` when there were no
928
- * input tokens at all.
929
- */
930
- cacheHitRate: number | null;
931
- /**
932
- * Provider USD we *saved* vs the same input billed at the uncached
933
- * rate. Cache reads at 0.1× save 0.9× of the input cost; cache writes
934
- * at 1.25× actually COST 0.25× more than uncached (negative savings).
935
- * Sum across both. Negative means cache-write overhead exceeded
936
- * cache-read savings (rare — usually means the prompt prefix was
937
- * cached on the first turn but never re-used).
938
- */
939
- providerCostSavedUsd: number;
940
- /**
941
- * Centicredits the user *saved* vs the same input billed at the
942
- * uncached rate. Same sign convention as `providerCostSavedUsd`.
943
- * Unit: cc (format with `displayCredits(cc)` for UI).
944
- */
945
- creditsSaved: number;
946
- /**
947
- * True iff the model carries cache multipliers in its pricing.
948
- * Useful for explaining "this model doesn't support caching" in UI.
949
- */
950
- cacheSupported: boolean;
951
- }
952
- /**
953
- * Turn a credit-cost result into cache-utilisation stats. Pure compute.
954
- *
955
- * Use cases:
956
- * - "Cache saved 87% on this call" in a UI tooltip.
957
- * - Per-conversation dashboards: "across this conversation, prompt
958
- * caching saved you $0.42 / 12 credits."
959
- * - Regression alarms — if cacheHitRate drops below an expected
960
- * threshold on a known-cacheable workload, something broke in
961
- * prompt-prefix stability.
962
- *
963
- * Returns `cacheSupported: false` for models without cache multipliers
964
- * (gpt-4o-mini, gemini, mistral) — all fields are zero in that case
965
- * (no cache activity is possible).
966
- */
967
- declare function getCacheStats(modelId: string, usage: LLMUsageBreakdown, opts?: CalculateLLMCreditCostOptions): CacheStats;
968
-
969
- export { type CacheStats as C, DEFAULT_PRICING as D, type KnownLlmId as K, type LLMCreditCostResult as L, MODEL_ALIASES as M, type CalculateLLMCreditCostOptions as a, type ContextWindowEntry as b, type LLMPricing as c, type LLMUsageBreakdown as d, LLM_PRICING_CATALOG as e, type LlmModelAlias as f, type LlmModelId as g, type ModelRoute as h, calculateLLMCreditCost as i, getCacheStats as j, getModelProvider as k, resolveContextWindow as l, resolveModelRoute as m, resolvePricing as n, resolvePricingExact as o, resolveAlias as r };