@pydantic/genai-prices 0.0.21 → 0.0.22

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",
@@ -113,6 +116,12 @@ const b = [
113
116
  },
114
117
  {
115
118
  starts_with: "claude-3.7-sonnet"
119
+ },
120
+ {
121
+ starts_with: "claude-sonnet-3.7"
122
+ },
123
+ {
124
+ starts_with: "claude-sonnet-3-7"
116
125
  }
117
126
  ]
118
127
  },
@@ -176,10 +185,13 @@ const b = [
176
185
  match: {
177
186
  or: [
178
187
  {
179
- starts_with: "claude-opus-4"
188
+ starts_with: "claude-opus-4-0"
189
+ },
190
+ {
191
+ starts_with: "claude-4-opus"
180
192
  },
181
193
  {
182
- starts_with: "claude-4-opus-20250522"
194
+ equals: "claude-opus-4-20250514"
183
195
  }
184
196
  ]
185
197
  },
@@ -196,14 +208,7 @@ const b = [
196
208
  name: "Claude Opus 4.1",
197
209
  description: "Most intelligent model for complex tasks",
198
210
  match: {
199
- or: [
200
- {
201
- starts_with: "claude-opus-4"
202
- },
203
- {
204
- starts_with: "claude-4-opus-20250522"
205
- }
206
- ]
211
+ starts_with: "claude-opus-4-1"
207
212
  },
208
213
  context_window: 2e5,
209
214
  prices: {
@@ -223,7 +228,7 @@ const b = [
223
228
  starts_with: "claude-sonnet-4"
224
229
  },
225
230
  {
226
- starts_with: "claude-4-sonnet-20250522"
231
+ starts_with: "claude-4-sonnet"
227
232
  }
228
233
  ]
229
234
  },
@@ -290,6 +295,9 @@ const b = [
290
295
  name: "AWS Bedrock",
291
296
  pricing_urls: ["https://aws.amazon.com/bedrock/pricing/"],
292
297
  api_pattern: "https://bedrock-runtime\\.[a-z0-9-]+\\.amazonaws\\.com/",
298
+ provider_match: {
299
+ contains: "bedrock"
300
+ },
293
301
  models: [
294
302
  {
295
303
  id: "meta.llama3-8b-instruct-v1%3A0",
@@ -1118,6 +1126,9 @@ const b = [
1118
1126
  model_match: {
1119
1127
  starts_with: "command-"
1120
1128
  },
1129
+ provider_match: {
1130
+ contains: "cohere"
1131
+ },
1121
1132
  extractors: [
1122
1133
  {
1123
1134
  api_flavor: "default",
@@ -1156,7 +1167,7 @@ const b = [
1156
1167
  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
1168
  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
1169
  match: {
1159
- equals: "command-a"
1170
+ starts_with: "command-a"
1160
1171
  },
1161
1172
  prices: {
1162
1173
  input_mtok: 2.5,
@@ -1488,7 +1499,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
1488
1499
  contains: "google"
1489
1500
  },
1490
1501
  {
1491
- equals: "gemini"
1502
+ contains: "vertex"
1503
+ },
1504
+ {
1505
+ contains: "gemini"
1492
1506
  }
1493
1507
  ]
1494
1508
  },
@@ -1756,7 +1770,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
1756
1770
  name: "Gemini 2.5 Flash",
1757
1771
  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
1772
  match: {
1759
- equals: "gemini-2.5-flash"
1773
+ or: [
1774
+ {
1775
+ equals: "gemini-2.5-flash"
1776
+ },
1777
+ {
1778
+ equals: "gemini-2.5-flash-latest"
1779
+ }
1780
+ ]
1760
1781
  },
1761
1782
  prices: {
1762
1783
  input_mtok: 0.3,
@@ -1994,108 +2015,31 @@ Compared to other leading proprietary and open-weights models Command A delivers
1994
2015
  }
1995
2016
  },
1996
2017
  {
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.",
2018
+ id: "gemma-3",
2019
+ name: "Gemma 3 (free)",
2020
+ description: "Lightweight, state-of the art, open model built from the same technology that powers our Gemini models.",
2000
2021
  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.",
2012
- 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"
2022
+ or: [
2023
+ {
2024
+ starts_with: "gemma-3-"
2025
+ },
2026
+ {
2027
+ equals: "gemma-3"
2028
+ }
2029
+ ]
2090
2030
  },
2091
2031
  prices: {}
2092
2032
  },
2093
2033
  {
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.",
2034
+ id: "gemma-3n",
2035
+ name: "Gemma 3n (free)",
2036
+ description: "Our open model built for efficient performance on everyday devices like mobile phones, laptops, and tablets.",
2097
2037
  match: {
2098
- equals: "gemma-3n-e4b-it:free"
2038
+ or: [
2039
+ {
2040
+ starts_with: "gemma-3n"
2041
+ }
2042
+ ]
2099
2043
  },
2100
2044
  prices: {}
2101
2045
  }
@@ -2127,25 +2071,57 @@ Compared to other leading proprietary and open-weights models Command A delivers
2127
2071
  ],
2128
2072
  models: [
2129
2073
  {
2130
- id: "gemma-7b-it",
2074
+ id: "deepseek-r1-distill-llama-70b",
2075
+ name: "DeepSeek R1 Distill Llama 70B",
2131
2076
  match: {
2132
- equals: "gemma-7b-it"
2077
+ equals: "deepseek-r1-distill-llama-70b"
2133
2078
  },
2079
+ context_window: 131072,
2134
2080
  prices: {
2135
- input_mtok: 0.07,
2136
- output_mtok: 0.07
2081
+ input_mtok: 0.75,
2082
+ output_mtok: 0.99
2137
2083
  }
2138
2084
  },
2139
2085
  {
2140
2086
  id: "gemma2-9b-it",
2087
+ name: "Gemma 2 9B 8k",
2141
2088
  match: {
2142
- equals: "gemma2-9b-it"
2089
+ or: [
2090
+ {
2091
+ equals: "gemma2-9b-it"
2092
+ },
2093
+ {
2094
+ equals: "gemma2-9b"
2095
+ }
2096
+ ]
2143
2097
  },
2144
2098
  prices: {
2145
2099
  input_mtok: 0.2,
2146
2100
  output_mtok: 0.2
2147
2101
  }
2148
2102
  },
2103
+ {
2104
+ id: "llama-3.1-8b-instant",
2105
+ name: "Llama 3.1 8B Instant 128k",
2106
+ match: {
2107
+ equals: "llama-3.1-8b-instant"
2108
+ },
2109
+ prices: {
2110
+ input_mtok: 0.05,
2111
+ output_mtok: 0.08
2112
+ }
2113
+ },
2114
+ {
2115
+ id: "llama-3.3-70b-versatile",
2116
+ name: "Llama 3.3 70B Versatile 128k",
2117
+ match: {
2118
+ equals: "llama-3.3-70b-versatile"
2119
+ },
2120
+ prices: {
2121
+ input_mtok: 0.59,
2122
+ output_mtok: 0.79
2123
+ }
2124
+ },
2149
2125
  {
2150
2126
  id: "llama2-70b-4096",
2151
2127
  match: {
@@ -2197,13 +2173,50 @@ Compared to other leading proprietary and open-weights models Command A delivers
2197
2173
  }
2198
2174
  },
2199
2175
  {
2200
- id: "mixtral-8x7b-32768",
2176
+ id: "meta-llama/llama-4-maverick-17b-128e-instruct",
2177
+ name: "Llama 4 Maverick 17B 128E",
2201
2178
  match: {
2202
- equals: "mixtral-8x7b-32768"
2179
+ equals: "meta-llama/llama-4-maverick-17b-128e-instruct"
2203
2180
  },
2181
+ context_window: 131072,
2204
2182
  prices: {
2205
- input_mtok: 0.24,
2206
- output_mtok: 0.24
2183
+ input_mtok: 0.2,
2184
+ output_mtok: 0.6
2185
+ }
2186
+ },
2187
+ {
2188
+ id: "meta-llama/llama-4-scout-17b-16e-instruct",
2189
+ name: "Llama 4 Scout (17Bx16E) 128k",
2190
+ match: {
2191
+ equals: "meta-llama/llama-4-scout-17b-16e-instruct"
2192
+ },
2193
+ prices: {
2194
+ input_mtok: 0.11,
2195
+ output_mtok: 0.34
2196
+ }
2197
+ },
2198
+ {
2199
+ id: "meta-llama/llama-guard-4-12b",
2200
+ name: "Llama Guard 4 12B",
2201
+ match: {
2202
+ equals: "meta-llama/llama-guard-4-12b"
2203
+ },
2204
+ context_window: 131072,
2205
+ prices: {
2206
+ input_mtok: 0.2,
2207
+ output_mtok: 0.2
2208
+ }
2209
+ },
2210
+ {
2211
+ id: "moonshotai/kimi-k2-instruct",
2212
+ name: "Kimi K2 1T 128k",
2213
+ match: {
2214
+ equals: "moonshotai/kimi-k2-instruct"
2215
+ },
2216
+ context_window: 131072,
2217
+ prices: {
2218
+ input_mtok: 1,
2219
+ output_mtok: 3
2207
2220
  }
2208
2221
  },
2209
2222
  {
@@ -2233,6 +2246,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
2233
2246
  input_mtok: 0.1,
2234
2247
  output_mtok: 0.5
2235
2248
  }
2249
+ },
2250
+ {
2251
+ id: "qwen/qwen3-32b",
2252
+ name: "Qwen3 32B 131k",
2253
+ match: {
2254
+ equals: "qwen/qwen3-32b"
2255
+ },
2256
+ prices: {
2257
+ input_mtok: 0.29,
2258
+ output_mtok: 0.59
2259
+ }
2236
2260
  }
2237
2261
  ]
2238
2262
  },
@@ -2308,16 +2332,13 @@ Compared to other leading proprietary and open-weights models Command A delivers
2308
2332
  prices: {}
2309
2333
  },
