@pydantic/genai-prices 0.0.52 → 0.0.53
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/dist/cli.js +382 -101
- package/dist/index.cjs +3 -3
- package/dist/index.js +368 -87
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -338,6 +338,66 @@ const I = [
|
|
|
338
338
|
output_mtok: 25
|
|
339
339
|
}
|
|
340
340
|
},
|
|
341
|
+
{
|
|
342
|
+
id: "claude-opus-4-6",
|
|
343
|
+
name: "Claude Opus 4.6",
|
|
344
|
+
description: "Most intelligent model with adaptive thinking and 1M context beta",
|
|
345
|
+
match: {
|
|
346
|
+
or: [
|
|
347
|
+
{
|
|
348
|
+
starts_with: "claude-opus-4-6"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
starts_with: "claude-opus-4.6"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
starts_with: "claude-4-6-opus"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
starts_with: "claude-4.6-opus"
|
|
358
|
+
}
|
|
359
|
+
]
|
|
360
|
+
},
|
|
361
|
+
context_window: 2e5,
|
|
362
|
+
prices: {
|
|
363
|
+
input_mtok: {
|
|
364
|
+
base: 5,
|
|
365
|
+
tiers: [
|
|
366
|
+
{
|
|
367
|
+
start: 2e5,
|
|
368
|
+
price: 10
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
cache_write_mtok: {
|
|
373
|
+
base: 6.25,
|
|
374
|
+
tiers: [
|
|
375
|
+
{
|
|
376
|
+
start: 2e5,
|
|
377
|
+
price: 12.5
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
cache_read_mtok: {
|
|
382
|
+
base: 0.5,
|
|
383
|
+
tiers: [
|
|
384
|
+
{
|
|
385
|
+
start: 2e5,
|
|
386
|
+
price: 1
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
output_mtok: {
|
|
391
|
+
base: 25,
|
|
392
|
+
tiers: [
|
|
393
|
+
{
|
|
394
|
+
start: 2e5,
|
|
395
|
+
price: 37.5
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
},
|
|
341
401
|
{
|
|
342
402
|
id: "claude-sonnet-4-0",
|
|
343
403
|
name: "Claude Sonnet 4",
|
|
@@ -2172,6 +2232,20 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2172
2232
|
output_mtok: 0.9
|
|
2173
2233
|
}
|
|
2174
2234
|
},
|
|
2235
|
+
{
|
|
2236
|
+
id: "deepseek-v3p2",
|
|
2237
|
+
name: "Deepseek V3.2",
|
|
2238
|
+
description: "Model from Deepseek that harmonizes high computational efficiency with superior reasoning and agent performance. 675B parameter MoE model.",
|
|
2239
|
+
match: {
|
|
2240
|
+
equals: "accounts/fireworks/models/deepseek-v3p2"
|
|
2241
|
+
},
|
|
2242
|
+
context_window: 163840,
|
|
2243
|
+
prices: {
|
|
2244
|
+
input_mtok: 0.56,
|
|
2245
|
+
cache_read_mtok: 0.28,
|
|
2246
|
+
output_mtok: 1.68
|
|
2247
|
+
}
|
|
2248
|
+
},
|
|
2175
2249
|
{
|
|
2176
2250
|
id: "gemma-3-27b-it",
|
|
2177
2251
|
name: "Gemma 3 27B Instruct",
|
|
@@ -2185,6 +2259,61 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2185
2259
|
output_mtok: 0.1
|
|
2186
2260
|
}
|
|
2187
2261
|
},
|
|
2262
|
+
{
|
|
2263
|
+
id: "glm-4p7",
|
|
2264
|
+
name: "GLM-4.7",
|
|
2265
|
+
description: "Next-generation general-purpose model from Z.ai optimized for coding, reasoning, and agentic workflows. 352B parameter MoE model with advanced thinking controls.",
|
|
2266
|
+
match: {
|
|
2267
|
+
equals: "accounts/fireworks/models/glm-4p7"
|
|
2268
|
+
},
|
|
2269
|
+
context_window: 202752,
|
|
2270
|
+
prices: {
|
|
2271
|
+
input_mtok: 0.6,
|
|
2272
|
+
output_mtok: 2.2
|
|
2273
|
+
}
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
id: "gpt-oss-120b",
|
|
2277
|
+
name: "OpenAI gpt-oss-120b",
|
|
2278
|
+
description: "OpenAI's open-weight 117B parameter MoE model designed for production, general purpose, high reasoning use-cases. Features powerful reasoning, agentic tasks, and versatile developer use cases.",
|
|
2279
|
+
match: {
|
|
2280
|
+
equals: "accounts/fireworks/models/gpt-oss-120b"
|
|
2281
|
+
},
|
|
2282
|
+
context_window: 131072,
|
|
2283
|
+
prices: {
|
|
2284
|
+
input_mtok: 0.15,
|
|
2285
|
+
cache_read_mtok: 0.07,
|
|
2286
|
+
output_mtok: 0.6
|
|
2287
|
+
}
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
id: "gpt-oss-20b",
|
|
2291
|
+
name: "OpenAI gpt-oss-20b",
|
|
2292
|
+
description: "OpenAI's open-weight 21.5B parameter model designed for powerful reasoning, agentic tasks, and versatile developer use cases. Optimized for lower latency and local or specialized tasks.",
|
|
2293
|
+
match: {
|
|
2294
|
+
equals: "accounts/fireworks/models/gpt-oss-20b"
|
|
2295
|
+
},
|
|
2296
|
+
context_window: 131072,
|
|
2297
|
+
prices: {
|
|
2298
|
+
input_mtok: 0.07,
|
|
2299
|
+
cache_read_mtok: 0.04,
|
|
2300
|
+
output_mtok: 0.3
|
|
2301
|
+
}
|
|
2302
|
+
},
|
|
2303
|
+
{
|
|
2304
|
+
id: "kimi-k2p5",
|
|
2305
|
+
name: "Kimi K2.5",
|
|
2306
|
+
description: "Moonshot AI's flagship agentic model. Unifies vision and text, thinking and non-thinking modes, and single-agent and multi-agent execution into one model. 1T parameter MoE model.",
|
|
2307
|
+
match: {
|
|
2308
|
+
equals: "accounts/fireworks/models/kimi-k2p5"
|
|
2309
|
+
},
|
|
2310
|
+
context_window: 262144,
|
|
2311
|
+
prices: {
|
|
2312
|
+
input_mtok: 0.6,
|
|
2313
|
+
cache_read_mtok: 0.1,
|
|
2314
|
+
output_mtok: 3
|
|
2315
|
+
}
|
|
2316
|
+
},
|
|
2188
2317
|
{
|
|
2189
2318
|
id: "llama-v3p1-8b-instruct",
|
|
2190
2319
|
name: "Llama 3.1 8B Instruct",
|
|
@@ -2212,6 +2341,19 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2212
2341
|
output_mtok: 0.88
|
|
2213
2342
|
}
|
|
2214
2343
|
},
|
|
2344
|
+
{
|
|
2345
|
+
id: "minimax-m2p1",
|
|
2346
|
+
name: "MiniMax-M2.1",
|
|
2347
|
+
description: "Built for strong real-world performance across complex, multi-language, and agent-driven workflows. 228B parameter model with robust support for systems, backend, web, mobile, and office-style tasks.",
|
|
2348
|
+
match: {
|
|
2349
|
+
equals: "accounts/fireworks/models/minimax-m2p1"
|
|
2350
|
+
},
|
|
2351
|
+
context_window: 204800,
|
|
2352
|
+
prices: {
|
|
2353
|
+
input_mtok: 0.3,
|
|
2354
|
+
output_mtok: 1.2
|
|
2355
|
+
}
|
|
2356
|
+
},
|
|
2215
2357
|
{
|
|
2216
2358
|
id: "qwen2p5-vl-72b-instruct",
|
|
2217
2359
|
name: "Qwen2.5-VL 72B Instruct",
|
|
@@ -2484,7 +2626,16 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2484
2626
|
contains: "claude-4-opus"
|
|
2485
2627
|
},
|
|
2486
2628
|
{
|
|
2487
|
-
contains: "claude-opus-4"
|
|
2629
|
+
contains: "claude-opus-4@"
|
|
2630
|
+
},
|
|
2631
|
+
{
|
|
2632
|
+
contains: "claude-opus-4-0"
|
|
2633
|
+
},
|
|
2634
|
+
{
|
|
2635
|
+
contains: "claude-opus-4-1"
|
|
2636
|
+
},
|
|
2637
|
+
{
|
|
2638
|
+
equals: "claude-opus-4"
|
|
2488
2639
|
}
|
|
2489
2640
|
]
|
|
2490
2641
|
},
|
|
@@ -2516,6 +2667,64 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2516
2667
|
output_mtok: 15
|
|
2517
2668
|
}
|
|
2518
2669
|
},
|
|
2670
|
+
{
|
|
2671
|
+
id: "claude-opus-4-6",
|
|
2672
|
+
match: {
|
|
2673
|
+
or: [
|
|
2674
|
+
{
|
|
2675
|
+
contains: "claude-4-6-opus"
|
|
2676
|
+
},
|
|
2677
|
+
{
|
|
2678
|
+
contains: "claude-opus-4-6"
|
|
2679
|
+
},
|
|
2680
|
+
{
|
|
2681
|
+
contains: "claude-4.6-opus"
|
|
2682
|
+
},
|
|
2683
|
+
{
|
|
2684
|
+
contains: "claude-opus-4.6"
|
|
2685
|
+
}
|
|
2686
|
+
]
|
|
2687
|
+
},
|
|
2688
|
+
context_window: 2e5,
|
|
2689
|
+
prices: {
|
|
2690
|
+
input_mtok: {
|
|
2691
|
+
base: 5,
|
|
2692
|
+
tiers: [
|
|
2693
|
+
{
|
|
2694
|
+
start: 2e5,
|
|
2695
|
+
price: 10
|
|
2696
|
+
}
|
|
2697
|
+
]
|
|
2698
|
+
},
|
|
2699
|
+
cache_write_mtok: {
|
|
2700
|
+
base: 6.25,
|
|
2701
|
+
tiers: [
|
|
2702
|
+
{
|
|
2703
|
+
start: 2e5,
|
|
2704
|
+
price: 12.5
|
|
2705
|
+
}
|
|
2706
|
+
]
|
|
2707
|
+
},
|
|
2708
|
+
cache_read_mtok: {
|
|
2709
|
+
base: 0.5,
|
|
2710
|
+
tiers: [
|
|
2711
|
+
{
|
|
2712
|
+
start: 2e5,
|
|
2713
|
+
price: 1
|
|
2714
|
+
}
|
|
2715
|
+
]
|
|
2716
|
+
},
|
|
2717
|
+
output_mtok: {
|
|
2718
|
+
base: 25,
|
|
2719
|
+
tiers: [
|
|
2720
|
+
{
|
|
2721
|
+
start: 2e5,
|
|
2722
|
+
price: 37.5
|
|
2723
|
+
}
|
|
2724
|
+
]
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
},
|
|
2519
2728
|
{
|
|
2520
2729
|
id: "gemini-1.0-pro-vision-001",
|
|
2521
2730
|
name: "gemini 1.0 pro vision",
|
|
@@ -8989,6 +9198,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
8989
9198
|
{
|
|
8990
9199
|
equals: "gpt-5.1-codex"
|
|
8991
9200
|
},
|
|
9201
|
+
{
|
|
9202
|
+
equals: "gpt-5.1-codex-max"
|
|
9203
|
+
},
|
|
9204
|
+
{
|
|
9205
|
+
equals: "gpt-5.1-chat"
|
|
9206
|
+
},
|
|
8992
9207
|
{
|
|
8993
9208
|
equals: "gpt-5.1-chat-latest"
|
|
8994
9209
|
},
|
|
@@ -9001,6 +9216,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9001
9216
|
{
|
|
9002
9217
|
equals: "gpt-5-1-codex"
|
|
9003
9218
|
},
|
|
9219
|
+
{
|
|
9220
|
+
equals: "gpt-5-1-codex-max"
|
|
9221
|
+
},
|
|
9222
|
+
{
|
|
9223
|
+
equals: "gpt-5-1-chat"
|
|
9224
|
+
},
|
|
9004
9225
|
{
|
|
9005
9226
|
equals: "gpt-5-1-chat-latest"
|
|
9006
9227
|
}
|
|
@@ -9057,6 +9278,15 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9057
9278
|
{
|
|
9058
9279
|
equals: "gpt-5-2-2025-12-11"
|
|
9059
9280
|
},
|
|
9281
|
+
{
|
|
9282
|
+
equals: "gpt-5.2-chat"
|
|
9283
|
+
},
|
|
9284
|
+
{
|
|
9285
|
+
equals: "gpt-5.2-chat-latest"
|
|
9286
|
+
},
|
|
9287
|
+
{
|
|
9288
|
+
equals: "gpt-5-2-chat"
|
|
9289
|
+
},
|
|
9060
9290
|
{
|
|
9061
9291
|
equals: "gpt-5-2-chat-latest"
|
|
9062
9292
|
},
|
|
@@ -9840,6 +10070,57 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9840
10070
|
output_mtok: 25
|
|
9841
10071
|
}
|
|
9842
10072
|
},
|
|
10073
|
+
{
|
|
10074
|
+
id: "anthropic/claude-opus-4.6",
|
|
10075
|
+
match: {
|
|
10076
|
+
or: [
|
|
10077
|
+
{
|
|
10078
|
+
equals: "anthropic/claude-opus-4.6"
|
|
10079
|
+
},
|
|
10080
|
+
{
|
|
10081
|
+
equals: "anthropic/claude-opus-4.6:beta"
|
|
10082
|
+
}
|
|
10083
|
+
]
|
|
10084
|
+
},
|
|
10085
|
+
prices: {
|
|
10086
|
+
input_mtok: {
|
|
10087
|
+
base: 5,
|
|
10088
|
+
tiers: [
|
|
10089
|
+
{
|
|
10090
|
+
start: 2e5,
|
|
10091
|
+
price: 10
|
|
10092
|
+
}
|
|
10093
|
+
]
|
|
10094
|
+
},
|
|
10095
|
+
cache_write_mtok: {
|
|
10096
|
+
base: 6.25,
|
|
10097
|
+
tiers: [
|
|
10098
|
+
{
|
|
10099
|
+
start: 2e5,
|
|
10100
|
+
price: 12.5
|
|
10101
|
+
}
|
|
10102
|
+
]
|
|
10103
|
+
},
|
|
10104
|
+
cache_read_mtok: {
|
|
10105
|
+
base: 0.5,
|
|
10106
|
+
tiers: [
|
|
10107
|
+
{
|
|
10108
|
+
start: 2e5,
|
|
10109
|
+
price: 1
|
|
10110
|
+
}
|
|
10111
|
+
]
|
|
10112
|
+
},
|
|
10113
|
+
output_mtok: {
|
|
10114
|
+
base: 25,
|
|
10115
|
+
tiers: [
|
|
10116
|
+
{
|
|
10117
|
+
start: 2e5,
|
|
10118
|
+
price: 37.5
|
|
10119
|
+
}
|
|
10120
|
+
]
|
|
10121
|
+
}
|
|
10122
|
+
}
|
|
10123
|
+
},
|
|
9843
10124
|
{
|
|
9844
10125
|
id: "anthropic/claude-sonnet-4.5",
|
|
9845
10126
|
match: {
|
|
@@ -14981,10 +15262,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
14981
15262
|
prices: {}
|
|
14982
15263
|
},
|
|
14983
15264
|
{
|
|
14984
|
-
id: "qwen/qwen3-max
|
|
14985
|
-
name: "Qwen 3 Max
|
|
15265
|
+
id: "qwen/qwen3-max",
|
|
15266
|
+
name: "Qwen 3 Max",
|
|
14986
15267
|
match: {
|
|
14987
|
-
equals: "qwen/qwen3-max
|
|
15268
|
+
equals: "qwen/qwen3-max"
|
|
14988
15269
|
},
|
|
14989
15270
|
prices: {
|
|
14990
15271
|
input_mtok: 1.2,
|
|
@@ -17350,52 +17631,52 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
17350
17631
|
]
|
|
17351
17632
|
}
|
|
17352
17633
|
];
|
|
17353
|
-
function L(
|
|
17354
|
-
if (
|
|
17355
|
-
let a =
|
|
17356
|
-
for (const o of
|
|
17634
|
+
function L(e, t, i) {
|
|
17635
|
+
if (t <= 0) return 0;
|
|
17636
|
+
let a = e.base;
|
|
17637
|
+
for (const o of e.tiers)
|
|
17357
17638
|
i > o.start && (a = o.price);
|
|
17358
|
-
return a *
|
|
17639
|
+
return a * t / 1e6;
|
|
17359
17640
|
}
|
|
17360
|
-
function l(
|
|
17361
|
-
return
|
|
17641
|
+
function l(e, t, i, a) {
|
|
17642
|
+
return e === void 0 || t === void 0 ? 0 : typeof e == "number" ? e * t / 1e6 : L(e, t, a);
|
|
17362
17643
|
}
|
|
17363
|
-
function Q(
|
|
17644
|
+
function Q(e, t) {
|
|
17364
17645
|
let i = 0, a = 0;
|
|
17365
|
-
const o =
|
|
17366
|
-
let u =
|
|
17646
|
+
const o = e.input_tokens ?? 0, s = e.cache_read_tokens ?? 0, m = e.cache_write_tokens ?? 0, n = e.cache_audio_read_tokens ?? 0, r = e.output_audio_tokens ?? 0;
|
|
17647
|
+
let u = e.input_audio_tokens ?? 0;
|
|
17367
17648
|
if (u -= n, u < 0)
|
|
17368
17649
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
17369
|
-
let p =
|
|
17650
|
+
let p = e.input_tokens ?? 0;
|
|
17370
17651
|
if (p -= s, p -= m, p -= u, p < 0)
|
|
17371
17652
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
17372
17653
|
let c = s;
|
|
17373
17654
|
if (c -= n, c < 0)
|
|
17374
17655
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
17375
|
-
i += l(
|
|
17376
|
-
let _ =
|
|
17656
|
+
i += l(t.input_mtok, p, "input_mtok", o), i += l(t.cache_read_mtok, c, "cache_read_mtok", o), i += l(t.cache_write_mtok, m, "cache_write_mtok", o), i += l(t.input_audio_mtok, u, "input_audio_mtok", o), i += l(t.cache_audio_read_mtok, n, "cache_audio_read_mtok", o);
|
|
17657
|
+
let _ = e.output_tokens ?? 0;
|
|
17377
17658
|
if (_ -= r, _ < 0)
|
|
17378
17659
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
17379
|
-
a += l(
|
|
17660
|
+
a += l(t.output_mtok, _, "output_mtok", o), a += l(t.output_audio_mtok, e.output_audio_tokens, "output_audio_mtok", o);
|
|
17380
17661
|
let x = i + a;
|
|
17381
|
-
return
|
|
17662
|
+
return t.requests_kcount !== void 0 && (x += t.requests_kcount / 1e3), {
|
|
17382
17663
|
input_price: i,
|
|
17383
17664
|
output_price: a,
|
|
17384
17665
|
total_price: x
|
|
17385
17666
|
};
|
|
17386
17667
|
}
|
|
17387
|
-
function T(
|
|
17388
|
-
if (!Array.isArray(
|
|
17389
|
-
return
|
|
17390
|
-
for (let i =
|
|
17391
|
-
const a =
|
|
17668
|
+
function T(e, t) {
|
|
17669
|
+
if (!Array.isArray(e.prices))
|
|
17670
|
+
return e.prices;
|
|
17671
|
+
for (let i = e.prices.length - 1; i >= 0; i--) {
|
|
17672
|
+
const a = e.prices[i], o = a.constraint;
|
|
17392
17673
|
if (o === void 0)
|
|
17393
17674
|
return a.prices;
|
|
17394
17675
|
if (o.type === "start_date") {
|
|
17395
|
-
if (
|
|
17676
|
+
if (t >= new Date(o.start_date))
|
|
17396
17677
|
return a.prices;
|
|
17397
17678
|
} else {
|
|
17398
|
-
const s =
|
|
17679
|
+
const s = t.toISOString().slice(11, 19), m = o.start_time, n = o.end_time;
|
|
17399
17680
|
if (n < m) {
|
|
17400
17681
|
if (s >= m || s < n)
|
|
17401
17682
|
return a.prices;
|
|
@@ -17403,64 +17684,64 @@ function T(t, e) {
|
|
|
17403
17684
|
return a.prices;
|
|
17404
17685
|
}
|
|
17405
17686
|
}
|
|
17406
|
-
return
|
|
17687
|
+
return e.prices[0].prices;
|
|
17407
17688
|
}
|
|
17408
|
-
function g(
|
|
17409
|
-
return "or" in
|
|
17689
|
+
function g(e, t) {
|
|
17690
|
+
return "or" in e ? e.or.some((i) => g(i, t)) : "and" in e ? e.and.every((i) => g(i, t)) : "equals" in e ? t === e.equals : "starts_with" in e ? t.startsWith(e.starts_with) : "ends_with" in e ? t.endsWith(e.ends_with) : "contains" in e ? t.includes(e.contains) : "regex" in e ? new RegExp(e.regex).test(t) : !1;
|
|
17410
17691
|
}
|
|
17411
|
-
function P(
|
|
17412
|
-
const i =
|
|
17413
|
-
return a ||
|
|
17692
|
+
function P(e, t) {
|
|
17693
|
+
const i = t.toLowerCase().trim(), a = e.find((o) => o.id === i);
|
|
17694
|
+
return a || e.find((o) => o.provider_match && g(o.provider_match, i));
|
|
17414
17695
|
}
|
|
17415
|
-
function b(
|
|
17696
|
+
function b(e, { modelId: t, providerApiUrl: i, providerId: a }) {
|
|
17416
17697
|
if (a) {
|
|
17417
|
-
const o = P(
|
|
17698
|
+
const o = P(e, a);
|
|
17418
17699
|
if (o || a.toLowerCase() !== "litellm")
|
|
17419
17700
|
return o;
|
|
17420
17701
|
}
|
|
17421
17702
|
if (i)
|
|
17422
|
-
return
|
|
17423
|
-
if (
|
|
17424
|
-
return
|
|
17703
|
+
return e.find((o) => new RegExp(o.api_pattern).test(i));
|
|
17704
|
+
if (t)
|
|
17705
|
+
return e.find((o) => o.model_match && g(o.model_match, t));
|
|
17425
17706
|
}
|
|
17426
|
-
function S(
|
|
17427
|
-
return
|
|
17707
|
+
function S(e, t) {
|
|
17708
|
+
return e.find((i) => g(i.match, t));
|
|
17428
17709
|
}
|
|
17429
|
-
function M(
|
|
17430
|
-
const a = S(
|
|
17710
|
+
function M(e, t, i) {
|
|
17711
|
+
const a = S(e.models, t);
|
|
17431
17712
|
if (a) return a;
|
|
17432
|
-
if (
|
|
17433
|
-
for (const o of
|
|
17713
|
+
if (e.fallback_model_providers && i)
|
|
17714
|
+
for (const o of e.fallback_model_providers) {
|
|
17434
17715
|
const s = i.find((m) => m.id === o);
|
|
17435
17716
|
if (s) {
|
|
17436
|
-
const m = M(s,
|
|
17717
|
+
const m = M(s, t);
|
|
17437
17718
|
if (m) return m;
|
|
17438
17719
|
}
|
|
17439
17720
|
}
|
|
17440
17721
|
}
|
|
17441
17722
|
const A = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
|
|
17442
17723
|
let h = I, f = Promise.resolve(I), v = null;
|
|
17443
|
-
function G(
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
})) : (f = Promise.resolve(
|
|
17724
|
+
function G(e) {
|
|
17725
|
+
e !== null && ("then" in e ? (f = e, e.then((t) => {
|
|
17726
|
+
t !== null && (h = t);
|
|
17727
|
+
})) : (f = Promise.resolve(e), h = e));
|
|
17447
17728
|
}
|
|
17448
|
-
function R(
|
|
17449
|
-
v =
|
|
17729
|
+
function R(e) {
|
|
17730
|
+
v = e;
|
|
17450
17731
|
}
|
|
17451
|
-
function N(
|
|
17452
|
-
|
|
17732
|
+
function N(e) {
|
|
17733
|
+
e({
|
|
17453
17734
|
onCalc: R,
|
|
17454
17735
|
remoteDataUrl: A,
|
|
17455
17736
|
setProviderData: G
|
|
17456
17737
|
});
|
|
17457
17738
|
}
|
|
17458
|
-
function
|
|
17739
|
+
function E() {
|
|
17459
17740
|
return f;
|
|
17460
17741
|
}
|
|
17461
|
-
function
|
|
17742
|
+
function V(e, t, i) {
|
|
17462
17743
|
v?.();
|
|
17463
|
-
let a =
|
|
17744
|
+
let a = t.toLowerCase().trim(), o = i?.providerId;
|
|
17464
17745
|
if (o && o.toLowerCase() === "litellm" && a.includes("/")) {
|
|
17465
17746
|
const p = a.indexOf("/"), c = a.slice(0, p), _ = a.slice(p + 1);
|
|
17466
17747
|
c && _ && b(h, { providerId: c }) && (o = c, a = _);
|
|
@@ -17469,7 +17750,7 @@ function E(t, e, i) {
|
|
|
17469
17750
|
if (!s) return null;
|
|
17470
17751
|
const m = M(s, a, h);
|
|
17471
17752
|
if (!m) return null;
|
|
17472
|
-
const n = i?.timestamp ?? /* @__PURE__ */ new Date(), r = T(m, n), u = Q(
|
|
17753
|
+
const n = i?.timestamp ?? /* @__PURE__ */ new Date(), r = T(m, n), u = Q(e, r);
|
|
17473
17754
|
return {
|
|
17474
17755
|
auto_update_timestamp: void 0,
|
|
17475
17756
|
model: m,
|
|
@@ -17478,22 +17759,22 @@ function E(t, e, i) {
|
|
|
17478
17759
|
...u
|
|
17479
17760
|
};
|
|
17480
17761
|
}
|
|
17481
|
-
function O(
|
|
17482
|
-
return v?.(), b(h,
|
|
17762
|
+
function O(e) {
|
|
17763
|
+
return v?.(), b(h, e);
|
|
17483
17764
|
}
|
|
17484
|
-
function F(
|
|
17485
|
-
if (i = i ?? "default", !
|
|
17765
|
+
function F(e, t, i) {
|
|
17766
|
+
if (i = i ?? "default", !e.extractors)
|
|
17486
17767
|
throw new Error("No extraction logic defined for this provider");
|
|
17487
|
-
const a =
|
|
17768
|
+
const a = e.extractors.find((r) => r.api_flavor === i);
|
|
17488
17769
|
if (!a) {
|
|
17489
|
-
const r =
|
|
17770
|
+
const r = e.extractors.map((u) => u.api_flavor).join(", ");
|
|
17490
17771
|
throw new Error(`Unknown apiFlavor '${i}', allowed values: ${r}`);
|
|
17491
17772
|
}
|
|
17492
|
-
if (!q.guard(
|
|
17493
|
-
throw new Error(`Expected response data to be a mapping object, got ${d(
|
|
17494
|
-
const o = w(a.model_path,
|
|
17773
|
+
if (!q.guard(t))
|
|
17774
|
+
throw new Error(`Expected response data to be a mapping object, got ${d(t)}`);
|
|
17775
|
+
const o = w(a.model_path, t, z, !1, []), s = y(a.root), m = w(s, t, q, !0, []), n = {};
|
|
17495
17776
|
for (const r of a.mappings) {
|
|
17496
|
-
const u = w(r.path, m,
|
|
17777
|
+
const u = w(r.path, m, C, r.required, s);
|
|
17497
17778
|
if (u !== null) {
|
|
17498
17779
|
const p = n[r.dest] ?? 0;
|
|
17499
17780
|
n[r.dest] = p + u;
|
|
@@ -17503,12 +17784,12 @@ function F(t, e, i) {
|
|
|
17503
17784
|
throw new Error(`No usage information found at ${JSON.stringify(a.root)}`);
|
|
17504
17785
|
return { model: o, usage: n };
|
|
17505
17786
|
}
|
|
17506
|
-
function w(
|
|
17507
|
-
const [s, ...m] = y(
|
|
17787
|
+
function w(e, t, i, a, o) {
|
|
17788
|
+
const [s, ...m] = y(e).reverse();
|
|
17508
17789
|
if (typeof s != "string")
|
|
17509
17790
|
throw new Error(`Expected last step of path to be a string, got ${d(s)}`);
|
|
17510
17791
|
m.reverse();
|
|
17511
|
-
let n =
|
|
17792
|
+
let n = t;
|
|
17512
17793
|
const r = [];
|
|
17513
17794
|
for (const p of m) {
|
|
17514
17795
|
if (r.push(p), typeof p == "object")
|
|
@@ -17550,43 +17831,43 @@ function w(t, e, i, a, o) {
|
|
|
17550
17831
|
throw r.push(s), new Error(`Expected \`${k(o, r)}\` value to be a ${i.name}, got ${d(u)}`);
|
|
17551
17832
|
return null;
|
|
17552
17833
|
}
|
|
17553
|
-
function D(
|
|
17554
|
-
for (const i of
|
|
17834
|
+
function D(e, t) {
|
|
17835
|
+
for (const i of t)
|
|
17555
17836
|
if (q.guard(i)) {
|
|
17556
|
-
const a = i[
|
|
17557
|
-
if (typeof a == "string" && g(
|
|
17837
|
+
const a = i[e.field];
|
|
17838
|
+
if (typeof a == "string" && g(e.match, a))
|
|
17558
17839
|
return i;
|
|
17559
17840
|
}
|
|
17560
17841
|
}
|
|
17561
|
-
function y(
|
|
17562
|
-
return Array.isArray(
|
|
17842
|
+
function y(e) {
|
|
17843
|
+
return Array.isArray(e) ? [...e] : [e];
|
|
17563
17844
|
}
|
|
17564
|
-
function d(
|
|
17565
|
-
return
|
|
17845
|
+
function d(e) {
|
|
17846
|
+
return e === null ? "null" : Array.isArray(e) ? "array" : typeof e == "object" ? "mapping" : typeof e;
|
|
17566
17847
|
}
|
|
17567
17848
|
const q = {
|
|
17568
|
-
guard: (
|
|
17849
|
+
guard: (e) => d(e) === "mapping",
|
|
17569
17850
|
name: "mapping"
|
|
17570
|
-
}, C = {
|
|
17571
|
-
guard: (t) => typeof t == "string",
|
|
17572
|
-
name: "string"
|
|
17573
17851
|
}, z = {
|
|
17574
|
-
guard: (
|
|
17852
|
+
guard: (e) => typeof e == "string",
|
|
17853
|
+
name: "string"
|
|
17854
|
+
}, C = {
|
|
17855
|
+
guard: (e) => typeof e == "number",
|
|
17575
17856
|
name: "number"
|
|
17576
|
-
}, k = (
|
|
17857
|
+
}, k = (e, t) => [...e.map(B), ...t.map(B)].join("."), B = (e) => typeof e == "string" ? e : JSON.stringify(e);
|
|
17577
17858
|
class j {
|
|
17578
17859
|
base;
|
|
17579
17860
|
tiers;
|
|
17580
|
-
constructor(
|
|
17581
|
-
this.base =
|
|
17861
|
+
constructor(t) {
|
|
17862
|
+
this.base = t.base, this.tiers = [...t.tiers].sort((i, a) => i.start - a.start);
|
|
17582
17863
|
}
|
|
17583
17864
|
}
|
|
17584
17865
|
export {
|
|
17585
17866
|
A as REMOTE_DATA_JSON_URL,
|
|
17586
17867
|
j as TieredPrices,
|
|
17587
|
-
|
|
17868
|
+
V as calcPrice,
|
|
17588
17869
|
F as extractUsage,
|
|
17589
17870
|
O as findProvider,
|
|
17590
17871
|
N as updatePrices,
|
|
17591
|
-
|
|
17872
|
+
E as waitForUpdate
|
|
17592
17873
|
};
|