@pydantic/genai-prices 0.0.35 → 0.0.37
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 +741 -263
- package/dist/index.cjs +4 -4
- package/dist/index.js +579 -90
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const x = [
|
|
2
2
|
{
|
|
3
3
|
id: "anthropic",
|
|
4
4
|
name: "Anthropic",
|
|
@@ -197,6 +197,12 @@ const w = [
|
|
|
197
197
|
{
|
|
198
198
|
starts_with: "claude-haiku-4-5"
|
|
199
199
|
},
|
|
200
|
+
{
|
|
201
|
+
starts_with: "claude-haiku-4.5"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
starts_with: "claude-4-5-haiku"
|
|
205
|
+
},
|
|
200
206
|
{
|
|
201
207
|
starts_with: "claude-4.5-haiku"
|
|
202
208
|
}
|
|
@@ -210,6 +216,28 @@ const w = [
|
|
|
210
216
|
output_mtok: 5
|
|
211
217
|
}
|
|
212
218
|
},
|
|
219
|
+
{
|
|
220
|
+
id: "claude-instant-1",
|
|
221
|
+
description: "Retired, here to match price sources",
|
|
222
|
+
match: {
|
|
223
|
+
equals: "claude-instant-1"
|
|
224
|
+
},
|
|
225
|
+
prices: {
|
|
226
|
+
input_mtok: 1.63,
|
|
227
|
+
output_mtok: 55.1
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: "claude-instant-1.2",
|
|
232
|
+
description: "Retired, here to match price sources",
|
|
233
|
+
match: {
|
|
234
|
+
equals: "claude-instant-1.2"
|
|
235
|
+
},
|
|
236
|
+
prices: {
|
|
237
|
+
input_mtok: 1.63,
|
|
238
|
+
output_mtok: 5.51
|
|
239
|
+
}
|
|
240
|
+
},
|
|
213
241
|
{
|
|
214
242
|
id: "claude-opus-4-0",
|
|
215
243
|
name: "Claude Opus 4",
|
|
@@ -222,6 +250,9 @@ const w = [
|
|
|
222
250
|
{
|
|
223
251
|
starts_with: "claude-4-opus"
|
|
224
252
|
},
|
|
253
|
+
{
|
|
254
|
+
equals: "claude-opus-4"
|
|
255
|
+
},
|
|
225
256
|
{
|
|
226
257
|
equals: "claude-opus-4-20250514"
|
|
227
258
|
}
|
|
@@ -240,7 +271,14 @@ const w = [
|
|
|
240
271
|
name: "Claude Opus 4.1",
|
|
241
272
|
description: "Most intelligent model for complex tasks",
|
|
242
273
|
match: {
|
|
243
|
-
|
|
274
|
+
or: [
|
|
275
|
+
{
|
|
276
|
+
starts_with: "claude-opus-4-1"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
starts_with: "claude-opus-4.1"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
244
282
|
},
|
|
245
283
|
context_window: 2e5,
|
|
246
284
|
prices: {
|
|
@@ -286,7 +324,14 @@ const w = [
|
|
|
286
324
|
name: "Claude Sonnet 4.5",
|
|
287
325
|
description: "Most intelligent model for building agents and coding",
|
|
288
326
|
match: {
|
|
289
|
-
|
|
327
|
+
or: [
|
|
328
|
+
{
|
|
329
|
+
starts_with: "claude-sonnet-4-5"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
starts_with: "claude-sonnet-4.5"
|
|
333
|
+
}
|
|
334
|
+
]
|
|
290
335
|
},
|
|
291
336
|
context_window: 1e6,
|
|
292
337
|
prices: {
|
|
@@ -327,6 +372,17 @@ const w = [
|
|
|
327
372
|
]
|
|
328
373
|
}
|
|
329
374
|
}
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: "claude-v1",
|
|
378
|
+
description: "Retired, here to match price sources",
|
|
379
|
+
match: {
|
|
380
|
+
equals: "claude-v1"
|
|
381
|
+
},
|
|
382
|
+
prices: {
|
|
383
|
+
input_mtok: 8,
|
|
384
|
+
output_mtok: 24
|
|
385
|
+
}
|
|
330
386
|
}
|
|
331
387
|
]
|
|
332
388
|
},
|
|
@@ -1986,15 +2042,39 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
1986
2042
|
},
|
|
1987
2043
|
{
|
|
1988
2044
|
equals: "gemini-2.5-flash-latest"
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
equals: "gemini-2.5-flash-preview-09-2025"
|
|
1989
2048
|
}
|
|
1990
2049
|
]
|
|
1991
2050
|
},
|
|
1992
2051
|
prices: {
|
|
1993
2052
|
input_mtok: 0.3,
|
|
1994
|
-
cache_read_mtok: 0.
|
|
2053
|
+
cache_read_mtok: 0.03,
|
|
1995
2054
|
output_mtok: 2.5,
|
|
1996
2055
|
input_audio_mtok: 1,
|
|
1997
|
-
cache_audio_read_mtok: 0.
|
|
2056
|
+
cache_audio_read_mtok: 0.1
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
id: "gemini-2.5-flash-image",
|
|
2061
|
+
name: "Gemini 2.5 Flash Image",
|
|
2062
|
+
description: "Google's specialized image generation model optimized for fast, high-quality image generation. Outputs images at 1024x1024 resolution, with each image consuming 1290 output tokens.",
|
|
2063
|
+
match: {
|
|
2064
|
+
or: [
|
|
2065
|
+
{
|
|
2066
|
+
equals: "gemini-2.5-flash-image"
|
|
2067
|
+
},
|
|
2068
|
+
{
|
|
2069
|
+
equals: "gemini-2.5-flash-image-preview"
|
|
2070
|
+
}
|
|
2071
|
+
]
|
|
2072
|
+
},
|
|
2073
|
+
context_window: 1e6,
|
|
2074
|
+
price_comments: "See https://ai.google.dev/gemini-api/docs/pricing#gemini-2.5-flash-image. Image output is priced at $30 per 1M tokens, with each 1024x1024 image = 1290 tokens = $0.039/image. Cache pricing is not available for this model.",
|
|
2075
|
+
prices: {
|
|
2076
|
+
input_mtok: 0.3,
|
|
2077
|
+
output_mtok: 30
|
|
1998
2078
|
}
|
|
1999
2079
|
},
|
|
2000
2080
|
{
|
|
@@ -2014,10 +2094,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2014
2094
|
context_window: 1e6,
|
|
2015
2095
|
prices: {
|
|
2016
2096
|
input_mtok: 0.1,
|
|
2017
|
-
cache_read_mtok: 0.
|
|
2097
|
+
cache_read_mtok: 0.01,
|
|
2018
2098
|
output_mtok: 0.4,
|
|
2019
|
-
input_audio_mtok: 0.
|
|
2020
|
-
cache_audio_read_mtok: 0.
|
|
2099
|
+
input_audio_mtok: 0.3,
|
|
2100
|
+
cache_audio_read_mtok: 0.03
|
|
2021
2101
|
}
|
|
2022
2102
|
},
|
|
2023
2103
|
{
|
|
@@ -2027,10 +2107,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2027
2107
|
match: {
|
|
2028
2108
|
or: [
|
|
2029
2109
|
{
|
|
2030
|
-
contains: "gemini-2.5-flash-preview"
|
|
2110
|
+
contains: "gemini-2.5-flash-preview-05-20"
|
|
2031
2111
|
},
|
|
2032
2112
|
{
|
|
2033
|
-
|
|
2113
|
+
contains: "gemini-2.5-flash-preview-04-17"
|
|
2034
2114
|
},
|
|
2035
2115
|
{
|
|
2036
2116
|
equals: "gemini-2.5-flash-preview-05-20:thinking"
|
|
@@ -2068,11 +2148,11 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2068
2148
|
]
|
|
2069
2149
|
},
|
|
2070
2150
|
cache_read_mtok: {
|
|
2071
|
-
base: 0.
|
|
2151
|
+
base: 0.125,
|
|
2072
2152
|
tiers: [
|
|
2073
2153
|
{
|
|
2074
2154
|
start: 2e5,
|
|
2075
|
-
price: 0.
|
|
2155
|
+
price: 0.25
|
|
2076
2156
|
}
|
|
2077
2157
|
]
|
|
2078
2158
|
},
|
|
@@ -2087,6 +2167,15 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2087
2167
|
}
|
|
2088
2168
|
}
|
|
2089
2169
|
},
|
|
2170
|
+
{
|
|
2171
|
+
id: "gemini-embedding-001",
|
|
2172
|
+
match: {
|
|
2173
|
+
equals: "gemini-embedding-001"
|
|
2174
|
+
},
|
|
2175
|
+
prices: {
|
|
2176
|
+
input_mtok: 0.15
|
|
2177
|
+
}
|
|
2178
|
+
},
|
|
2090
2179
|
{
|
|
2091
2180
|
id: "gemini-flash-1.5",
|
|
2092
2181
|
name: "Gemini 1.5 Flash",
|
|
@@ -2164,6 +2253,25 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2164
2253
|
}
|
|
2165
2254
|
}
|
|
2166
2255
|
},
|
|
2256
|
+
{
|
|
2257
|
+
id: "gemini-live-2.5-flash-preview",
|
|
2258
|
+
match: {
|
|
2259
|
+
or: [
|
|
2260
|
+
{
|
|
2261
|
+
starts_with: "gemini-live-2.5-flash-preview"
|
|
2262
|
+
},
|
|
2263
|
+
{
|
|
2264
|
+
starts_with: "gemini-2.5-flash-native-audio-preview"
|
|
2265
|
+
}
|
|
2266
|
+
]
|
|
2267
|
+
},
|
|
2268
|
+
prices: {
|
|
2269
|
+
input_mtok: 0.5,
|
|
2270
|
+
output_mtok: 2,
|
|
2271
|
+
input_audio_mtok: 3,
|
|
2272
|
+
output_audio_mtok: 12
|
|
2273
|
+
}
|
|
2274
|
+
},
|
|
2167
2275
|
{
|
|
2168
2276
|
id: "gemini-pro",
|
|
2169
2277
|
name: "gemini 1.0 pro",
|
|
@@ -3315,7 +3423,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3315
3423
|
name: "Codex Mini",
|
|
3316
3424
|
description: "codex-mini-latest is a fine-tuned version of o4-mini specifically for use in Codex CLI. For direct use in the API, we recommend starting with gpt-4.1.",
|
|
3317
3425
|
match: {
|
|
3318
|
-
|
|
3426
|
+
or: [
|
|
3427
|
+
{
|
|
3428
|
+
equals: "codex-mini"
|
|
3429
|
+
},
|
|
3430
|
+
{
|
|
3431
|
+
equals: "codex-mini-latest"
|
|
3432
|
+
}
|
|
3433
|
+
]
|
|
3319
3434
|
},
|
|
3320
3435
|
prices: {
|
|
3321
3436
|
input_mtok: 1.5,
|
|
@@ -3361,7 +3476,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3361
3476
|
id: "ft:gpt-3.5-turbo-",
|
|
3362
3477
|
description: "GPT-3.5 Turbo fine tuned.",
|
|
3363
3478
|
match: {
|
|
3364
|
-
starts_with: "ft:gpt-3.5-turbo
|
|
3479
|
+
starts_with: "ft:gpt-3.5-turbo"
|
|
3365
3480
|
},
|
|
3366
3481
|
prices: {
|
|
3367
3482
|
input_mtok: 3,
|
|
@@ -3369,10 +3484,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3369
3484
|
}
|
|
3370
3485
|
},
|
|
3371
3486
|
{
|
|
3372
|
-
id: "ft:gpt-4o
|
|
3487
|
+
id: "ft:gpt-4o",
|
|
3373
3488
|
description: "GPT-4o fine tuned.",
|
|
3374
3489
|
match: {
|
|
3375
|
-
starts_with: "ft:gpt-4o-2024-
|
|
3490
|
+
starts_with: "ft:gpt-4o-2024-"
|
|
3376
3491
|
},
|
|
3377
3492
|
prices: {
|
|
3378
3493
|
input_mtok: 3.75,
|
|
@@ -3380,16 +3495,33 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3380
3495
|
}
|
|
3381
3496
|
},
|
|
3382
3497
|
{
|
|
3383
|
-
id: "ft:gpt-4o-mini
|
|
3498
|
+
id: "ft:gpt-4o-mini",
|
|
3384
3499
|
description: "GPT-4o Mini fine tuned.",
|
|
3385
3500
|
match: {
|
|
3386
|
-
starts_with: "ft:gpt-4o-mini-2024-
|
|
3501
|
+
starts_with: "ft:gpt-4o-mini-2024-"
|
|
3387
3502
|
},
|
|
3388
3503
|
prices: {
|
|
3389
3504
|
input_mtok: 0.3,
|
|
3390
3505
|
output_mtok: 1.2
|
|
3391
3506
|
}
|
|
3392
3507
|
},
|
|
3508
|
+
{
|
|
3509
|
+
id: "gpt-3.5-0301",
|
|
3510
|
+
match: {
|
|
3511
|
+
or: [
|
|
3512
|
+
{
|
|
3513
|
+
equals: "gpt-3.5-turbo-0301"
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
equals: "gpt-3.5-0301"
|
|
3517
|
+
}
|
|
3518
|
+
]
|
|
3519
|
+
},
|
|
3520
|
+
prices: {
|
|
3521
|
+
input_mtok: 1.5,
|
|
3522
|
+
output_mtok: 2
|
|
3523
|
+
}
|
|
3524
|
+
},
|
|
3393
3525
|
{
|
|
3394
3526
|
id: "gpt-3.5-turbo",
|
|
3395
3527
|
name: "gpt 3.5 turbo",
|
|
@@ -3404,9 +3536,6 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3404
3536
|
},
|
|
3405
3537
|
{
|
|
3406
3538
|
equals: "gpt-3.5-turbo-0125"
|
|
3407
|
-
},
|
|
3408
|
-
{
|
|
3409
|
-
equals: "gpt-3.5-turbo-1106"
|
|
3410
3539
|
}
|
|
3411
3540
|
]
|
|
3412
3541
|
},
|
|
@@ -3416,6 +3545,28 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3416
3545
|
output_mtok: 1.5
|
|
3417
3546
|
}
|
|
3418
3547
|
},
|
|
3548
|
+
{
|
|
3549
|
+
id: "gpt-3.5-turbo-0613",
|
|
3550
|
+
match: {
|
|
3551
|
+
equals: "gpt-3.5-turbo-0613"
|
|
3552
|
+
},
|
|
3553
|
+
context_window: 16385,
|
|
3554
|
+
prices: {
|
|
3555
|
+
input_mtok: 1.5,
|
|
3556
|
+
output_mtok: 2
|
|
3557
|
+
}
|
|
3558
|
+
},
|
|
3559
|
+
{
|
|
3560
|
+
id: "gpt-3.5-turbo-1106",
|
|
3561
|
+
match: {
|
|
3562
|
+
equals: "gpt-3.5-turbo-1106"
|
|
3563
|
+
},
|
|
3564
|
+
context_window: 16385,
|
|
3565
|
+
prices: {
|
|
3566
|
+
input_mtok: 1,
|
|
3567
|
+
output_mtok: 2
|
|
3568
|
+
}
|
|
3569
|
+
},
|
|
3419
3570
|
{
|
|
3420
3571
|
id: "gpt-3.5-turbo-16k",
|
|
3421
3572
|
name: "GPT-3.5 Turbo 16k",
|
|
@@ -3430,6 +3581,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3430
3581
|
},
|
|
3431
3582
|
{
|
|
3432
3583
|
equals: "gpt-35-turbo-16k-0613"
|
|
3584
|
+
},
|
|
3585
|
+
{
|
|
3586
|
+
equals: "gpt-35-turbo-16k"
|
|
3433
3587
|
}
|
|
3434
3588
|
]
|
|
3435
3589
|
},
|
|
@@ -3473,6 +3627,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3473
3627
|
},
|
|
3474
3628
|
{
|
|
3475
3629
|
equals: "gpt-4-0613"
|
|
3630
|
+
},
|
|
3631
|
+
{
|
|
3632
|
+
starts_with: "ft:gpt-4-0"
|
|
3476
3633
|
}
|
|
3477
3634
|
]
|
|
3478
3635
|
},
|
|
@@ -3688,6 +3845,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3688
3845
|
},
|
|
3689
3846
|
{
|
|
3690
3847
|
equals: "gpt-4o-mini-search-preview"
|
|
3848
|
+
},
|
|
3849
|
+
{
|
|
3850
|
+
equals: "gpt-4o-mini-search-preview-2025-03-11"
|
|
3691
3851
|
}
|
|
3692
3852
|
]
|
|
3693
3853
|
},
|
|
@@ -3729,7 +3889,31 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3729
3889
|
prices: {
|
|
3730
3890
|
input_mtok: 0.6,
|
|
3731
3891
|
cache_read_mtok: 0.3,
|
|
3732
|
-
output_mtok: 2.4
|
|
3892
|
+
output_mtok: 2.4,
|
|
3893
|
+
input_audio_mtok: 10,
|
|
3894
|
+
cache_audio_read_mtok: 0.3,
|
|
3895
|
+
output_audio_mtok: 20
|
|
3896
|
+
}
|
|
3897
|
+
},
|
|
3898
|
+
{
|
|
3899
|
+
id: "gpt-4o-mini-transcribe",
|
|
3900
|
+
match: {
|
|
3901
|
+
equals: "gpt-4o-mini-transcribe"
|
|
3902
|
+
},
|
|
3903
|
+
prices: {
|
|
3904
|
+
input_mtok: 1.25,
|
|
3905
|
+
output_mtok: 5,
|
|
3906
|
+
input_audio_mtok: 3
|
|
3907
|
+
}
|
|
3908
|
+
},
|
|
3909
|
+
{
|
|
3910
|
+
id: "gpt-4o-mini-tts",
|
|
3911
|
+
match: {
|
|
3912
|
+
equals: "gpt-4o-mini-tts"
|
|
3913
|
+
},
|
|
3914
|
+
prices: {
|
|
3915
|
+
input_mtok: 0.6,
|
|
3916
|
+
output_audio_mtok: 12
|
|
3733
3917
|
}
|
|
3734
3918
|
},
|
|
3735
3919
|
{
|
|
@@ -3751,13 +3935,38 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3751
3935
|
name: "GPT-4o Search Preview",
|
|
3752
3936
|
description: "GPT-4o Search Previewis a specialized model for web search in Chat Completions. It is trained to understand and execute web search queries.",
|
|
3753
3937
|
match: {
|
|
3754
|
-
|
|
3938
|
+
or: [
|
|
3939
|
+
{
|
|
3940
|
+
equals: "gpt-4o-search-preview"
|
|
3941
|
+
},
|
|
3942
|
+
{
|
|
3943
|
+
equals: "gpt-4o-search-preview-2025-03-11"
|
|
3944
|
+
}
|
|
3945
|
+
]
|
|
3755
3946
|
},
|
|
3756
3947
|
prices: {
|
|
3757
3948
|
input_mtok: 2.5,
|
|
3758
3949
|
output_mtok: 10
|
|
3759
3950
|
}
|
|
3760
3951
|
},
|
|
3952
|
+
{
|
|
3953
|
+
id: "gpt-4o-transcribe",
|
|
3954
|
+
match: {
|
|
3955
|
+
or: [
|
|
3956
|
+
{
|
|
3957
|
+
equals: "gpt-4o-transcribe"
|
|
3958
|
+
},
|
|
3959
|
+
{
|
|
3960
|
+
equals: "gpt-4o-transcribe-diarize"
|
|
3961
|
+
}
|
|
3962
|
+
]
|
|
3963
|
+
},
|
|
3964
|
+
prices: {
|
|
3965
|
+
input_mtok: 2.5,
|
|
3966
|
+
output_mtok: 10,
|
|
3967
|
+
input_audio_mtok: 6
|
|
3968
|
+
}
|
|
3969
|
+
},
|
|
3761
3970
|
{
|
|
3762
3971
|
id: "gpt-4o:extended",
|
|
3763
3972
|
name: "GPT-4o (extended)",
|
|
@@ -3787,6 +3996,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3787
3996
|
},
|
|
3788
3997
|
{
|
|
3789
3998
|
equals: "gpt-5-chat-latest"
|
|
3999
|
+
},
|
|
4000
|
+
{
|
|
4001
|
+
equals: "gpt-5-codex"
|
|
3790
4002
|
}
|
|
3791
4003
|
]
|
|
3792
4004
|
},
|
|
@@ -3797,6 +4009,30 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3797
4009
|
output_mtok: 10
|
|
3798
4010
|
}
|
|
3799
4011
|
},
|
|
4012
|
+
{
|
|
4013
|
+
id: "gpt-5-image",
|
|
4014
|
+
match: {
|
|
4015
|
+
equals: "gpt-5-image"
|
|
4016
|
+
},
|
|
4017
|
+
price_comments: "Seen on OpenRouter before OpenAI",
|
|
4018
|
+
prices: {
|
|
4019
|
+
input_mtok: 10,
|
|
4020
|
+
cache_read_mtok: 1.25,
|
|
4021
|
+
output_mtok: 10
|
|
4022
|
+
}
|
|
4023
|
+
},
|
|
4024
|
+
{
|
|
4025
|
+
id: "gpt-5-image-mini",
|
|
4026
|
+
match: {
|
|
4027
|
+
equals: "gpt-5-image-mini"
|
|
4028
|
+
},
|
|
4029
|
+
price_comments: "Seen on OpenRouter before OpenAI",
|
|
4030
|
+
prices: {
|
|
4031
|
+
input_mtok: 2.5,
|
|
4032
|
+
cache_read_mtok: 0.25,
|
|
4033
|
+
output_mtok: 2
|
|
4034
|
+
}
|
|
4035
|
+
},
|
|
3800
4036
|
{
|
|
3801
4037
|
id: "gpt-5-mini",
|
|
3802
4038
|
name: "GPT-5 mini",
|
|
@@ -3839,6 +4075,68 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3839
4075
|
output_mtok: 0.4
|
|
3840
4076
|
}
|
|
3841
4077
|
},
|
|
4078
|
+
{
|
|
4079
|
+
id: "gpt-5-pro",
|
|
4080
|
+
match: {
|
|
4081
|
+
or: [
|
|
4082
|
+
{
|
|
4083
|
+
equals: "gpt-5-pro"
|
|
4084
|
+
},
|
|
4085
|
+
{
|
|
4086
|
+
equals: "gpt-5-pro-2025-10-06"
|
|
4087
|
+
}
|
|
4088
|
+
]
|
|
4089
|
+
},
|
|
4090
|
+
prices: {
|
|
4091
|
+
input_mtok: 15,
|
|
4092
|
+
output_mtok: 120
|
|
4093
|
+
}
|
|
4094
|
+
},
|
|
4095
|
+
{
|
|
4096
|
+
id: "gpt-realtime",
|
|
4097
|
+
match: {
|
|
4098
|
+
or: [
|
|
4099
|
+
{
|
|
4100
|
+
equals: "gpt-realtime"
|
|
4101
|
+
},
|
|
4102
|
+
{
|
|
4103
|
+
equals: "gpt-realtime-2025-08-28"
|
|
4104
|
+
}
|
|
4105
|
+
]
|
|
4106
|
+
},
|
|
4107
|
+
price_comments: "Missing image token prices which we don't support yet",
|
|
4108
|
+
prices: {
|
|
4109
|
+
input_mtok: 4,
|
|
4110
|
+
cache_read_mtok: 0.4,
|
|
4111
|
+
output_mtok: 16,
|
|
4112
|
+
input_audio_mtok: 32,
|
|
4113
|
+
cache_audio_read_mtok: 0.4,
|
|
4114
|
+
output_audio_mtok: 64
|
|
4115
|
+
}
|
|
4116
|
+
},
|
|
4117
|
+
{
|
|
4118
|
+
id: "gpt-realtime-mini",
|
|
4119
|
+
match: {
|
|
4120
|
+
equals: "gpt-realtime-mini"
|
|
4121
|
+
},
|
|
4122
|
+
price_comments: "Missing image token prices which we don't support yet",
|
|
4123
|
+
prices: {
|
|
4124
|
+
input_mtok: 0.6,
|
|
4125
|
+
cache_read_mtok: 0.06,
|
|
4126
|
+
output_mtok: 2.4,
|
|
4127
|
+
input_audio_mtok: 10,
|
|
4128
|
+
cache_audio_read_mtok: 0.3,
|
|
4129
|
+
output_audio_mtok: 20
|
|
4130
|
+
}
|
|
4131
|
+
},
|
|
4132
|
+
{
|
|
4133
|
+
id: "moderation",
|
|
4134
|
+
description: "All OpenAI moderation models and endpoints are free of charge",
|
|
4135
|
+
match: {
|
|
4136
|
+
contains: "moderation"
|
|
4137
|
+
},
|
|
4138
|
+
prices: {}
|
|
4139
|
+
},
|
|
3842
4140
|
{
|
|
3843
4141
|
id: "o1",
|
|
3844
4142
|
name: "o1",
|
|
@@ -3892,7 +4190,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3892
4190
|
name: "o1-pro",
|
|
3893
4191
|
description: "The o1 series of models are trained with reinforcement learning to think before they answer and perform complex reasoning. The o1-pro model uses more compute to think harder and provide consistently better answers.",
|
|
3894
4192
|
match: {
|
|
3895
|
-
|
|
4193
|
+
or: [
|
|
4194
|
+
{
|
|
4195
|
+
equals: "o1-pro"
|
|
4196
|
+
},
|
|
4197
|
+
{
|
|
4198
|
+
equals: "o1-pro-2025-03-19"
|
|
4199
|
+
}
|
|
4200
|
+
]
|
|
3896
4201
|
},
|
|
3897
4202
|
prices: {
|
|
3898
4203
|
input_mtok: 150,
|
|
@@ -3934,6 +4239,24 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3934
4239
|
}
|
|
3935
4240
|
]
|
|
3936
4241
|
},
|
|
4242
|
+
{
|
|
4243
|
+
id: "o3-deep-research",
|
|
4244
|
+
match: {
|
|
4245
|
+
or: [
|
|
4246
|
+
{
|
|
4247
|
+
equals: "o3-deep-research"
|
|
4248
|
+
},
|
|
4249
|
+
{
|
|
4250
|
+
equals: "o3-deep-research-2025-06-26"
|
|
4251
|
+
}
|
|
4252
|
+
]
|
|
4253
|
+
},
|
|
4254
|
+
prices: {
|
|
4255
|
+
input_mtok: 10,
|
|
4256
|
+
cache_read_mtok: 2.5,
|
|
4257
|
+
output_mtok: 40
|
|
4258
|
+
}
|
|
4259
|
+
},
|
|
3937
4260
|
{
|
|
3938
4261
|
id: "o3-mini",
|
|
3939
4262
|
name: "o3 Mini",
|
|
@@ -3962,7 +4285,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3962
4285
|
name: "o3 Pro",
|
|
3963
4286
|
description: "The o-series of models are trained with reinforcement learning to think before they answer and perform complex reasoning. The o3-pro model uses more compute to think harder and provide consistently better answers.",
|
|
3964
4287
|
match: {
|
|
3965
|
-
|
|
4288
|
+
or: [
|
|
4289
|
+
{
|
|
4290
|
+
equals: "o3-pro"
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
equals: "o3-pro-2025-06-10"
|
|
4294
|
+
}
|
|
4295
|
+
]
|
|
3966
4296
|
},
|
|
3967
4297
|
prices: {
|
|
3968
4298
|
input_mtok: 20,
|
|
@@ -3975,9 +4305,6 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3975
4305
|
description: "OpenAI o4-mini-high is the same model as o4-mini with reasoning_effort set to high.",
|
|
3976
4306
|
match: {
|
|
3977
4307
|
or: [
|
|
3978
|
-
{
|
|
3979
|
-
starts_with: "o4-mini"
|
|
3980
|
-
},
|
|
3981
4308
|
{
|
|
3982
4309
|
equals: "o4-mini-2025-04-16"
|
|
3983
4310
|
},
|
|
@@ -3995,6 +4322,24 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3995
4322
|
output_mtok: 4.4
|
|
3996
4323
|
}
|
|
3997
4324
|
},
|
|
4325
|
+
{
|
|
4326
|
+
id: "o4-mini-deep-research",
|
|
4327
|
+
match: {
|
|
4328
|
+
or: [
|
|
4329
|
+
{
|
|
4330
|
+
equals: "o4-mini-deep-research"
|
|
4331
|
+
},
|
|
4332
|
+
{
|
|
4333
|
+
equals: "o4-mini-deep-research-2025-06-26"
|
|
4334
|
+
}
|
|
4335
|
+
]
|
|
4336
|
+
},
|
|
4337
|
+
prices: {
|
|
4338
|
+
input_mtok: 2,
|
|
4339
|
+
cache_read_mtok: 0.5,
|
|
4340
|
+
output_mtok: 8
|
|
4341
|
+
}
|
|
4342
|
+
},
|
|
3998
4343
|
{
|
|
3999
4344
|
id: "text-davinci-002",
|
|
4000
4345
|
match: {
|
|
@@ -5183,6 +5528,18 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
5183
5528
|
},
|
|
5184
5529
|
prices: {}
|
|
5185
5530
|
},
|
|
5531
|
+
{
|
|
5532
|
+
id: "deepseek-v3.1-terminus",
|
|
5533
|
+
name: "DeepSeek V3.1 Terminus",
|
|
5534
|
+
match: {
|
|
5535
|
+
equals: "deepseek-v3.1-terminus"
|
|
5536
|
+
},
|
|
5537
|
+
context_window: 163840,
|
|
5538
|
+
prices: {
|
|
5539
|
+
input_mtok: 0.23,
|
|
5540
|
+
output_mtok: 0.9
|
|
5541
|
+
}
|
|
5542
|
+
},
|
|
5186
5543
|
{
|
|
5187
5544
|
id: "deepseek/deepseek-chat",
|
|
5188
5545
|
match: {
|
|
@@ -5210,6 +5567,18 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
5210
5567
|
},
|
|
5211
5568
|
prices: {}
|
|
5212
5569
|
},
|
|
5570
|
+
{
|
|
5571
|
+
id: "deepseek/deepseek-chat-v3.1",
|
|
5572
|
+
name: "DeepSeek Chat V3.1",
|
|
5573
|
+
match: {
|
|
5574
|
+
equals: "deepseek/deepseek-chat-v3.1"
|
|
5575
|
+
},
|
|
5576
|
+
context_window: 163840,
|
|
5577
|
+
prices: {
|
|
5578
|
+
input_mtok: 0.2,
|
|
5579
|
+
output_mtok: 0.8
|
|
5580
|
+
}
|
|
5581
|
+
},
|
|
5213
5582
|
{
|
|
5214
5583
|
id: "deepseek/deepseek-chat:free",
|
|
5215
5584
|
match: {
|
|
@@ -5319,6 +5688,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
5319
5688
|
},
|
|
5320
5689
|
prices: {}
|
|
5321
5690
|
},
|
|
5691
|
+
{
|
|
5692
|
+
id: "deepseek/deepseek-v3.2-exp",
|
|
5693
|
+
name: "DeepSeek V3.2 Experimental",
|
|
5694
|
+
match: {
|
|
5695
|
+
equals: "deepseek/deepseek-v3.2-exp"
|
|
5696
|
+
},
|
|
5697
|
+
prices: {
|
|
5698
|
+
input_mtok: 0.27,
|
|
5699
|
+
output_mtok: 0.4
|
|
5700
|
+
}
|
|
5701
|
+
},
|
|
5322
5702
|
{
|
|
5323
5703
|
id: "devstral-small",
|
|
5324
5704
|
name: "Devstral Small",
|
|
@@ -5503,7 +5883,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
5503
5883
|
id: "gemini-2.5-flash",
|
|
5504
5884
|
name: "Gemini 2.5 Flash",
|
|
5505
5885
|
match: {
|
|
5506
|
-
|
|
5886
|
+
or: [
|
|
5887
|
+
{
|
|
5888
|
+
equals: "gemini-2.5-flash"
|
|
5889
|
+
},
|
|
5890
|
+
{
|
|
5891
|
+
equals: "google/gemini-2.5-flash"
|
|
5892
|
+
}
|
|
5893
|
+
]
|
|
5507
5894
|
},
|
|
5508
5895
|
prices: {
|
|
5509
5896
|
input_mtok: 0.3,
|
|
@@ -5842,6 +6229,48 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
5842
6229
|
},
|
|
5843
6230
|
prices: {}
|
|
5844
6231
|
},
|
|
6232
|
+
{
|
|
6233
|
+
id: "google/gemini-2.5-flash-image",
|
|
6234
|
+
name: "Gemini 2.5 Flash Image (Nano Banana)",
|
|
6235
|
+
match: {
|
|
6236
|
+
or: [
|
|
6237
|
+
{
|
|
6238
|
+
equals: "google/gemini-2.5-flash-image"
|
|
6239
|
+
},
|
|
6240
|
+
{
|
|
6241
|
+
equals: "google/gemini-2.5-flash-image-preview"
|
|
6242
|
+
}
|
|
6243
|
+
]
|
|
6244
|
+
},
|
|
6245
|
+
prices: {
|
|
6246
|
+
input_mtok: 0.3,
|
|
6247
|
+
output_mtok: 2.5
|
|
6248
|
+
}
|
|
6249
|
+
},
|
|
6250
|
+
{
|
|
6251
|
+
id: "google/gemini-2.5-flash-lite",
|
|
6252
|
+
name: "Gemini 2.5 Flash Lite",
|
|
6253
|
+
match: {
|
|
6254
|
+
equals: "google/gemini-2.5-flash-lite"
|
|
6255
|
+
},
|
|
6256
|
+
prices: {
|
|
6257
|
+
input_mtok: 0.1,
|
|
6258
|
+
cache_write_mtok: 0.183,
|
|
6259
|
+
cache_read_mtok: 0.025,
|
|
6260
|
+
output_mtok: 0.4
|
|
6261
|
+
}
|
|
6262
|
+
},
|
|
6263
|
+
{
|
|
6264
|
+
id: "google/gemini-2.5-flash-lite-preview-09-2025",
|
|
6265
|
+
name: "Gemini 2.5 Flash Lite Preview 09-2025",
|
|
6266
|
+
match: {
|
|
6267
|
+
equals: "google/gemini-2.5-flash-lite-preview-09-2025"
|
|
6268
|
+
},
|
|
6269
|
+
prices: {
|
|
6270
|
+
input_mtok: 0.1,
|
|
6271
|
+
output_mtok: 0.4
|
|
6272
|
+
}
|
|
6273
|
+
},
|
|
5845
6274
|
{
|
|
5846
6275
|
id: "google/gemini-2.5-flash-preview",
|
|
5847
6276
|
match: {
|
|
@@ -5852,6 +6281,19 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
5852
6281
|
output_mtok: 0.6
|
|
5853
6282
|
}
|
|
5854
6283
|
},
|
|
6284
|
+
{
|
|
6285
|
+
id: "google/gemini-2.5-flash-preview-09-2025",
|
|
6286
|
+
name: "Gemini 2.5 Flash Preview 09-2025",
|
|
6287
|
+
match: {
|
|
6288
|
+
equals: "google/gemini-2.5-flash-preview-09-2025"
|
|
6289
|
+
},
|
|
6290
|
+
prices: {
|
|
6291
|
+
input_mtok: 0.3,
|
|
6292
|
+
cache_write_mtok: 0.383,
|
|
6293
|
+
cache_read_mtok: 0.075,
|
|
6294
|
+
output_mtok: 2.5
|
|
6295
|
+
}
|
|
6296
|
+
},
|
|
5855
6297
|
{
|
|
5856
6298
|
id: "google/gemini-2.5-flash-preview:thinking",
|
|
5857
6299
|
match: {
|
|
@@ -9951,6 +10393,28 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
9951
10393
|
input_mtok: 3,
|
|
9952
10394
|
output_mtok: 3
|
|
9953
10395
|
}
|
|
10396
|
+
},
|
|
10397
|
+
{
|
|
10398
|
+
id: "z-ai/glm-4.5",
|
|
10399
|
+
match: {
|
|
10400
|
+
equals: "z-ai/glm-4.5"
|
|
10401
|
+
},
|
|
10402
|
+
context_window: 131072,
|
|
10403
|
+
prices: {
|
|
10404
|
+
input_mtok: 0.35,
|
|
10405
|
+
output_mtok: 1.55
|
|
10406
|
+
}
|
|
10407
|
+
},
|
|
10408
|
+
{
|
|
10409
|
+
id: "z-ai/glm-4.6",
|
|
10410
|
+
match: {
|
|
10411
|
+
equals: "z-ai/glm-4.6"
|
|
10412
|
+
},
|
|
10413
|
+
context_window: 202752,
|
|
10414
|
+
prices: {
|
|
10415
|
+
input_mtok: 0.4,
|
|
10416
|
+
output_mtok: 1.75
|
|
10417
|
+
}
|
|
9954
10418
|
}
|
|
9955
10419
|
]
|
|
9956
10420
|
},
|
|
@@ -11070,7 +11534,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
11070
11534
|
]
|
|
11071
11535
|
}
|
|
11072
11536
|
];
|
|
11073
|
-
function
|
|
11537
|
+
function M(t, e) {
|
|
11074
11538
|
if (e <= 0) return 0;
|
|
11075
11539
|
let a = 0;
|
|
11076
11540
|
const i = [...t.tiers].sort((r, s) => r.start - s.start), o = i[0]?.start ?? e, m = Math.min(e, o);
|
|
@@ -11082,19 +11546,33 @@ function y(t, e) {
|
|
|
11082
11546
|
return a;
|
|
11083
11547
|
}
|
|
11084
11548
|
function l(t, e, a) {
|
|
11085
|
-
return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 :
|
|
11549
|
+
return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : M(t, e);
|
|
11086
11550
|
}
|
|
11087
|
-
function
|
|
11551
|
+
function I(t, e) {
|
|
11088
11552
|
let a = 0, i = 0;
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11553
|
+
const o = t.cache_read_tokens ?? 0, m = t.cache_write_tokens ?? 0, r = t.cache_audio_read_tokens ?? 0, s = t.output_audio_tokens ?? 0;
|
|
11554
|
+
let n = t.input_audio_tokens ?? 0;
|
|
11555
|
+
if (n -= r, n < 0)
|
|
11556
|
+
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
11557
|
+
let u = t.input_tokens ?? 0;
|
|
11558
|
+
if (u -= o, u -= m, u -= n, u < 0)
|
|
11559
|
+
throw new Error("Uncached text input tokens cannot be negative");
|
|
11560
|
+
let p = o;
|
|
11561
|
+
if (p -= r, p < 0)
|
|
11562
|
+
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
11563
|
+
a += l(e.input_mtok, u), a += l(e.cache_read_mtok, p), a += l(e.cache_write_mtok, m), a += l(e.input_audio_mtok, n), a += l(e.cache_audio_read_mtok, r);
|
|
11564
|
+
let k = t.output_tokens ?? 0;
|
|
11565
|
+
if (k -= s, k < 0)
|
|
11566
|
+
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
11567
|
+
i += l(e.output_mtok, k), i += l(e.output_audio_mtok, t.output_audio_tokens);
|
|
11568
|
+
let w = a + i;
|
|
11569
|
+
return e.requests_kcount !== void 0 && (w += e.requests_kcount / 1e3), {
|
|
11092
11570
|
input_price: a,
|
|
11093
11571
|
output_price: i,
|
|
11094
|
-
total_price:
|
|
11572
|
+
total_price: w
|
|
11095
11573
|
};
|
|
11096
11574
|
}
|
|
11097
|
-
function
|
|
11575
|
+
function P(t, e) {
|
|
11098
11576
|
if (!Array.isArray(t.prices))
|
|
11099
11577
|
return t.prices;
|
|
11100
11578
|
for (let a = t.prices.length - 1; a >= 0; a--) {
|
|
@@ -11118,48 +11596,48 @@ function I(t, e) {
|
|
|
11118
11596
|
function h(t, e) {
|
|
11119
11597
|
return "or" in t ? t.or.some((a) => h(a, e)) : "and" in t ? t.and.every((a) => h(a, e)) : "equals" in t ? e === t.equals : "starts_with" in t ? e.startsWith(t.starts_with) : "ends_with" in t ? e.endsWith(t.ends_with) : "contains" in t ? e.includes(t.contains) : "regex" in t ? new RegExp(t.regex).test(e) : !1;
|
|
11120
11598
|
}
|
|
11121
|
-
function
|
|
11599
|
+
function L(t, e) {
|
|
11122
11600
|
const a = e.toLowerCase().trim(), i = t.find((o) => o.id === a);
|
|
11123
11601
|
return i || t.find((o) => o.provider_match && h(o.provider_match, a));
|
|
11124
11602
|
}
|
|
11125
|
-
function
|
|
11603
|
+
function y(t, { modelId: e, providerApiUrl: a, providerId: i }) {
|
|
11126
11604
|
if (i)
|
|
11127
|
-
return
|
|
11605
|
+
return L(t, i);
|
|
11128
11606
|
if (a)
|
|
11129
11607
|
return t.find((o) => new RegExp(o.api_pattern).test(a));
|
|
11130
11608
|
if (e)
|
|
11131
11609
|
return t.find((o) => o.model_match && h(o.model_match, e));
|
|
11132
11610
|
}
|
|
11133
|
-
function
|
|
11611
|
+
function T(t, e) {
|
|
11134
11612
|
return t.find((a) => h(a.match, e));
|
|
11135
11613
|
}
|
|
11136
|
-
const
|
|
11137
|
-
let
|
|
11138
|
-
function G(t) {
|
|
11139
|
-
"then" in t ? (q = t, t.then((e) => {
|
|
11140
|
-
_ = e;
|
|
11141
|
-
})) : (q = Promise.resolve(t), _ = t);
|
|
11142
|
-
}
|
|
11614
|
+
const G = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
|
|
11615
|
+
let g = x, b = Promise.resolve(x), f = null;
|
|
11143
11616
|
function S(t) {
|
|
11144
|
-
b = t
|
|
11617
|
+
"then" in t ? (b = t, t.then((e) => {
|
|
11618
|
+
g = e;
|
|
11619
|
+
})) : (b = Promise.resolve(t), g = t);
|
|
11620
|
+
}
|
|
11621
|
+
function A(t) {
|
|
11622
|
+
f = t;
|
|
11145
11623
|
}
|
|
11146
|
-
function
|
|
11624
|
+
function N(t) {
|
|
11147
11625
|
t({
|
|
11148
|
-
onCalc:
|
|
11149
|
-
remoteDataUrl:
|
|
11150
|
-
setProviderData:
|
|
11626
|
+
onCalc: A,
|
|
11627
|
+
remoteDataUrl: G,
|
|
11628
|
+
setProviderData: S
|
|
11151
11629
|
});
|
|
11152
11630
|
}
|
|
11153
11631
|
function Q() {
|
|
11154
|
-
return
|
|
11632
|
+
return b;
|
|
11155
11633
|
}
|
|
11156
|
-
function
|
|
11157
|
-
|
|
11158
|
-
const i = e.toLowerCase().trim(), o = a?.provider ??
|
|
11634
|
+
function O(t, e, a) {
|
|
11635
|
+
f?.();
|
|
11636
|
+
const i = e.toLowerCase().trim(), o = a?.provider ?? y(g, { modelId: i, providerApiUrl: a?.providerApiUrl, providerId: a?.providerId });
|
|
11159
11637
|
if (!o) return null;
|
|
11160
|
-
const m =
|
|
11638
|
+
const m = T(o.models, i);
|
|
11161
11639
|
if (!m) return null;
|
|
11162
|
-
const r = a?.timestamp ?? /* @__PURE__ */ new Date(), s =
|
|
11640
|
+
const r = a?.timestamp ?? /* @__PURE__ */ new Date(), s = P(m, r), n = I(t, s);
|
|
11163
11641
|
return {
|
|
11164
11642
|
auto_update_timestamp: void 0,
|
|
11165
11643
|
model: m,
|
|
@@ -11168,10 +11646,10 @@ function N(t, e, a) {
|
|
|
11168
11646
|
...n
|
|
11169
11647
|
};
|
|
11170
11648
|
}
|
|
11171
|
-
function
|
|
11172
|
-
return
|
|
11649
|
+
function E(t) {
|
|
11650
|
+
return f?.(), y(g, t);
|
|
11173
11651
|
}
|
|
11174
|
-
function
|
|
11652
|
+
function D(t, e, a) {
|
|
11175
11653
|
if (a = a ?? "default", !t.extractors)
|
|
11176
11654
|
throw new Error("No extraction logic defined for this provider");
|
|
11177
11655
|
const i = t.extractors.find((n) => n.api_flavor === a);
|
|
@@ -11179,11 +11657,11 @@ function O(t, e, a) {
|
|
|
11179
11657
|
const n = t.extractors.map((u) => u.api_flavor).join(", ");
|
|
11180
11658
|
throw new Error(`Unknown apiFlavor '${a}', allowed values: ${n}`);
|
|
11181
11659
|
}
|
|
11182
|
-
if (!
|
|
11660
|
+
if (!_.guard(e))
|
|
11183
11661
|
throw new Error(`Expected response data to be a mapping object, got ${c(e)}`);
|
|
11184
|
-
const o =
|
|
11662
|
+
const o = q(i.model_path, e, C, !1, []), m = B(i.root), r = q(m, e, _, !0, []), s = {};
|
|
11185
11663
|
for (const n of i.mappings) {
|
|
11186
|
-
const u =
|
|
11664
|
+
const u = q(n.path, r, z, n.required, m);
|
|
11187
11665
|
if (u !== null) {
|
|
11188
11666
|
const p = s[n.dest] ?? 0;
|
|
11189
11667
|
s[n.dest] = p + u;
|
|
@@ -11193,8 +11671,8 @@ function O(t, e, a) {
|
|
|
11193
11671
|
throw new Error(`No usage information found at ${JSON.stringify(i.root)}`);
|
|
11194
11672
|
return { model: o, usage: s };
|
|
11195
11673
|
}
|
|
11196
|
-
function
|
|
11197
|
-
const [m, ...r] =
|
|
11674
|
+
function q(t, e, a, i, o) {
|
|
11675
|
+
const [m, ...r] = B(t).reverse();
|
|
11198
11676
|
if (typeof m != "string")
|
|
11199
11677
|
throw new Error(`Expected last step of path to be a string, got ${c(m)}`);
|
|
11200
11678
|
r.reverse();
|
|
@@ -11203,22 +11681,31 @@ function g(t, e, a, i, o) {
|
|
|
11203
11681
|
for (const p of r) {
|
|
11204
11682
|
if (n.push(p), typeof p == "object")
|
|
11205
11683
|
if (Array.isArray(s))
|
|
11206
|
-
s =
|
|
11207
|
-
else
|
|
11208
|
-
|
|
11209
|
-
|
|
11684
|
+
s = R(p, s);
|
|
11685
|
+
else {
|
|
11686
|
+
if (i)
|
|
11687
|
+
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${c(s)}`);
|
|
11688
|
+
return null;
|
|
11689
|
+
}
|
|
11690
|
+
else if (_.guard(s))
|
|
11210
11691
|
s = s[p];
|
|
11211
|
-
else
|
|
11212
|
-
|
|
11692
|
+
else {
|
|
11693
|
+
if (i)
|
|
11694
|
+
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${c(s)}`);
|
|
11695
|
+
return null;
|
|
11696
|
+
}
|
|
11213
11697
|
if (typeof s > "u")
|
|
11214
11698
|
if (i) {
|
|
11215
|
-
const
|
|
11216
|
-
throw new Error(`${
|
|
11699
|
+
const k = typeof p == "object" ? "Unable to find item" : "Missing value";
|
|
11700
|
+
throw new Error(`${k} at \`${d(o, n)}\``);
|
|
11217
11701
|
} else
|
|
11218
11702
|
return null;
|
|
11219
11703
|
}
|
|
11220
|
-
if (!
|
|
11221
|
-
|
|
11704
|
+
if (!_.guard(s)) {
|
|
11705
|
+
if (i)
|
|
11706
|
+
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${c(s)}`);
|
|
11707
|
+
return null;
|
|
11708
|
+
}
|
|
11222
11709
|
const u = s[m];
|
|
11223
11710
|
if (typeof u > "u") {
|
|
11224
11711
|
if (i)
|
|
@@ -11227,37 +11714,39 @@ function g(t, e, a, i, o) {
|
|
|
11227
11714
|
}
|
|
11228
11715
|
if (a.guard(u))
|
|
11229
11716
|
return u;
|
|
11230
|
-
|
|
11717
|
+
if (i)
|
|
11718
|
+
throw n.push(m), new Error(`Expected \`${d(o, n)}\` value to be a ${a.name}, got ${c(u)}`);
|
|
11719
|
+
return null;
|
|
11231
11720
|
}
|
|
11232
|
-
function
|
|
11721
|
+
function R(t, e) {
|
|
11233
11722
|
for (const a of e)
|
|
11234
|
-
if (
|
|
11723
|
+
if (_.guard(a)) {
|
|
11235
11724
|
const i = a[t.field];
|
|
11236
11725
|
if (typeof i == "string" && h(t.match, i))
|
|
11237
11726
|
return a;
|
|
11238
11727
|
}
|
|
11239
11728
|
}
|
|
11240
|
-
function
|
|
11729
|
+
function B(t) {
|
|
11241
11730
|
return Array.isArray(t) ? [...t] : [t];
|
|
11242
11731
|
}
|
|
11243
11732
|
function c(t) {
|
|
11244
11733
|
return t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "mapping" : typeof t;
|
|
11245
11734
|
}
|
|
11246
|
-
const
|
|
11735
|
+
const _ = {
|
|
11247
11736
|
guard: (t) => c(t) === "mapping",
|
|
11248
11737
|
name: "mapping"
|
|
11249
|
-
},
|
|
11738
|
+
}, C = {
|
|
11250
11739
|
guard: (t) => typeof t == "string",
|
|
11251
11740
|
name: "string"
|
|
11252
|
-
},
|
|
11741
|
+
}, z = {
|
|
11253
11742
|
guard: (t) => typeof t == "number",
|
|
11254
11743
|
name: "number"
|
|
11255
|
-
}, d = (t, e) => [...t.map(
|
|
11744
|
+
}, d = (t, e) => [...t.map(v), ...e.map(v)].join("."), v = (t) => typeof t == "string" ? t : JSON.stringify(t);
|
|
11256
11745
|
export {
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11746
|
+
G as REMOTE_DATA_JSON_URL,
|
|
11747
|
+
O as calcPrice,
|
|
11748
|
+
D as extractUsage,
|
|
11749
|
+
E as findProvider,
|
|
11750
|
+
N as updatePrices,
|
|
11262
11751
|
Q as waitForUpdate
|
|
11263
11752
|
};
|