2310
2334
  {
2311
- id: "magistral-medium-2506",
2312
- name: "Magistral Medium 2506",
2335
+ id: "magistral-medium",
2336
+ name: "Magistral Medium",
2313
2337
  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
2338
  match: {
2315
2339
  or: [
2316
2340
  {
2317
- equals: "magistral-medium-2506"
2318
- },
2319
- {
2320
- equals: "magistral-medium-2506:thinking"
2341
+ starts_with: "magistral-medium"
2321
2342
  }
2322
2343
  ]
2323
2344
  },
@@ -2327,11 +2348,11 @@ Compared to other leading proprietary and open-weights models Command A delivers
2327
2348
  }
2328
2349
  },
2329
2350
  {
2330
- id: "magistral-small-2506",
2331
- name: "Magistral Small 2506",
2351
+ id: "magistral-small",
2352
+ name: "Magistral Small",
2332
2353
  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
2354
  match: {
2334
- equals: "magistral-small-2506"
2355
+ starts_with: "magistral-small-"
2335
2356
  },
2336
2357
  prices: {
2337
2358
  input_mtok: 0.5,
@@ -2352,68 +2373,34 @@ Compared to other leading proprietary and open-weights models Command A delivers
2352
2373
  },
2353
2374
  {
2354
2375
  id: "ministral-8b",
2355
- name: "Ministral 8B",
2376
+ name: "Ministral 8B 24.10",
2356
2377
  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
2378
  match: {
2358
- equals: "ministral-8b"
2379
+ starts_with: "ministral-8b"
2359
2380
  },
2360
2381
  prices: {
2361
2382
  input_mtok: 0.1,
2362
- output_mtok: 0.1
2383
+ output_mtok: 1
2363
2384
  }
2364
2385
  },
2365
2386
  {
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.",
2387
+ id: "mistral-7b",
2388
+ name: "Mistral 7B",
2369
2389
  match: {
2370
2390
  or: [
2371
2391
  {
2372
- equals: "mistral-7b-instruct"
2392
+ equals: "mistral-7b"
2373
2393
  },
2374
2394
  {
2375
- equals: "mistral-7b-instruct-v0.3"
2395
+ equals: "open-mistral-7b"
2376
2396
  }
2377
2397
  ]
2378
2398
  },
2379
2399
  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
2400
+ input_mtok: 0.25,
2401
+ output_mtok: 0.25
2406
2402
  }
2407
2403
  },
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
2404
  {
2418
2405
  id: "mistral-embed",
2419
2406
  match: {
@@ -2454,14 +2441,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
2454
2441
  name: "Mistral Medium 3",
2455
2442
  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
2443
  match: {
2457
- or: [
2458
- {
2459
- equals: "mistral-medium-3"
2460
- },
2461
- {
2462
- equals: "mistral-medium-latest"
2463
- }
2464
- ]
2444
+ starts_with: "mistral-medium"
2465
2445
  },
2466
2446
  prices: {
2467
2447
  input_mtok: 0.4,
@@ -2473,7 +2453,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
2473
2453
  name: "Mistral NeMo",
2474
2454
  description: "A 12B parameter model with a 128k token context length built by Mistral in collaboration with NVIDIA.",
2475
2455
  match: {
2476
- equals: "mistral-nemo"
2456
+ or: [
2457
+ {
2458
+ equals: "mistral-nemo"
2459
+ },
2460
+ {
2461
+ equals: "open-mistral-nemo"
2462
+ }
2463
+ ]
2477
2464
  },
2478
2465
  prices: {
2479
2466
  input_mtok: 0.15,
@@ -2513,7 +2500,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
2513
2500
  name: "Mistral Small",
2514
2501
  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
2502
  match: {
2516
- equals: "mistral-small"
2503
+ starts_with: "mistral-small"
2517
2504
  },
2518
2505
  prices: {
2519
2506
  input_mtok: 0.2,
@@ -2582,31 +2569,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
2582
2569
  }
2583
2570
  },
2584
2571
  {
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.",
2588
- 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",
2572
+ id: "mixtral-8x7b",
2573
+ name: "Mixtral 8x7B",
2598
2574
  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"
2575
+ or: [
2576
+ {
2577
+ starts_with: "mixtral-8x7b"
2578
+ },
2579
+ {
2580
+ equals: "open-mixtral-8x7b"
2581
+ }
2582
+ ]
2610
2583
  },
2611
2584
  prices: {
2612
2585
  input_mtok: 0.7,
@@ -3028,6 +3001,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
3028
3001
  }
3029
3002
  ]
3030
3003
  },
3004
+ provider_match: {
3005
+ contains: "openai"
3006
+ },
3031
3007
  extractors: [
3032
3008
  {
3033
3009
  api_flavor: "chat",
@@ -9868,6 +9844,16 @@ Compared to other leading proprietary and open-weights models Command A delivers
9868
9844
  name: "Together AI",
9869
9845
  pricing_urls: ["https://www.together.ai/pricing"],
9870
9846
  api_pattern: "https://api\\.together\\.xyz",
9847
+ provider_match: {
9848
+ or: [
9849
+ {
9850
+ equals: "together-ai"
9851
+ },
9852
+ {
9853
+ equals: "together_ai"
9854
+ }
9855
+ ]
9856
+ },
9871
9857
  models: [
9872
9858
  {
9873
9859
  id: "Austism/chronos-hermes-13b",
@@ -10658,6 +10644,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
10658
10644
  model_match: {
10659
10645
  contains: "grok"
10660
10646
  },
10647
+ provider_match: {
10648
+ equals: "xai"
10649
+ },
10661
10650
  extractors: [
10662
10651
  {
10663
10652
  api_flavor: "chat",
@@ -10857,23 +10846,23 @@ Compared to other leading proprietary and open-weights models Command A delivers
10857
10846
  ]
10858
10847
  }
10859
10848
  ];
10860
- function v(t, e) {
10849
+ function x(t, e) {
10861
10850
  if (e <= 0) return 0;
10862
10851
  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);
10864
- 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);
10867
- u > 0 && (a += u * s.price / 1e6);
10852
+ const i = [...t.tiers].sort((r, m) => r.start - m.start), o = i[0]?.start ?? e, s = Math.min(e, o);
10853
+ a += s * t.base / 1e6;
10854
+ for (let r = 0; r < i.length; r++) {
10855
+ const m = i[r], n = i[r + 1]?.start ?? 1 / 0, u = Math.max(0, Math.min(e, n) - m.start);
10856
+ u > 0 && (a += u * m.price / 1e6);
10868
10857
  }
10869
10858
  return a;
10870
10859
  }
10871
- function p(t, e, a) {
10872
- return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : v(t, e);
10860
+ function l(t, e, a) {
10861
+ return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : x(t, e);
10873
10862
  }
10874
- function x(t, e) {
10863
+ function B(t, e) {
10875
10864
  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);
10865
+ 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
10866
  const o = a + i;
10878
10867
  return {
10879
10868
  input_price: a,
@@ -10881,7 +10870,7 @@ function x(t, e) {
10881
10870
  total_price: o
10882
10871
  };
10883
10872
  }
10884
- function B(t, e) {
10873
+ function y(t, e) {
10885
10874
  if (!Array.isArray(t.prices))
10886
10875
  return t.prices;
10887
10876
  for (let a = t.prices.length - 1; a >= 0; a--) {
@@ -10892,11 +10881,11 @@ function B(t, e) {
10892
10881
  if (e >= new Date(o.start_date))
10893
10882
  return i.prices;
10894
10883
  } 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)
10884
+ const s = e.toISOString().slice(11, 19), r = o.start_time, m = o.end_time;
10885
+ if (m < r) {
10886
+ if (s >= r || s < m)
10898
10887
  return i.prices;
10899
- } else if (m >= n && m < s)
10888
+ } else if (s >= r && s < m)
10900
10889
  return i.prices;
10901
10890
  }
10902
10891
  }
@@ -10905,118 +10894,126 @@ function B(t, e) {
10905
10894
  function d(t, e) {
10906
10895
  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
10896
  }
10908
- function y(t, e) {
10897
+ function M(t, e) {
10909
10898
  const a = e.toLowerCase().trim(), i = t.find((o) => o.id === a);
10910
10899
  return i || t.find((o) => o.provider_match && d(o.provider_match, a));
10911
10900
  }
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));
10901
+ function w(t, { modelId: e, providerApiUrl: a, providerId: i }) {
10902
+ if (i)
10903
+ return M(t, i);
10904
+ if (a)
10905
+ return t.find((o) => new RegExp(o.api_pattern).test(a));
10906
+ if (e)
10907
+ return t.find((o) => o.model_match && d(o.model_match, e));
10914
10908
  }
10915
10909
  function I(t, e) {
10916
10910
  return t.find((a) => d(a.match, e));
10917
10911
  }
10918
10912
  const P = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
10919
- let _ = b, g = Promise.resolve(b), f = null;
10913
+ let h = f, g = Promise.resolve(f), q = null;
10920
10914
  function L(t) {
10921
10915
  "then" in t ? (g = t, t.then((e) => {
10922
- _ = e;
10923
- })) : (g = Promise.resolve(t), _ = t);
10916
+ h = e;
10917
+ })) : (g = Promise.resolve(t), h = t);
10924
10918
  }
10925
- function G(t) {
10926
- f = t;
10919
+ function T(t) {
10920
+ q = t;
10927
10921
  }
10928
- function A(t) {
10922
+ function R(t) {
10929
10923
  t({
10930
- onCalc: G,
10924
+ onCalc: T,
10931
10925
  remoteDataUrl: P,
10932
10926
  setProviderData: L
10933
10927
  });
10934
10928
  }
10935
- function R() {
10929
+ function A() {
10936
10930
  return g;
10937
10931
  }
10938
10932
  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);
10933
+ q?.();
10934
+ const i = e.toLowerCase().trim(), o = a?.provider ?? w(h, { modelId: i, providerApiUrl: a?.providerApiUrl, providerId: a?.providerId });
10943
10935
  if (!o) return null;
10944
- const m = a?.timestamp ?? /* @__PURE__ */ new Date(), n = B(o, m), s = x(t, n);
10936
+ const s = I(o.models, i);
10937
+ if (!s) return null;
10938
+ const r = a?.timestamp ?? /* @__PURE__ */ new Date(), m = y(s, r), n = B(t, m);
10945
10939
  return {
10946
10940
  auto_update_timestamp: void 0,
10947
- model: o,
10948
- model_price: n,
10949
- provider: i,
10950
- ...s
10941
+ model: s,
10942
+ model_price: m,
10943
+ provider: o,
10944
+ ...n
10951
10945
  };
10952
10946
  }
10953
- function z(t, e, a) {
10947
+ function z(t) {
10948
+ return q?.(), w(h, t);
10949
+ }
10950
+ function N(t, e, a) {
10954
10951
  if (!t.extractors)
10955
10952
  throw new Error("No extraction logic defined for this provider");
10956
10953
  let i;
10957
10954
  if (a) {
10958
- const r = t.extractors.find((u) => u.api_flavor === a);
10959
- if (r)
10960
- i = r;
10955
+ const n = t.extractors.find((u) => u.api_flavor === a);
10956
+ if (n)
10957
+ i = n;
10961
10958
  else {
10962
- const u = t.extractors.map((l) => l.api_flavor).join(", ");
10959
+ const u = t.extractors.map((p) => p.api_flavor).join(", ");
10963
10960
  throw new Error(`Unknown apiFlavor '${a}', allowed values: ${u}`);
10964
10961
  }
10965
10962
  } else if (t.extractors.length === 1)
10966
10963
  i = t.extractors[0];
10967
10964
  else
10968
10965
  throw new Error("No apiFlavor specified and multiple extractors available");
10969
- if (!q.guard(e))
10966
+ if (!b.guard(e))
10970
10967
  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);
10968
+ const o = _(i.model_path, e, G, !0, []), s = v(i.root), r = _(s, e, b, !0, []), m = {};
10969
+ for (const n of i.mappings) {
10970
+ const u = _(n.path, r, S, n.required, s);
10974
10971
  if (u !== null) {
10975
- const l = s[r.dest] ?? 0;
10976
- s[r.dest] = l + u;
10972
+ const p = m[n.dest] ?? 0;
10973
+ m[n.dest] = p + u;
10977
10974
  }
10978
10975
  }
10979
- if (!Object.keys(s).length)
10976
+ if (!Object.keys(m).length)
10980
10977
  throw new Error(`No usage information found at ${JSON.stringify(i.root)}`);
10981
- return [o, s];
10978
+ return [o, m];
10982
10979
  }
10983
- function k(t, e, a, i, o) {
10984
- const [m, ...n] = w(t).reverse();
10985
- if (typeof m != "string")
10986
- throw new Error(`Expected last step of path to be a string, got ${c(m)}`);
10987
- 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") {
10980
+ function _(t, e, a, i, o) {
10981
+ const [s, ...r] = v(t).reverse();
10982
+ if (typeof s != "string")
10983
+ throw new Error(`Expected last step of path to be a string, got ${c(s)}`);
10984
+ let m = e;
10985
+ r.reverse();
10986
+ const n = [];
10987
+ for (const p of r) {
10988
+ n.push(p), m = m[p];
10989
+ const k = c(m);
10990
+ if (k === "undefined") {
10994
10991
  if (i)
10995
- throw new Error(`Missing value at \`${[...o, ...r].join(".")}\``);
10992
+ throw new Error(`Missing value at \`${[...o, ...n].join(".")}\``);
10996
10993
  return null;
10997
- } else if (h !== "mapping")
10998
- throw new Error(`Expected \`${[...o, ...r].join(".")}\` value to be a mapping, got ${h}`);
10994
+ } else if (k !== "mapping")
10995
+ throw new Error(`Expected \`${[...o, ...n].join(".")}\` value to be a mapping, got ${k}`);
10999
10996
  }
11000
- const u = s[m];
10997
+ const u = m[s];
11001
10998
  if (typeof u > "u") {
11002
10999
  if (i)
11003
- throw r.push(m), new Error(`Missing value at \`${[...o, ...r].join(".")}\``);
11000
+ throw n.push(s), new Error(`Missing value at \`${[...o, ...n].join(".")}\``);
11004
11001
  return null;
11005
11002
  }
11006
11003
  if (a.guard(u))
11007
11004
  return u;
11008
- throw r.push(m), new Error(`Expected \`${[...o, ...r].join(".")}\` value to be a ${a.name}, got ${c(u)}`);
11005
+ throw n.push(s), new Error(`Expected \`${[...o, ...n].join(".")}\` value to be a ${a.name}, got ${c(u)}`);
11009
11006
  }
11010
- function w(t) {
11007
+ function v(t) {
11011
11008
  return Array.isArray(t) ? [...t] : [t];
11012
11009
  }
11013
11010
  function c(t) {
11014
11011
  return t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "mapping" : typeof t;
11015
11012
  }
11016
- const q = {
11013
+ const b = {
11017
11014
  guard: (t) => c(t) === "mapping",
11018
11015
  name: "mapping"
11019
- }, T = {
11016
+ }, G = {
11020
11017
  guard: (t) => typeof t == "string",
11021
11018
  name: "string"
11022
11019
  }, S = {
@@ -11026,7 +11023,8 @@ const q = {
11026
11023
  export {
11027
11024
  P as REMOTE_DATA_JSON_URL,
11028
11025
  C as calcPrice,
11029
- z as extractUsage,
11030
- A as updatePrices,
11031
- R as waitForUpdate
11026
+ N as extractUsage,
11027
+ z as findProvider,
11028
+ R as updatePrices,
11029
+ A as waitForUpdate
11032
11030
  };