@pydantic/genai-prices 0.0.21 → 0.0.23

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const b = [
1
+ const f = [
2
2
  {
3
3
  id: "anthropic",
4
4
  name: "Anthropic",
@@ -7,6 +7,9 @@ const b = [
7
7
  model_match: {
8
8
  contains: "claude"
9
9
  },
10
+ provider_match: {
11
+ contains: "anthropic"
12
+ },
10
13
  extractors: [
11
14
  {
12
15
  api_flavor: "default",
@@ -18,6 +21,16 @@ const b = [
18
21
  dest: "input_tokens",
19
22
  required: !0
20
23
  },
24
+ {
25
+ path: "cache_creation_input_tokens",
26
+ dest: "input_tokens",
27
+ required: !1
28
+ },
29
+ {
30
+ path: "cache_read_input_tokens",
31
+ dest: "input_tokens",
32
+ required: !1
33
+ },
21
34
  {
22
35
  path: "cache_creation_input_tokens",
23
36
  dest: "cache_write_tokens",
@@ -113,6 +126,12 @@ const b = [
113
126
  },
114
127
  {
115
128
  starts_with: "claude-3.7-sonnet"
129
+ },
130
+ {
131
+ starts_with: "claude-sonnet-3.7"
132
+ },
133
+ {
134
+ starts_with: "claude-sonnet-3-7"
116
135
  }
117
136
  ]
118
137
  },
@@ -176,10 +195,13 @@ const b = [
176
195
  match: {
177
196
  or: [
178
197
  {
179
- starts_with: "claude-opus-4"
198
+ starts_with: "claude-opus-4-0"
199
+ },
200
+ {
201
+ starts_with: "claude-4-opus"
180
202
  },
181
203
  {
182
- starts_with: "claude-4-opus-20250522"
204
+ equals: "claude-opus-4-20250514"
183
205
  }
184
206
  ]
185
207
  },
@@ -196,14 +218,7 @@ const b = [
196
218
  name: "Claude Opus 4.1",
197
219
  description: "Most intelligent model for complex tasks",
198
220
  match: {
199
- or: [
200
- {
201
- starts_with: "claude-opus-4"
202
- },
203
- {
204
- starts_with: "claude-4-opus-20250522"
205
- }
206
- ]
221
+ starts_with: "claude-opus-4-1"
207
222
  },
208
223
  context_window: 2e5,
209
224
  prices: {
@@ -223,7 +238,7 @@ const b = [
223
238
  starts_with: "claude-sonnet-4"
224
239
  },
225
240
  {
226
- starts_with: "claude-4-sonnet-20250522"
241
+ starts_with: "claude-4-sonnet"
227
242
  }
228
243
  ]
229
244
  },
@@ -290,6 +305,9 @@ const b = [
290
305
  name: "AWS Bedrock",
291
306
  pricing_urls: ["https://aws.amazon.com/bedrock/pricing/"],
292
307
  api_pattern: "https://bedrock-runtime\\.[a-z0-9-]+\\.amazonaws\\.com/",
308
+ provider_match: {
309
+ contains: "bedrock"
310
+ },
293
311
  models: [
294
312
  {
295
313
  id: "meta.llama3-8b-instruct-v1%3A0",
@@ -1118,6 +1136,9 @@ const b = [
1118
1136
  model_match: {
1119
1137
  starts_with: "command-"
1120
1138
  },
1139
+ provider_match: {
1140
+ contains: "cohere"
1141
+ },
1121
1142
  extractors: [
1122
1143
  {
1123
1144
  api_flavor: "default",
@@ -1156,7 +1177,7 @@ const b = [
1156
1177
  description: `Command A is an open-weights 111B parameter model with a 256k context window focused on delivering great performance across agentic, multilingual, and coding use cases.
1157
1178
  Compared to other leading proprietary and open-weights models Command A delivers maximum performance with minimum hardware costs, excelling on business-critical agentic and multilingual tasks.`,
1158
1179
  match: {
1159
- equals: "command-a"
1180
+ starts_with: "command-a"
1160
1181
  },
1161
1182
  prices: {
1162
1183
  input_mtok: 2.5,
@@ -1488,7 +1509,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
1488
1509
  contains: "google"
1489
1510
  },
1490
1511
  {
1491
- equals: "gemini"
1512
+ contains: "vertex"
1513
+ },
1514
+ {
1515
+ contains: "gemini"
1492
1516
  }
1493
1517
  ]
1494
1518
  },
@@ -1756,7 +1780,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
1756
1780
  name: "Gemini 2.5 Flash",
1757
1781
  description: `Gemini 2.5 Flash is Google's state-of-the-art workhorse model, specifically designed for advanced reasoning, coding, mathematics, and scientific tasks. It includes built-in "thinking" capabilities, enabling it to provide responses with greater accuracy and nuanced context handling.`,
1758
1782
  match: {
1759
- equals: "gemini-2.5-flash"
1783
+ or: [
1784
+ {
1785
+ equals: "gemini-2.5-flash"
1786
+ },
1787
+ {
1788
+ equals: "gemini-2.5-flash-latest"
1789
+ }
1790
+ ]
1760
1791
  },
1761
1792
  prices: {
1762
1793
  input_mtok: 0.3,
@@ -1994,108 +2025,31 @@ Compared to other leading proprietary and open-weights models Command A delivers
1994
2025
  }
1995
2026
  },
1996
2027
  {
1997
- id: "gemma-2-27b-it",
1998
- name: "Gemma 2 27B",
1999
- description: "Gemma 2 27B by Google is an open model built from the same research and technology used to create the Gemini models.",
2000
- match: {
2001
- equals: "gemma-2-27b-it"
2002
- },
2003
- prices: {
2004
- input_mtok: 0.8,
2005
- output_mtok: 0.8
2006
- }
2007
- },
2008
- {
2009
- id: "gemma-2-9b-it",
2010
- name: "Gemma 2 9B",
2011
- description: "Gemma 2 9B by Google is an advanced, open-source language model that sets a new standard for efficiency and performance in its size class.",
2028
+ id: "gemma-3",
2029
+ name: "Gemma 3 (free)",
2030
+ description: "Lightweight, state-of the art, open model built from the same technology that powers our Gemini models.",
2012
2031
  match: {
2013
- equals: "gemma-2-9b-it"
2014
- },
2015
- prices: {
2016
- input_mtok: 0.2,
2017
- output_mtok: 0.2
2018
- }
2019
- },
2020
- {
2021
- id: "gemma-2-9b-it:free",
2022
- name: "Gemma 2 9B (free)",
2023
- description: "Gemma 2 9B by Google is an advanced, open-source language model that sets a new standard for efficiency and performance in its size class.",
2024
- match: {
2025
- equals: "gemma-2-9b-it:free"
2026
- },
2027
- prices: {}
2028
- },
2029
- {
2030
- id: "gemma-3-12b-it",
2031
- name: "Gemma 3 12B",
2032
- description: "Gemma 3 introduces multimodality, supporting vision-language input and text outputs. It handles context windows up to 128k tokens, understands over 140 languages, and offers improved math, reasoning, and chat capabilities, including structured outputs and function calling. Gemma 3 12B is the second largest in the family of Gemma 3 models after Gemma 3 27B",
2033
- match: {
2034
- equals: "gemma-3-12b-it"
2035
- },
2036
- prices: {
2037
- input_mtok: 0.05,
2038
- output_mtok: 0.1
2039
- }
2040
- },
2041
- {
2042
- id: "gemma-3-12b-it:free",
2043
- name: "Gemma 3 12B (free)",
2044
- description: "Gemma 3 introduces multimodality, supporting vision-language input and text outputs. It handles context windows up to 128k tokens, understands over 140 languages, and offers improved math, reasoning, and chat capabilities, including structured outputs and function calling. Gemma 3 12B is the second largest in the family of Gemma 3 models after Gemma 3 27B",
2045
- match: {
2046
- equals: "gemma-3-12b-it:free"
2047
- },
2048
- prices: {}
2049
- },
2050
- {
2051
- id: "gemma-3-27b-it",
2052
- name: "Gemma 3 27B",
2053
- description: "Gemma 3 introduces multimodality, supporting vision-language input and text outputs. It handles context windows up to 128k tokens, understands over 140 languages, and offers improved math, reasoning, and chat capabilities, including structured outputs and function calling. Gemma 3 27B is Google's latest open source model, successor to Gemma 2",
2054
- match: {
2055
- equals: "gemma-3-27b-it"
2056
- },
2057
- price_comments: "I can't find anything so trusting these prices, not sure the model still exists on Vertex or GCP",
2058
- prices: {
2059
- input_mtok: 0.1,
2060
- output_mtok: 0.2
2061
- }
2062
- },
2063
- {
2064
- id: "gemma-3-27b-it:free",
2065
- name: "Gemma 3 27B (free)",
2066
- description: "Gemma 3 introduces multimodality, supporting vision-language input and text outputs. It handles context windows up to 128k tokens, understands over 140 languages, and offers improved math, reasoning, and chat capabilities, including structured outputs and function calling. Gemma 3 27B is Google's latest open source model, successor to Gemma 2",
2067
- match: {
2068
- equals: "gemma-3-27b-it:free"
2069
- },
2070
- prices: {}
2071
- },
2072
- {
2073
- id: "gemma-3-4b-it",
2074
- name: "Gemma 3 4B",
2075
- description: "Gemma 3 introduces multimodality, supporting vision-language input and text outputs. It handles context windows up to 128k tokens, understands over 140 languages, and offers improved math, reasoning, and chat capabilities, including structured outputs and function calling.",
2076
- match: {
2077
- equals: "gemma-3-4b-it"
2078
- },
2079
- prices: {
2080
- input_mtok: 0.02,
2081
- output_mtok: 0.04
2082
- }
2083
- },
2084
- {
2085
- id: "gemma-3-4b-it:free",
2086
- name: "Gemma 3 4B (free)",
2087
- description: "Gemma 3 introduces multimodality, supporting vision-language input and text outputs. It handles context windows up to 128k tokens, understands over 140 languages, and offers improved math, reasoning, and chat capabilities, including structured outputs and function calling.",
2088
- match: {
2089
- equals: "gemma-3-4b-it:free"
2032
+ or: [
2033
+ {
2034
+ starts_with: "gemma-3-"
2035
+ },
2036
+ {
2037
+ equals: "gemma-3"
2038
+ }
2039
+ ]
2090
2040
  },
2091
2041
  prices: {}
2092
2042
  },
2093
2043
  {
2094
- id: "gemma-3n-e4b-it:free",
2095
- name: "Gemma 3n 4B (free)",
2096
- description: "Gemma 3n E4B-it is optimized for efficient execution on mobile and low-resource devices, such as phones, laptops, and tablets. It supports multimodal inputs—including text, visual data, and audio—enabling diverse tasks such as text generation, speech recognition, translation, and image analysis. Leveraging innovations like Per-Layer Embedding (PLE) caching and the MatFormer architecture, Gemma 3n dynamically manages memory usage and computational load by selectively activating model parameters, significantly reducing runtime resource requirements.",
2044
+ id: "gemma-3n",
2045
+ name: "Gemma 3n (free)",
2046
+ description: "Our open model built for efficient performance on everyday devices like mobile phones, laptops, and tablets.",
2097
2047
  match: {
2098
- equals: "gemma-3n-e4b-it:free"
2048
+ or: [
2049
+ {
2050
+ starts_with: "gemma-3n"
2051
+ }
2052
+ ]
2099
2053
  },
2100
2054
  prices: {}
2101
2055
  }
@@ -2127,25 +2081,57 @@ Compared to other leading proprietary and open-weights models Command A delivers
2127
2081
  ],
2128
2082
  models: [
2129
2083
  {
2130
- id: "gemma-7b-it",
2084
+ id: "deepseek-r1-distill-llama-70b",
2085
+ name: "DeepSeek R1 Distill Llama 70B",
2131
2086
  match: {
2132
- equals: "gemma-7b-it"
2087
+ equals: "deepseek-r1-distill-llama-70b"
2133
2088
  },
2089
+ context_window: 131072,
2134
2090
  prices: {
2135
- input_mtok: 0.07,
2136
- output_mtok: 0.07
2091
+ input_mtok: 0.75,
2092
+ output_mtok: 0.99
2137
2093
  }
2138
2094
  },
2139
2095
  {
2140
2096
  id: "gemma2-9b-it",
2097
+ name: "Gemma 2 9B 8k",
2141
2098
  match: {
2142
- equals: "gemma2-9b-it"
2099
+ or: [
2100
+ {
2101
+ equals: "gemma2-9b-it"
2102
+ },
2103
+ {
2104
+ equals: "gemma2-9b"
2105
+ }
2106
+ ]
2143
2107
  },
2144
2108
  prices: {
2145
2109
  input_mtok: 0.2,
2146
2110
  output_mtok: 0.2
2147
2111
  }
2148
2112
  },
2113
+ {
2114
+ id: "llama-3.1-8b-instant",
2115
+ name: "Llama 3.1 8B Instant 128k",
2116
+ match: {
2117
+ equals: "llama-3.1-8b-instant"
2118
+ },
2119
+ prices: {
2120
+ input_mtok: 0.05,
2121
+ output_mtok: 0.08
2122
+ }
2123
+ },
2124
+ {
2125
+ id: "llama-3.3-70b-versatile",
2126
+ name: "Llama 3.3 70B Versatile 128k",
2127
+ match: {
2128
+ equals: "llama-3.3-70b-versatile"
2129
+ },
2130
+ prices: {
2131
+ input_mtok: 0.59,
2132
+ output_mtok: 0.79
2133
+ }
2134
+ },
2149
2135
  {
2150
2136
  id: "llama2-70b-4096",
2151
2137
  match: {
@@ -2197,13 +2183,50 @@ Compared to other leading proprietary and open-weights models Command A delivers
2197
2183
  }
2198
2184
  },
2199
2185
  {
2200
- id: "mixtral-8x7b-32768",
2186
+ id: "meta-llama/llama-4-maverick-17b-128e-instruct",
2187
+ name: "Llama 4 Maverick 17B 128E",
2201
2188
  match: {
2202
- equals: "mixtral-8x7b-32768"
2189
+ equals: "meta-llama/llama-4-maverick-17b-128e-instruct"
2203
2190
  },
2191
+ context_window: 131072,
2204
2192
  prices: {
2205
- input_mtok: 0.24,
2206
- output_mtok: 0.24
2193
+ input_mtok: 0.2,
2194
+ output_mtok: 0.6
2195
+ }
2196
+ },
2197
+ {
2198
+ id: "meta-llama/llama-4-scout-17b-16e-instruct",
2199
+ name: "Llama 4 Scout (17Bx16E) 128k",
2200
+ match: {
2201
+ equals: "meta-llama/llama-4-scout-17b-16e-instruct"
2202
+ },
2203
+ prices: {
2204
+ input_mtok: 0.11,
2205
+ output_mtok: 0.34
2206
+ }
2207
+ },
2208
+ {
2209
+ id: "meta-llama/llama-guard-4-12b",
2210
+ name: "Llama Guard 4 12B",
2211
+ match: {
2212
+ equals: "meta-llama/llama-guard-4-12b"
2213
+ },
2214
+ context_window: 131072,
2215
+ prices: {
2216
+ input_mtok: 0.2,
2217
+ output_mtok: 0.2
2218
+ }
2219
+ },
2220
+ {
2221
+ id: "moonshotai/kimi-k2-instruct",
2222
+ name: "Kimi K2 1T 128k",
2223
+ match: {
2224
+ equals: "moonshotai/kimi-k2-instruct"
2225
+ },
2226
+ context_window: 131072,
2227
+ prices: {
2228
+ input_mtok: 1,
2229
+ output_mtok: 3
2207
2230
  }
2208
2231
  },
2209
2232
  {
@@ -2233,6 +2256,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
2233
2256
  input_mtok: 0.1,
2234
2257
  output_mtok: 0.5
2235
2258
  }
2259
+ },
2260
+ {
2261
+ id: "qwen/qwen3-32b",
2262
+ name: "Qwen3 32B 131k",
2263
+ match: {
2264
+ equals: "qwen/qwen3-32b"
2265
+ },
2266
+ prices: {
2267
+ input_mtok: 0.29,
2268
+ output_mtok: 0.59
2269
+ }
2236
2270
  }
2237
2271
  ]
2238
2272
  },
@@ -2308,16 +2342,13 @@ Compared to other leading proprietary and open-weights models Command A delivers
2308
2342
  prices: {}
2309
2343
  },
2310
2344
  {
2311
- id: "magistral-medium-2506",
2312
- name: "Magistral Medium 2506",
2345
+ id: "magistral-medium",
2346
+ name: "Magistral Medium",
2313
2347
  description: "Magistral is Mistral's first reasoning model. It is ideal for general purpose use requiring longer thought processing and better accuracy than with non-reasoning LLMs. From legal research and financial forecasting to software development and creative storytelling — this model solves multi-step challenges where transparency and precision are critical.",
2314
2348
  match: {
2315
2349
  or: [
2316
2350
  {
2317
- equals: "magistral-medium-2506"
2318
- },
2319
- {
2320
- equals: "magistral-medium-2506:thinking"
2351
+ starts_with: "magistral-medium"
2321
2352
  }
2322
2353
  ]
2323
2354
  },
@@ -2327,11 +2358,11 @@ Compared to other leading proprietary and open-weights models Command A delivers
2327
2358
  }
2328
2359
  },
2329
2360
  {
2330
- id: "magistral-small-2506",
2331
- name: "Magistral Small 2506",
2361
+ id: "magistral-small",
2362
+ name: "Magistral Small",
2332
2363
  description: "Magistral Small is a 24B parameter instruction-tuned model based on Mistral-Small-3.1 (2503), enhanced through supervised fine-tuning on traces from Magistral Medium and further refined via reinforcement learning. It is optimized for reasoning and supports a wide multilingual range, including over 20 languages.",
2333
2364
  match: {
2334
- equals: "magistral-small-2506"
2365
+ starts_with: "magistral-small-"
2335
2366
  },
2336
2367
  prices: {
2337
2368
  input_mtok: 0.5,
@@ -2352,68 +2383,34 @@ Compared to other leading proprietary and open-weights models Command A delivers
2352
2383
  },
2353
2384
  {
2354
2385
  id: "ministral-8b",
2355
- name: "Ministral 8B",
2386
+ name: "Ministral 8B 24.10",
2356
2387
  description: "Ministral 8B is an 8B parameter model featuring a unique interleaved sliding-window attention pattern for faster, memory-efficient inference. Designed for edge use cases, it supports up to 128k context length and excels in knowledge and reasoning tasks. It outperforms peers in the sub-10B category, making it perfect for low-latency, privacy-first applications.",
2357
2388
  match: {
2358
- equals: "ministral-8b"
2389
+ starts_with: "ministral-8b"
2359
2390
  },
2360
2391
  prices: {
2361
2392
  input_mtok: 0.1,
2362
- output_mtok: 0.1
2393
+ output_mtok: 1
2363
2394
  }
2364
2395
  },
2365
2396
  {
2366
- id: "mistral-7b-instruct",
2367
- name: "Mistral 7B Instruct",
2368
- description: "A high-performing, industry-standard 7.3B parameter model, with optimizations for speed and context length.",
2397
+ id: "mistral-7b",
2398
+ name: "Mistral 7B",
2369
2399
  match: {
2370
2400
  or: [
2371
2401
  {
2372
- equals: "mistral-7b-instruct"
2402
+ equals: "mistral-7b"
2373
2403
  },
2374
2404
  {
2375
- equals: "mistral-7b-instruct-v0.3"
2405
+ equals: "open-mistral-7b"
2376
2406
  }
2377
2407
  ]
2378
2408
  },
2379
2409
  prices: {
2380
- input_mtok: 0.028,
2381
- output_mtok: 0.054
2382
- }
2383
- },
2384
- {
2385
- id: "mistral-7b-instruct-v0.1",
2386
- name: "Mistral 7B Instruct v0.1",
2387
- description: "A 7.3B parameter model that outperforms Llama 2 13B on all benchmarks, with optimizations for speed and context length.",
2388
- match: {
2389
- equals: "mistral-7b-instruct-v0.1"
2390
- },
2391
- prices: {
2392
- input_mtok: 0.11,
2393
- output_mtok: 0.19
2394
- }
2395
- },
2396
- {
2397
- id: "mistral-7b-instruct-v0.2",
2398
- name: "Mistral 7B Instruct v0.2",
2399
- description: "A high-performing, industry-standard 7.3B parameter model, with optimizations for speed and context length.",
2400
- match: {
2401
- equals: "mistral-7b-instruct-v0.2"
2402
- },
2403
- prices: {
2404
- input_mtok: 0.2,
2405
- output_mtok: 0.2
2410
+ input_mtok: 0.25,
2411
+ output_mtok: 0.25
2406
2412
  }
2407
2413
  },
2408
- {
2409
- id: "mistral-7b-instruct:free",
2410
- name: "Mistral 7B Instruct (free)",
2411
- description: "A high-performing, industry-standard 7.3B parameter model, with optimizations for speed and context length.",
2412
- match: {
2413
- equals: "mistral-7b-instruct:free"
2414
- },
2415
- prices: {}
2416
- },
2417
2414
  {
2418
2415
  id: "mistral-embed",
2419
2416
  match: {
@@ -2454,14 +2451,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
2454
2451
  name: "Mistral Medium 3",
2455
2452
  description: "Mistral Medium 3 is a high-performance enterprise-grade language model designed to deliver frontier-level capabilities at significantly reduced operational cost. It balances state-of-the-art reasoning and multimodal performance with 8× lower cost compared to traditional large models, making it suitable for scalable deployments across professional and industrial use cases.",
2456
2453
  match: {
2457
- or: [
2458
- {
2459
- equals: "mistral-medium-3"
2460
- },
2461
- {
2462
- equals: "mistral-medium-latest"
2463
- }
2464
- ]
2454
+ starts_with: "mistral-medium"
2465
2455
  },
2466
2456
  prices: {
2467
2457
  input_mtok: 0.4,
@@ -2473,7 +2463,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
2473
2463
  name: "Mistral NeMo",
2474
2464
  description: "A 12B parameter model with a 128k token context length built by Mistral in collaboration with NVIDIA.",
2475
2465
  match: {
2476
- equals: "mistral-nemo"
2466
+ or: [
2467
+ {
2468
+ equals: "mistral-nemo"
2469
+ },
2470
+ {
2471
+ equals: "open-mistral-nemo"
2472
+ }
2473
+ ]
2477
2474
  },
2478
2475
  prices: {
2479
2476
  input_mtok: 0.15,
@@ -2513,7 +2510,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
2513
2510
  name: "Mistral Small",
2514
2511
  description: "With 22 billion parameters, Mistral Small v24.09 offers a convenient mid-point between (Mistral NeMo 12B)[/mistralai/mistral-nemo] and (Mistral Large 2)[/mistralai/mistral-large], providing a cost-effective solution that can be deployed across various platforms and environments. It has better reasoning, exhibits more capabilities, can produce and reason about code, and is multiligual, supporting English, French, German, Italian, and Spanish.",
2515
2512
  match: {
2516
- equals: "mistral-small"
2513
+ starts_with: "mistral-small"
2517
2514
  },
2518
2515
  prices: {
2519
2516
  input_mtok: 0.2,
@@ -2582,31 +2579,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
2582
2579
  }
2583
2580
  },
2584
2581
  {
2585
- id: "mixtral-8x7b-instruct",
2586
- name: "Mixtral 8x7B Instruct",
2587
- description: "Mixtral 8x7B Instruct is a pretrained generative Sparse Mixture of Experts, by Mistral AI, for chat and instruction use. Incorporates 8 experts (feed-forward networks) for a total of 47 billion parameters.",
2582
+ id: "mixtral-8x7b",
2583
+ name: "Mixtral 8x7B",
2588
2584
  match: {
2589
- equals: "mixtral-8x7b-instruct"
2590
- },
2591
- prices: {
2592
- input_mtok: 0.08,
2593
- output_mtok: 0.24
2594
- }
2595
- },
2596
- {
2597
- id: "open-mistral-7b",
2598
- match: {
2599
- equals: "open-mistral-7b"
2600
- },
2601
- prices: {
2602
- input_mtok: 0.25,
2603
- output_mtok: 0.25
2604
- }
2605
- },
2606
- {
2607
- id: "open-mixtral-8x7b",
2608
- match: {
2609
- equals: "open-mixtral-8x7b"
2585
+ or: [
2586
+ {
2587
+ starts_with: "mixtral-8x7b"
2588
+ },
2589
+ {
2590
+ equals: "open-mixtral-8x7b"
2591
+ }
2592
+ ]
2610
2593
  },
2611
2594
  prices: {
2612
2595
  input_mtok: 0.7,
@@ -3028,6 +3011,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
3028
3011
  }
3029
3012
  ]
3030
3013
  },
3014
+ provider_match: {
3015
+ contains: "openai"
3016
+ },
3031
3017
  extractors: [
3032
3018
  {
3033
3019
  api_flavor: "chat",
@@ -3637,7 +3623,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
3637
3623
  equals: "gpt-5-nano"
3638
3624
  },
3639
3625
  {
3640
- equals: "gpt-5-nano-2025-04-14"
3626
+ starts_with: "gpt-5-nano-"
3641
3627
  }
3642
3628
  ]
3643
3629
  },
@@ -9868,6 +9854,16 @@ Compared to other leading proprietary and open-weights models Command A delivers
9868
9854
  name: "Together AI",
9869
9855
  pricing_urls: ["https://www.together.ai/pricing"],
9870
9856
  api_pattern: "https://api\\.together\\.xyz",
9857
+ provider_match: {
9858
+ or: [
9859
+ {
9860
+ equals: "together-ai"
9861
+ },
9862
+ {
9863
+ equals: "together_ai"
9864
+ }
9865
+ ]
9866
+ },
9871
9867
  models: [
9872
9868
  {
9873
9869
  id: "Austism/chronos-hermes-13b",
@@ -10658,6 +10654,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
10658
10654
  model_match: {
10659
10655
  contains: "grok"
10660
10656
  },
10657
+ provider_match: {
10658
+ equals: "xai"
10659
+ },
10661
10660
  extractors: [
10662
10661
  {
10663
10662
  api_flavor: "chat",
@@ -10857,23 +10856,23 @@ Compared to other leading proprietary and open-weights models Command A delivers
10857
10856
  ]
10858
10857
  }
10859
10858
  ];
10860
- function v(t, e) {
10859
+ function x(t, e) {
10861
10860
  if (e <= 0) return 0;
10862
10861
  let a = 0;
10863
- const i = [...t.tiers].sort((n, s) => n.start - s.start), o = i[0]?.start ?? e, m = Math.min(e, o);
10862
+ const i = [...t.tiers].sort((r, s) => r.start - s.start), o = i[0]?.start ?? e, m = Math.min(e, o);
10864
10863
  a += m * t.base / 1e6;
10865
- for (let n = 0; n < i.length; n++) {
10866
- const s = i[n], r = i[n + 1]?.start ?? 1 / 0, u = Math.max(0, Math.min(e, r) - s.start);
10864
+ for (let r = 0; r < i.length; r++) {
10865
+ const s = i[r], n = i[r + 1]?.start ?? 1 / 0, u = Math.max(0, Math.min(e, n) - s.start);
10867
10866
  u > 0 && (a += u * s.price / 1e6);
10868
10867
  }
10869
10868
  return a;
10870
10869
  }
10871
- function p(t, e, a) {
10872
- return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : v(t, e);
10870
+ function l(t, e, a) {
10871
+ return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : x(t, e);
10873
10872
  }
10874
- function x(t, e) {
10873
+ function B(t, e) {
10875
10874
  let a = 0, i = 0;
10876
- a += p(e.input_mtok, t.input_tokens), a += p(e.cache_write_mtok, t.cache_write_tokens), a += p(e.cache_read_mtok, t.cache_read_tokens), a += p(e.input_audio_mtok, t.input_audio_tokens), a += p(e.cache_audio_read_mtok, t.cache_audio_read_tokens), i += p(e.output_mtok, t.output_tokens), i += p(e.output_audio_mtok, t.output_audio_tokens), e.requests_kcount !== void 0 && (a += e.requests_kcount / 1e3);
10875
+ a += l(e.input_mtok, t.input_tokens), a += l(e.cache_write_mtok, t.cache_write_tokens), a += l(e.cache_read_mtok, t.cache_read_tokens), a += l(e.input_audio_mtok, t.input_audio_tokens), a += l(e.cache_audio_read_mtok, t.cache_audio_read_tokens), i += l(e.output_mtok, t.output_tokens), i += l(e.output_audio_mtok, t.output_audio_tokens), e.requests_kcount !== void 0 && (a += e.requests_kcount / 1e3);
10877
10876
  const o = a + i;
10878
10877
  return {
10879
10878
  input_price: a,
@@ -10881,7 +10880,7 @@ function x(t, e) {
10881
10880
  total_price: o
10882
10881
  };
10883
10882
  }
10884
- function B(t, e) {
10883
+ function y(t, e) {
10885
10884
  if (!Array.isArray(t.prices))
10886
10885
  return t.prices;
10887
10886
  for (let a = t.prices.length - 1; a >= 0; a--) {
@@ -10892,11 +10891,11 @@ function B(t, e) {
10892
10891
  if (e >= new Date(o.start_date))
10893
10892
  return i.prices;
10894
10893
  } else {
10895
- const m = e.toISOString().slice(11, 19), n = o.start_time, s = o.end_time;
10896
- if (s < n) {
10897
- if (m >= n || m < s)
10894
+ const m = e.toISOString().slice(11, 19), r = o.start_time, s = o.end_time;
10895
+ if (s < r) {
10896
+ if (m >= r || m < s)
10898
10897
  return i.prices;
10899
- } else if (m >= n && m < s)
10898
+ } else if (m >= r && m < s)
10900
10899
  return i.prices;
10901
10900
  }
10902
10901
  }
@@ -10905,118 +10904,126 @@ function B(t, e) {
10905
10904
  function d(t, e) {
10906
10905
  return "or" in t ? t.or.some((a) => d(a, e)) : "and" in t ? t.and.every((a) => d(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;
10907
10906
  }
10908
- function y(t, e) {
10907
+ function M(t, e) {
10909
10908
  const a = e.toLowerCase().trim(), i = t.find((o) => o.id === a);
10910
10909
  return i || t.find((o) => o.provider_match && d(o.provider_match, a));
10911
10910
  }
10912
- function M(t, e, a, i) {
10913
- return a ? y(t, a) : i ? t.find((o) => new RegExp(o.api_pattern).test(i)) : t.find((o) => o.model_match && d(o.model_match, e));
10911
+ function w(t, { modelId: e, providerApiUrl: a, providerId: i }) {
10912
+ if (i)
10913
+ return M(t, i);
10914
+ if (a)
10915
+ return t.find((o) => new RegExp(o.api_pattern).test(a));
10916
+ if (e)
10917
+ return t.find((o) => o.model_match && d(o.model_match, e));
10914
10918
  }
10915
10919
  function I(t, e) {
10916
10920
  return t.find((a) => d(a.match, e));
10917
10921
  }
10918
10922
  const P = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
10919
- let _ = b, g = Promise.resolve(b), f = null;
10923
+ let h = f, g = Promise.resolve(f), q = null;
10920
10924
  function L(t) {
10921
10925
  "then" in t ? (g = t, t.then((e) => {
10922
- _ = e;
10923
- })) : (g = Promise.resolve(t), _ = t);
10926
+ h = e;
10927
+ })) : (g = Promise.resolve(t), h = t);
10924
10928
  }
10925
- function G(t) {
10926
- f = t;
10929
+ function T(t) {
10930
+ q = t;
10927
10931
  }
10928
- function A(t) {
10932
+ function R(t) {
10929
10933
  t({
10930
- onCalc: G,
10934
+ onCalc: T,
10931
10935
  remoteDataUrl: P,
10932
10936
  setProviderData: L
10933
10937
  });
10934
10938
  }
10935
- function R() {
10939
+ function A() {
10936
10940
  return g;
10937
10941
  }
10938
10942
  function C(t, e, a) {
10939
- f?.();
10940
- const i = M(_, e, a?.providerId, a?.providerApiUrl);
10941
- if (!i) return null;
10942
- const o = I(i.models, e);
10943
+ q?.();
10944
+ const i = e.toLowerCase().trim(), o = a?.provider ?? w(h, { modelId: i, providerApiUrl: a?.providerApiUrl, providerId: a?.providerId });
10943
10945
  if (!o) return null;
10944
- const m = a?.timestamp ?? /* @__PURE__ */ new Date(), n = B(o, m), s = x(t, n);
10946
+ const m = I(o.models, i);
10947
+ if (!m) return null;
10948
+ const r = a?.timestamp ?? /* @__PURE__ */ new Date(), s = y(m, r), n = B(t, s);
10945
10949
  return {
10946
10950
  auto_update_timestamp: void 0,
10947
- model: o,
10948
- model_price: n,
10949
- provider: i,
10950
- ...s
10951
+ model: m,
10952
+ model_price: s,
10953
+ provider: o,
10954
+ ...n
10951
10955
  };
10952
10956
  }
10953
- function z(t, e, a) {
10957
+ function z(t) {
10958
+ return q?.(), w(h, t);
10959
+ }
10960
+ function N(t, e, a) {
10954
10961
  if (!t.extractors)
10955
10962
  throw new Error("No extraction logic defined for this provider");
10956
10963
  let i;
10957
10964
  if (a) {
10958
- const r = t.extractors.find((u) => u.api_flavor === a);
10959
- if (r)
10960
- i = r;
10965
+ const n = t.extractors.find((u) => u.api_flavor === a);
10966
+ if (n)
10967
+ i = n;
10961
10968
  else {
10962
- const u = t.extractors.map((l) => l.api_flavor).join(", ");
10969
+ const u = t.extractors.map((p) => p.api_flavor).join(", ");
10963
10970
  throw new Error(`Unknown apiFlavor '${a}', allowed values: ${u}`);
10964
10971
  }
10965
10972
  } else if (t.extractors.length === 1)
10966
10973
  i = t.extractors[0];
10967
10974
  else
10968
10975
  throw new Error("No apiFlavor specified and multiple extractors available");
10969
- if (!q.guard(e))
10976
+ if (!b.guard(e))
10970
10977
  throw new Error(`Expected response data to be a mapping object, got ${c(e)}`);
10971
- const o = k(i.model_path, e, T, !0, []), m = w(i.root), n = k(m, e, q, !0, []), s = {};
10972
- for (const r of i.mappings) {
10973
- const u = k(r.path, n, S, r.required, m);
10978
+ const o = _(i.model_path, e, G, !0, []), m = v(i.root), r = _(m, e, b, !0, []), s = {};
10979
+ for (const n of i.mappings) {
10980
+ const u = _(n.path, r, S, n.required, m);
10974
10981
  if (u !== null) {
10975
- const l = s[r.dest] ?? 0;
10976
- s[r.dest] = l + u;
10982
+ const p = s[n.dest] ?? 0;
10983
+ s[n.dest] = p + u;
10977
10984
  }
10978
10985
  }
10979
10986
  if (!Object.keys(s).length)
10980
10987
  throw new Error(`No usage information found at ${JSON.stringify(i.root)}`);
10981
10988
  return [o, s];
10982
10989
  }
10983
- function k(t, e, a, i, o) {
10984
- const [m, ...n] = w(t).reverse();
10990
+ function _(t, e, a, i, o) {
10991
+ const [m, ...r] = v(t).reverse();
10985
10992
  if (typeof m != "string")
10986
10993
  throw new Error(`Expected last step of path to be a string, got ${c(m)}`);
10987
10994
  let s = e;
10988
- n.reverse();
10989
- const r = [];
10990
- for (const l of n) {
10991
- r.push(l), s = s[l];
10992
- const h = c(s);
10993
- if (h === "undefined") {
10995
+ r.reverse();
10996
+ const n = [];
10997
+ for (const p of r) {
10998
+ n.push(p), s = s[p];
10999
+ const k = c(s);
11000
+ if (k === "undefined") {
10994
11001
  if (i)
10995
- throw new Error(`Missing value at \`${[...o, ...r].join(".")}\``);
11002
+ throw new Error(`Missing value at \`${[...o, ...n].join(".")}\``);
10996
11003
  return null;
10997
- } else if (h !== "mapping")
10998
- throw new Error(`Expected \`${[...o, ...r].join(".")}\` value to be a mapping, got ${h}`);
11004
+ } else if (k !== "mapping")
11005
+ throw new Error(`Expected \`${[...o, ...n].join(".")}\` value to be a mapping, got ${k}`);
10999
11006
  }
11000
11007
  const u = s[m];
11001
11008
  if (typeof u > "u") {
11002
11009
  if (i)
11003
- throw r.push(m), new Error(`Missing value at \`${[...o, ...r].join(".")}\``);
11010
+ throw n.push(m), new Error(`Missing value at \`${[...o, ...n].join(".")}\``);
11004
11011
  return null;
11005
11012
  }
11006
11013
  if (a.guard(u))
11007
11014
  return u;
11008
- throw r.push(m), new Error(`Expected \`${[...o, ...r].join(".")}\` value to be a ${a.name}, got ${c(u)}`);
11015
+ throw n.push(m), new Error(`Expected \`${[...o, ...n].join(".")}\` value to be a ${a.name}, got ${c(u)}`);
11009
11016
  }
11010
- function w(t) {
11017
+ function v(t) {
11011
11018
  return Array.isArray(t) ? [...t] : [t];
11012
11019
  }
11013
11020
  function c(t) {
11014
11021
  return t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "mapping" : typeof t;
11015
11022
  }
11016
- const q = {
11023
+ const b = {
11017
11024
  guard: (t) => c(t) === "mapping",
11018
11025
  name: "mapping"
11019
- }, T = {
11026
+ }, G = {
11020
11027
  guard: (t) => typeof t == "string",
11021
11028
  name: "string"
11022
11029
  }, S = {
@@ -11026,7 +11033,8 @@ const q = {
11026
11033
  export {
11027
11034
  P as REMOTE_DATA_JSON_URL,
11028
11035
  C as calcPrice,
11029
- z as extractUsage,
11030
- A as updatePrices,
11031
- R as waitForUpdate
11036
+ N as extractUsage,
11037
+ z as findProvider,
11038
+ R as updatePrices,
11039
+ A as waitForUpdate
11032
11040
  };