@pydantic/genai-prices 0.0.56 → 0.0.60

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 I = [
1
+ const Q = [
2
2
  {
3
3
  id: "anthropic",
4
4
  name: "Anthropic",
@@ -392,6 +392,35 @@ const I = [
392
392
  }
393
393
  ]
394
394
  },
395
+ {
396
+ id: "claude-opus-4-7",
397
+ name: "Claude Opus 4.7",
398
+ description: "Our most capable model for complex reasoning and agentic coding",
399
+ match: {
400
+ or: [
401
+ {
402
+ starts_with: "claude-opus-4-7"
403
+ },
404
+ {
405
+ starts_with: "claude-opus-4.7"
406
+ },
407
+ {
408
+ starts_with: "claude-4-7-opus"
409
+ },
410
+ {
411
+ starts_with: "claude-4.7-opus"
412
+ }
413
+ ]
414
+ },
415
+ context_window: 1e6,
416
+ price_comments: "Flat pricing across full 1M context window (no tiered pricing). Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
417
+ prices: {
418
+ input_mtok: 5,
419
+ cache_write_mtok: 6.25,
420
+ cache_read_mtok: 0.5,
421
+ output_mtok: 25
422
+ }
423
+ },
395
424
  {
396
425
  id: "claude-sonnet-4-0",
397
426
  name: "Claude Sonnet 4",
@@ -848,6 +877,18 @@ const I = [
848
877
  }
849
878
  }
850
879
  },
880
+ {
881
+ id: "global.anthropic.claude-opus-4-7-v1:0",
882
+ match: {
883
+ contains: "global.anthropic.claude-opus-4-7"
884
+ },
885
+ prices: {
886
+ input_mtok: 5,
887
+ cache_write_mtok: 6.25,
888
+ cache_read_mtok: 0.5,
889
+ output_mtok: 25
890
+ }
891
+ },
851
892
  {
852
893
  id: "global.anthropic.claude-sonnet-4-20250514-v1:0",
853
894
  match: {
@@ -1092,6 +1133,39 @@ const I = [
1092
1133
  output_mtok: 6
1093
1134
  }
1094
1135
  },
1136
+ {
1137
+ id: "nvidia.nemotron-nano-3-30b:0",
1138
+ name: "Nemotron 3 Nano 30B",
1139
+ match: {
1140
+ contains: "nvidia.nemotron-nano-3-30b"
1141
+ },
1142
+ prices: {
1143
+ input_mtok: 0.06,
1144
+ output_mtok: 0.24
1145
+ }
1146
+ },
1147
+ {
1148
+ id: "nvidia.nemotron-nano-9b-v2:0",
1149
+ name: "Nemotron 2 Nano 9B",
1150
+ match: {
1151
+ contains: "nvidia.nemotron-nano-9b-v2"
1152
+ },
1153
+ prices: {
1154
+ input_mtok: 0.06,
1155
+ output_mtok: 0.23
1156
+ }
1157
+ },
1158
+ {
1159
+ id: "nvidia.nemotron-super-3-120b:0",
1160
+ name: "Nemotron 3 Super 120B",
1161
+ match: {
1162
+ contains: "nvidia.nemotron-super-3-120b"
1163
+ },
1164
+ prices: {
1165
+ input_mtok: 0.15,
1166
+ output_mtok: 0.65
1167
+ }
1168
+ },
1095
1169
  {
1096
1170
  id: "openai.gpt-oss-120b-1:0",
1097
1171
  name: "gpt-oss-120b",
@@ -1455,6 +1529,43 @@ const I = [
1455
1529
  }
1456
1530
  }
1457
1531
  },
1532
+ {
1533
+ id: "regional.anthropic.claude-opus-4-7-v1:0",
1534
+ match: {
1535
+ or: [
1536
+ {
1537
+ starts_with: "anthropic.claude-opus-4-7"
1538
+ },
1539
+ {
1540
+ starts_with: "claude-opus-4-7"
1541
+ },
1542
+ {
1543
+ contains: "us.anthropic.claude-opus-4-7"
1544
+ },
1545
+ {
1546
+ contains: "au.anthropic.claude-opus-4-7"
1547
+ },
1548
+ {
1549
+ contains: "apac.anthropic.claude-opus-4-7"
1550
+ },
1551
+ {
1552
+ contains: "eu.anthropic.claude-opus-4-7"
1553
+ },
1554
+ {
1555
+ contains: "us-gov.anthropic.claude-opus-4-7"
1556
+ },
1557
+ {
1558
+ contains: "jp.anthropic.claude-opus-4-7"
1559
+ }
1560
+ ]
1561
+ },
1562
+ prices: {
1563
+ input_mtok: 5.5,
1564
+ cache_write_mtok: 6.875,
1565
+ cache_read_mtok: 0.55,
1566
+ output_mtok: 27.5
1567
+ }
1568
+ },
1458
1569
  {
1459
1570
  id: "regional.anthropic.claude-sonnet-4-20250514-v1:0",
1460
1571
  match: {
@@ -2411,6 +2522,43 @@ Compared to other leading proprietary and open-weights models Command A delivers
2411
2522
  }
2412
2523
  }
2413
2524
  ]
2525
+ },
2526
+ {
2527
+ id: "deepseek-v4-flash",
2528
+ name: "DeepSeek V4 Flash",
2529
+ description: "DeepSeek-V4-Flash. Supports both non-thinking and thinking (default) modes, JSON output, tool calls, chat prefix completion, and FIM completion (non-thinking only).",
2530
+ match: {
2531
+ or: [
2532
+ {
2533
+ starts_with: "deepseek-v4-flash"
2534
+ }
2535
+ ]
2536
+ },
2537
+ context_window: 1e6,
2538
+ prices: {
2539
+ input_mtok: 0.14,
2540
+ cache_read_mtok: 28e-4,
2541
+ output_mtok: 0.28
2542
+ }
2543
+ },
2544
+ {
2545
+ id: "deepseek-v4-pro",
2546
+ name: "DeepSeek V4 Pro",
2547
+ description: "DeepSeek-V4-Pro. Supports both non-thinking and thinking (default) modes, JSON output, tool calls, chat prefix completion, and FIM completion (non-thinking only).",
2548
+ match: {
2549
+ or: [
2550
+ {
2551
+ starts_with: "deepseek-v4-pro"
2552
+ }
2553
+ ]
2554
+ },
2555
+ context_window: 1e6,
2556
+ price_comments: "Standard (non-promotional) pricing. DeepSeek is offering a temporary 75% promotional discount that is not reflected here.",
2557
+ prices: {
2558
+ input_mtok: 1.74,
2559
+ cache_read_mtok: 0.0145,
2560
+ output_mtok: 3.48
2561
+ }
2414
2562
  }
2415
2563
  ]
2416
2564
  },
@@ -2724,7 +2872,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
2724
2872
  },
2725
2873
  {
2726
2874
  path: "toolUsePromptTokenCount",
2727
- dest: "output_tokens",
2875
+ dest: "input_tokens",
2728
2876
  required: !1
2729
2877
  }
2730
2878
  ]
@@ -2972,6 +3120,33 @@ Compared to other leading proprietary and open-weights models Command A delivers
2972
3120
  }
2973
3121
  }
2974
3122
  },
3123
+ {
3124
+ id: "claude-opus-4-7",
3125
+ match: {
3126
+ or: [
3127
+ {
3128
+ contains: "claude-4-7-opus"
3129
+ },
3130
+ {
3131
+ contains: "claude-opus-4-7"
3132
+ },
3133
+ {
3134
+ contains: "claude-4.7-opus"
3135
+ },
3136
+ {
3137
+ contains: "claude-opus-4.7"
3138
+ }
3139
+ ]
3140
+ },
3141
+ context_window: 1e6,
3142
+ price_comments: "Flat pricing across full 1M context window. Ref: https://cloud.google.com/vertex-ai/generative-ai/pricing#claude-models",
3143
+ prices: {
3144
+ input_mtok: 5,
3145
+ cache_write_mtok: 6.25,
3146
+ cache_read_mtok: 0.5,
3147
+ output_mtok: 25
3148
+ }
3149
+ },
2975
3150
  {
2976
3151
  id: "gemini-1.0-pro-vision-001",
2977
3152
  name: "gemini 1.0 pro vision",
@@ -3079,17 +3254,10 @@ Compared to other leading proprietary and open-weights models Command A delivers
3079
3254
  context_window: 1e6,
3080
3255
  prices: {
3081
3256
  input_mtok: 0.1,
3082
- cache_read_mtok: {
3083
- base: 0.025,
3084
- tiers: [
3085
- {
3086
- start: 1e6,
3087
- price: 0.175
3088
- }
3089
- ]
3090
- },
3257
+ cache_read_mtok: 0.025,
3091
3258
  output_mtok: 0.4,
3092
- input_audio_mtok: 0.7
3259
+ input_audio_mtok: 0.7,
3260
+ cache_audio_read_mtok: 0.175
3093
3261
  }
3094
3262
  },
3095
3263
  {
@@ -3346,14 +3514,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
3346
3514
  }
3347
3515
  },
3348
3516
  {
3349
- id: "gemini-3.1-flash-lite-preview",
3350
- name: "Gemini 3.1 Flash Lite Preview",
3517
+ id: "gemini-3.1-flash-lite",
3518
+ name: "Gemini 3.1 Flash Lite",
3351
3519
  description: "Google's fastest and most cost-efficient Gemini 3 series model, built for intelligence at scale. Optimized for high-volume, low-latency applications while maintaining strong multimodal capabilities.",
3352
3520
  match: {
3353
- starts_with: "gemini-3.1-flash-lite-preview"
3521
+ starts_with: "gemini-3.1-flash-lite"
3354
3522
  },
3355
3523
  context_window: 1e6,
3356
- price_comments: "See https://ai.google.dev/gemini-api/docs/pricing. Preview model - pricing may change before becoming stable.",
3524
+ price_comments: "See https://ai.google.dev/gemini-api/docs/pricing.",
3357
3525
  prices: {
3358
3526
  input_mtok: 0.25,
3359
3527
  cache_read_mtok: 0.025,
@@ -9343,6 +9511,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
9343
9511
  },
9344
9512
  context_window: 128e3,
9345
9513
  prices: {
9514
+ input_mtok: 2.5,
9346
9515
  output_mtok: 10,
9347
9516
  input_audio_mtok: 2.5
9348
9517
  }
@@ -9393,6 +9562,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
9393
9562
  starts_with: "gpt-4o-mini-audio"
9394
9563
  },
9395
9564
  prices: {
9565
+ input_mtok: 0.15,
9396
9566
  output_mtok: 0.6,
9397
9567
  input_audio_mtok: 0.15
9398
9568
  }
@@ -9429,6 +9599,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
9429
9599
  },
9430
9600
  prices: {
9431
9601
  input_mtok: 0.6,
9602
+ output_mtok: 12,
9432
9603
  output_audio_mtok: 12
9433
9604
  }
9434
9605
  },
@@ -9753,6 +9924,39 @@ Compared to other leading proprietary and open-weights models Command A delivers
9753
9924
  output_mtok: 168
9754
9925
  }
9755
9926
  },
9927
+ {
9928
+ id: "gpt-5.3",
9929
+ name: "GPT-5.3 Chat",
9930
+ description: "GPT-5.3 Instant model used in ChatGPT",
9931
+ match: {
9932
+ or: [
9933
+ {
9934
+ equals: "gpt-5.3"
9935
+ },
9936
+ {
9937
+ equals: "gpt-5-3"
9938
+ },
9939
+ {
9940
+ equals: "gpt-5.3-chat"
9941
+ },
9942
+ {
9943
+ equals: "gpt-5.3-chat-latest"
9944
+ },
9945
+ {
9946
+ equals: "gpt-5-3-chat"
9947
+ },
9948
+ {
9949
+ equals: "gpt-5-3-chat-latest"
9950
+ }
9951
+ ]
9952
+ },
9953
+ context_window: 128e3,
9954
+ prices: {
9955
+ input_mtok: 1.75,
9956
+ cache_read_mtok: 0.175,
9957
+ output_mtok: 14
9958
+ }
9959
+ },
9756
9960
  {
9757
9961
  id: "gpt-5.3-codex",
9758
9962
  name: "GPT-5.3-Codex",
@@ -9921,6 +10125,77 @@ Compared to other leading proprietary and open-weights models Command A delivers
9921
10125
  }
9922
10126
  }
9923
10127
  },
10128
+ {
10129
+ id: "gpt-5.5",
10130
+ name: "GPT-5.5",
10131
+ description: "The best model for coding and agentic tasks across industries",
10132
+ match: {
10133
+ or: [
10134
+ {
10135
+ equals: "gpt-5.5"
10136
+ },
10137
+ {
10138
+ equals: "gpt-5.5-2026-04-23"
10139
+ },
10140
+ {
10141
+ equals: "gpt-5-5"
10142
+ },
10143
+ {
10144
+ equals: "gpt-5-5-2026-04-23"
10145
+ },
10146
+ {
10147
+ equals: "gpt-5.5-chat"
10148
+ },
10149
+ {
10150
+ equals: "gpt-5.5-chat-latest"
10151
+ },
10152
+ {
10153
+ equals: "gpt-5-5-chat"
10154
+ },
10155
+ {
10156
+ equals: "gpt-5-5-chat-latest"
10157
+ },
10158
+ {
10159
+ equals: "gpt-5.5-codex"
10160
+ },
10161
+ {
10162
+ equals: "gpt-5-5-codex"
10163
+ }
10164
+ ]
10165
+ },
10166
+ context_window: 1e6,
10167
+ prices: {
10168
+ input_mtok: 5,
10169
+ cache_read_mtok: 0.5,
10170
+ output_mtok: 30
10171
+ }
10172
+ },
10173
+ {
10174
+ id: "gpt-5.5-pro",
10175
+ name: "GPT-5.5 Pro",
10176
+ description: "Version of GPT-5.5 that produces smarter and more precise responses.",
10177
+ match: {
10178
+ or: [
10179
+ {
10180
+ equals: "gpt-5.5-pro"
10181
+ },
10182
+ {
10183
+ equals: "gpt-5.5-pro-2026-04-23"
10184
+ },
10185
+ {
10186
+ equals: "gpt-5-5-pro"
10187
+ },
10188
+ {
10189
+ equals: "gpt-5-5-pro-2026-04-23"
10190
+ }
10191
+ ]
10192
+ },
10193
+ context_window: 1e6,
10194
+ prices: {
10195
+ input_mtok: 30,
10196
+ output_mtok: 180
10197
+ }
10198
+ },
9924
10199
  {
9925
10200
  id: "gpt-realtime",
9926
10201
  match: {
@@ -10242,6 +10517,45 @@ Compared to other leading proprietary and open-weights models Command A delivers
10242
10517
  name: "OpenRouter",
10243
10518
  pricing_urls: ["https://openrouter.ai/models"],
10244
10519
  api_pattern: "https://(api\\.)?openrouter\\.ai",
10520
+ extractors: [
10521
+ {
10522
+ api_flavor: "chat",
10523
+ root: "usage",
10524
+ model_path: "model",
10525
+ mappings: [
10526
+ {
10527
+ path: "prompt_tokens",
10528
+ dest: "input_tokens",
10529
+ required: !0
10530
+ },
10531
+ {
10532
+ path: ["prompt_tokens_details", "cached_tokens"],
10533
+ dest: "cache_read_tokens",
10534
+ required: !1
10535
+ },
10536
+ {
10537
+ path: ["prompt_tokens_details", "cache_write_tokens"],
10538
+ dest: "cache_write_tokens",
10539
+ required: !1
10540
+ },
10541
+ {
10542
+ path: ["prompt_tokens_details", "audio_tokens"],
10543
+ dest: "input_audio_tokens",
10544
+ required: !1
10545
+ },
10546
+ {
10547
+ path: ["completion_tokens_details", "audio_tokens"],
10548
+ dest: "output_audio_tokens",
10549
+ required: !1
10550
+ },
10551
+ {
10552
+ path: "completion_tokens",
10553
+ dest: "output_tokens",
10554
+ required: !0
10555
+ }
10556
+ ]
10557
+ }
10558
+ ],
10245
10559
  models: [
10246
10560
  {
10247
10561
  id: "01-ai/yi-large",
@@ -10633,6 +10947,18 @@ Compared to other leading proprietary and open-weights models Command A delivers
10633
10947
  {
10634
10948
  equals: "anthropic/claude-haiku-4.5"
10635
10949
  },
10950
+ {
10951
+ equals: "anthropic/claude-4.5-haiku-20251001"
10952
+ },
10953
+ {
10954
+ equals: "anthropic/claude-4.5-haiku-20251001:beta"
10955
+ },
10956
+ {
10957
+ equals: "anthropic/claude-haiku-4.5-20251001"
10958
+ },
10959
+ {
10960
+ equals: "anthropic/claude-haiku-4.5-20251001:beta"
10961
+ },
10636
10962
  {
10637
10963
  equals: "anthropic/claude-haiku-4.5:beta"
10638
10964
  }
@@ -10652,6 +10978,18 @@ Compared to other leading proprietary and open-weights models Command A delivers
10652
10978
  {
10653
10979
  equals: "anthropic/claude-opus-4.5"
10654
10980
  },
10981
+ {
10982
+ equals: "anthropic/claude-4.5-opus-20251124"
10983
+ },
10984
+ {
10985
+ equals: "anthropic/claude-4.5-opus-20251124:beta"
10986
+ },
10987
+ {
10988
+ equals: "anthropic/claude-opus-4.5-20251124"
10989
+ },
10990
+ {
10991
+ equals: "anthropic/claude-opus-4.5-20251124:beta"
10992
+ },
10655
10993
  {
10656
10994
  equals: "anthropic/claude-opus-4.5:beta"
10657
10995
  }
@@ -10671,48 +11009,51 @@ Compared to other leading proprietary and open-weights models Command A delivers
10671
11009
  {
10672
11010
  equals: "anthropic/claude-opus-4.6"
10673
11011
  },
11012
+ {
11013
+ equals: "anthropic/claude-4.6-opus-20260205"
11014
+ },
11015
+ {
11016
+ equals: "anthropic/claude-4.6-opus-20260205:beta"
11017
+ },
11018
+ {
11019
+ equals: "anthropic/claude-opus-4.6-20260205"
11020
+ },
11021
+ {
11022
+ equals: "anthropic/claude-opus-4.6-20260205:beta"
11023
+ },
10674
11024
  {
10675
11025
  equals: "anthropic/claude-opus-4.6:beta"
10676
11026
  }
10677
11027
  ]
10678
11028
  },
11029
+ context_window: 1e6,
11030
+ price_comments: "Flat pricing across full 1M context window (no tiered pricing). Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
10679
11031
  prices: {
10680
- input_mtok: {
10681
- base: 5,
10682
- tiers: [
10683
- {
10684
- start: 2e5,
10685
- price: 10
10686
- }
10687
- ]
10688
- },
10689
- cache_write_mtok: {
10690
- base: 6.25,
10691
- tiers: [
10692
- {
10693
- start: 2e5,
10694
- price: 12.5
10695
- }
10696
- ]
10697
- },
10698
- cache_read_mtok: {
10699
- base: 0.5,
10700
- tiers: [
10701
- {
10702
- start: 2e5,
10703
- price: 1
10704
- }
10705
- ]
10706
- },
10707
- output_mtok: {
10708
- base: 25,
10709
- tiers: [
10710
- {
10711
- start: 2e5,
10712
- price: 37.5
10713
- }
10714
- ]
10715
- }
11032
+ input_mtok: 5,
11033
+ cache_write_mtok: 6.25,
11034
+ cache_read_mtok: 0.5,
11035
+ output_mtok: 25
11036
+ }
11037
+ },
11038
+ {
11039
+ id: "anthropic/claude-opus-4.7",
11040
+ match: {
11041
+ or: [
11042
+ {
11043
+ equals: "anthropic/claude-opus-4.7"
11044
+ },
11045
+ {
11046
+ equals: "anthropic/claude-opus-4.7:beta"
11047
+ }
11048
+ ]
11049
+ },
11050
+ context_window: 1e6,
11051
+ price_comments: "Flat pricing across full 1M context window (no tiered pricing). Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
11052
+ prices: {
11053
+ input_mtok: 5,
11054
+ cache_write_mtok: 6.25,
11055
+ cache_read_mtok: 0.5,
11056
+ output_mtok: 25
10716
11057
  }
10717
11058
  },
10718
11059
  {
@@ -10722,12 +11063,25 @@ Compared to other leading proprietary and open-weights models Command A delivers
10722
11063
  {
10723
11064
  equals: "anthropic/claude-sonnet-4.5"
10724
11065
  },
11066
+ {
11067
+ equals: "anthropic/claude-4.5-sonnet-20250929"
11068
+ },
11069
+ {
11070
+ equals: "anthropic/claude-4.5-sonnet-20250929:beta"
11071
+ },
11072
+ {
11073
+ equals: "anthropic/claude-sonnet-4.5-20250929"
11074
+ },
11075
+ {
11076
+ equals: "anthropic/claude-sonnet-4.5-20250929:beta"
11077
+ },
10725
11078
  {
10726
11079
  equals: "anthropic/claude-sonnet-4.5:beta"
10727
11080
  }
10728
11081
  ]
10729
11082
  },
10730
11083
  context_window: 1e6,
11084
+ price_comments: "Tiered pricing: Unlike 4.6 models, Sonnet 4.5 has long-context surcharge. Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
10731
11085
  prices: {
10732
11086
  input_mtok: {
10733
11087
  base: 3,
@@ -10774,11 +11128,25 @@ Compared to other leading proprietary and open-weights models Command A delivers
10774
11128
  {
10775
11129
  equals: "anthropic/claude-sonnet-4.6"
10776
11130
  },
11131
+ {
11132
+ equals: "anthropic/claude-4.6-sonnet-20260217"
11133
+ },
11134
+ {
11135
+ equals: "anthropic/claude-4.6-sonnet-20260217:beta"
11136
+ },
11137
+ {
11138
+ equals: "anthropic/claude-sonnet-4.6-20260217"
11139
+ },
11140
+ {
11141
+ equals: "anthropic/claude-sonnet-4.6-20260217:beta"
11142
+ },
10777
11143
  {
10778
11144
  equals: "anthropic/claude-sonnet-4.6:beta"
10779
11145
  }
10780
11146
  ]
10781
11147
  },
11148
+ context_window: 1e6,
11149
+ price_comments: "Flat pricing across full 1M context window (no tiered pricing). Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
10782
11150
  prices: {
10783
11151
  input_mtok: 3,
10784
11152
  cache_write_mtok: 3.75,
@@ -11677,6 +12045,19 @@ Compared to other leading proprietary and open-weights models Command A delivers
11677
12045
  },
11678
12046
  prices: {}
11679
12047
  },
12048
+ {
12049
+ id: "deepseek/deepseek-v3.2",
12050
+ name: "DeepSeek V3.2",
12051
+ match: {
12052
+ equals: "deepseek/deepseek-v3.2"
12053
+ },
12054
+ context_window: 131072,
12055
+ prices: {
12056
+ input_mtok: 0.252,
12057
+ cache_read_mtok: 0.0252,
12058
+ output_mtok: 0.378
12059
+ }
12060
+ },
11680
12061
  {
11681
12062
  id: "deepseek/deepseek-v3.2-exp",
11682
12063
  name: "DeepSeek V3.2 Experimental",
@@ -18201,6 +18582,30 @@ Compared to other leading proprietary and open-weights models Command A delivers
18201
18582
  output_mtok: 0.5
18202
18583
  }
18203
18584
  },
18585
+ {
18586
+ id: "grok-4.3",
18587
+ name: "Grok 4.3",
18588
+ description: "Most advanced flagship model, leading the industry in non-hallucination rate, agentic tool calling, and instruction following capabilities. Supports text and image inputs with text outputs, function calling, structured outputs, and reasoning.",
18589
+ match: {
18590
+ or: [
18591
+ {
18592
+ equals: "grok-4.3"
18593
+ },
18594
+ {
18595
+ equals: "grok-4.3-latest"
18596
+ },
18597
+ {
18598
+ equals: "grok-latest"
18599
+ }
18600
+ ]
18601
+ },
18602
+ context_window: 1e6,
18603
+ prices: {
18604
+ input_mtok: 1.25,
18605
+ cache_read_mtok: 0.2,
18606
+ output_mtok: 2.5
18607
+ }
18608
+ },
18204
18609
  {
18205
18610
  id: "grok-code-fast-1",
18206
18611
  name: "Grok Code Fast 1",
@@ -18228,243 +18633,244 @@ Compared to other leading proprietary and open-weights models Command A delivers
18228
18633
  ]
18229
18634
  }
18230
18635
  ];
18231
- function L(e, t, i) {
18232
- if (t <= 0) return 0;
18233
- let a = e.base;
18234
- for (const o of e.tiers)
18636
+ function S(t, e, i) {
18637
+ if (e <= 0) return 0;
18638
+ let a = t.base;
18639
+ for (const o of t.tiers)
18235
18640
  i > o.start && (a = o.price);
18236
- return a * t / 1e6;
18641
+ return a * e / 1e6;
18237
18642
  }
18238
- function l(e, t, i, a) {
18239
- return e === void 0 || t === void 0 ? 0 : typeof e == "number" ? e * t / 1e6 : L(e, t, a);
18643
+ function d(t, e, i, a) {
18644
+ return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : S(t, e, a);
18240
18645
  }
18241
- function Q(e, t) {
18646
+ function A(t, e) {
18242
18647
  let i = 0, a = 0;
18243
- const o = e.input_tokens ?? 0, s = e.cache_read_tokens ?? 0, m = e.cache_write_tokens ?? 0, n = e.cache_audio_read_tokens ?? 0, r = e.output_audio_tokens ?? 0;
18244
- let u = e.input_audio_tokens ?? 0;
18245
- if (u -= n, u < 0)
18648
+ const o = t.input_tokens ?? 0, r = t.cache_read_tokens ?? 0, m = t.cache_write_tokens ?? 0, n = t.cache_audio_read_tokens ?? 0, s = t.input_audio_tokens ?? 0, p = t.output_audio_tokens ?? 0, u = e.cache_audio_read_mtok === void 0 ? 0 : n, c = e.cache_audio_read_mtok === void 0 && e.cache_read_mtok !== void 0 ? n : 0;
18649
+ let l = 0;
18650
+ if (e.input_audio_mtok !== void 0 && (l = s - u - c), l < 0)
18246
18651
  throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
18247
- let p = e.input_tokens ?? 0;
18248
- if (p -= s, p -= m, p -= u, p < 0)
18249
- throw new Error("Uncached text input tokens cannot be negative");
18250
- let c = s;
18251
- if (c -= n, c < 0)
18652
+ let w = 0;
18653
+ if (e.cache_read_mtok !== void 0 && (w = r - u), w < 0)
18252
18654
  throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
18253
- i += l(t.input_mtok, p, "input_mtok", o), i += l(t.cache_read_mtok, c, "cache_read_mtok", o), i += l(t.cache_write_mtok, m, "cache_write_mtok", o), i += l(t.input_audio_mtok, u, "input_audio_mtok", o), i += l(t.cache_audio_read_mtok, n, "cache_audio_read_mtok", o);
18254
- let _ = e.output_tokens ?? 0;
18255
- if (_ -= r, _ < 0)
18655
+ const M = e.cache_write_mtok === void 0 ? 0 : m;
18656
+ let b = 0;
18657
+ if (e.input_mtok !== void 0 && (b = o - w - M - l - u), b < 0)
18658
+ throw new Error("Uncached text input tokens cannot be negative");
18659
+ i += d(e.input_mtok, b, "input_mtok", o), i += d(e.cache_read_mtok, w, "cache_read_mtok", o), i += d(e.cache_write_mtok, M, "cache_write_mtok", o), i += d(e.input_audio_mtok, l, "input_audio_mtok", o), i += d(e.cache_audio_read_mtok, u, "cache_audio_read_mtok", o);
18660
+ let f = 0;
18661
+ if (e.output_mtok !== void 0 && (f = (t.output_tokens ?? 0) - (e.output_audio_mtok === void 0 ? 0 : p)), f < 0)
18256
18662
  throw new Error("output_audio_tokens cannot be greater than output_tokens");
18257
- a += l(t.output_mtok, _, "output_mtok", o), a += l(t.output_audio_mtok, e.output_audio_tokens, "output_audio_mtok", o);
18258
- let x = i + a;
18259
- return t.requests_kcount !== void 0 && (x += t.requests_kcount / 1e3), {
18663
+ a += d(e.output_mtok, f, "output_mtok", o), a += d(e.output_audio_mtok, t.output_audio_tokens, "output_audio_mtok", o);
18664
+ let y = i + a;
18665
+ return e.requests_kcount !== void 0 && (y += e.requests_kcount / 1e3), {
18260
18666
  input_price: i,
18261
18667
  output_price: a,
18262
- total_price: x
18668
+ total_price: y
18263
18669
  };
18264
18670
  }
18265
- function P(e, t) {
18266
- if (!Array.isArray(e.prices))
18267
- return e.prices;
18268
- for (let i = e.prices.length - 1; i >= 0; i--) {
18269
- const a = e.prices[i], o = a.constraint;
18671
+ function G(t, e) {
18672
+ if (!Array.isArray(t.prices))
18673
+ return t.prices;
18674
+ for (let i = t.prices.length - 1; i >= 0; i--) {
18675
+ const a = t.prices[i], o = a.constraint;
18270
18676
  if (o === void 0)
18271
18677
  return a.prices;
18272
18678
  if (o.type === "start_date") {
18273
- if (t >= new Date(o.start_date))
18679
+ if (e >= new Date(o.start_date))
18274
18680
  return a.prices;
18275
18681
  } else {
18276
- const s = t.toISOString().slice(11, 19), m = o.start_time, n = o.end_time;
18682
+ const r = e.toISOString().slice(11, 19), m = o.start_time, n = o.end_time;
18277
18683
  if (n < m) {
18278
- if (s >= m || s < n)
18684
+ if (r >= m || r < n)
18279
18685
  return a.prices;
18280
- } else if (s >= m && s < n)
18686
+ } else if (r >= m && r < n)
18281
18687
  return a.prices;
18282
18688
  }
18283
18689
  }
18284
- return e.prices[0].prices;
18690
+ return t.prices[0].prices;
18285
18691
  }
18286
- function g(e, t) {
18287
- return "or" in e ? e.or.some((i) => g(i, t)) : "and" in e ? e.and.every((i) => g(i, t)) : "equals" in e ? t === e.equals : "starts_with" in e ? t.startsWith(e.starts_with) : "ends_with" in e ? t.endsWith(e.ends_with) : "contains" in e ? t.includes(e.contains) : "regex" in e ? new RegExp(e.regex).test(t) : !1;
18692
+ function g(t, e) {
18693
+ return "or" in t ? t.or.some((i) => g(i, e)) : "and" in t ? t.and.every((i) => g(i, 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;
18288
18694
  }
18289
- function T(e, t) {
18290
- const i = t.toLowerCase().trim(), a = e.find((o) => o.id === i);
18291
- return a || e.find((o) => o.provider_match && g(o.provider_match, i));
18695
+ function z(t, e) {
18696
+ const i = e.toLowerCase().trim(), a = t.find((o) => o.id === i);
18697
+ return a || t.find((o) => o.provider_match && g(o.provider_match, i));
18292
18698
  }
18293
- function b(e, { modelId: t, providerApiUrl: i, providerId: a }) {
18699
+ function x(t, { modelId: e, providerApiUrl: i, providerId: a }) {
18294
18700
  if (a) {
18295
- const o = T(e, a);
18701
+ const o = z(t, a);
18296
18702
  if (o || a.toLowerCase() !== "litellm")
18297
18703
  return o;
18298
18704
  }
18299
18705
  if (i)
18300
- return e.find((o) => new RegExp(o.api_pattern).test(i));
18301
- if (t)
18302
- return e.find((o) => o.model_match && g(o.model_match, t));
18706
+ return t.find((o) => new RegExp(o.api_pattern).test(i));
18707
+ if (e)
18708
+ return t.find((o) => o.model_match && g(o.model_match, e));
18303
18709
  }
18304
- function S(e, t) {
18305
- return e.find((i) => g(i.match, t));
18710
+ function R(t, e) {
18711
+ return t.find((i) => g(i.match, e));
18306
18712
  }
18307
- function M(e, t, i) {
18308
- const a = S(e.models, t);
18713
+ function P(t, e, i) {
18714
+ const a = R(t.models, e);
18309
18715
  if (a) return a;
18310
- if (e.fallback_model_providers && i)
18311
- for (const o of e.fallback_model_providers) {
18312
- const s = i.find((m) => m.id === o);
18313
- if (s) {
18314
- const m = M(s, t);
18716
+ if (t.fallback_model_providers && i)
18717
+ for (const o of t.fallback_model_providers) {
18718
+ const r = i.find((m) => m.id === o);
18719
+ if (r) {
18720
+ const m = P(r, e);
18315
18721
  if (m) return m;
18316
18722
  }
18317
18723
  }
18318
18724
  }
18319
- const A = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
18320
- let h = I, f = Promise.resolve(I), v = null;
18321
- function G(e) {
18322
- e !== null && ("then" in e ? (f = e, e.then((t) => {
18323
- t !== null && (h = t);
18324
- })) : (f = Promise.resolve(e), h = e));
18725
+ const C = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
18726
+ let h = Q, B = Promise.resolve(Q), I = null;
18727
+ function D(t) {
18728
+ t !== null && ("then" in t ? (B = t, t.then((e) => {
18729
+ e !== null && (h = e);
18730
+ })) : (B = Promise.resolve(t), h = t));
18325
18731
  }
18326
- function z(e) {
18327
- v = e;
18732
+ function N(t) {
18733
+ I = t;
18328
18734
  }
18329
- function N(e) {
18330
- e({
18331
- onCalc: z,
18332
- remoteDataUrl: A,
18333
- setProviderData: G
18735
+ function F(t) {
18736
+ t({
18737
+ onCalc: N,
18738
+ remoteDataUrl: C,
18739
+ setProviderData: D
18334
18740
  });
18335
18741
  }
18336
- function E() {
18337
- return f;
18742
+ function K() {
18743
+ return B;
18338
18744
  }
18339
- function V(e, t, i) {
18340
- v?.();
18341
- let a = t.toLowerCase().trim(), o = i?.providerId;
18745
+ function j(t, e, i) {
18746
+ I?.();
18747
+ let a = e.toLowerCase().trim(), o = i?.providerId;
18342
18748
  if (o && o.toLowerCase() === "litellm" && a.includes("/")) {
18343
- const p = a.indexOf("/"), c = a.slice(0, p), _ = a.slice(p + 1);
18344
- c && _ && b(h, { providerId: c }) && (o = c, a = _);
18749
+ const u = a.indexOf("/"), c = a.slice(0, u), l = a.slice(u + 1);
18750
+ c && l && x(h, { providerId: c }) && (o = c, a = l);
18345
18751
  }
18346
- const s = i?.provider ?? b(h, { modelId: a, providerApiUrl: i?.providerApiUrl, providerId: o });
18347
- if (!s) return null;
18348
- const m = M(s, a, h);
18752
+ const r = i?.provider ?? x(h, { modelId: a, providerApiUrl: i?.providerApiUrl, providerId: o });
18753
+ if (!r) return null;
18754
+ const m = P(r, a, h);
18349
18755
  if (!m) return null;
18350
- const n = i?.timestamp ?? /* @__PURE__ */ new Date(), r = P(m, n), u = Q(e, r);
18756
+ const n = i?.timestamp ?? /* @__PURE__ */ new Date(), s = G(m, n), p = A(t, s);
18351
18757
  return {
18352
18758
  auto_update_timestamp: void 0,
18353
18759
  model: m,
18354
- model_price: r,
18355
- provider: s,
18356
- ...u
18760
+ model_price: s,
18761
+ provider: r,
18762
+ ...p
18357
18763
  };
18358
18764
  }
18359
- function O(e) {
18360
- return v?.(), b(h, e);
18765
+ function H(t) {
18766
+ return I?.(), x(h, t);
18361
18767
  }
18362
- function F(e, t, i) {
18363
- if (i = i ?? "default", !e.extractors)
18768
+ function $(t, e, i) {
18769
+ if (i = i ?? "default", !t.extractors)
18364
18770
  throw new Error("No extraction logic defined for this provider");
18365
- const a = e.extractors.find((r) => r.api_flavor === i);
18771
+ const a = t.extractors.find((s) => s.api_flavor === i);
18366
18772
  if (!a) {
18367
- const r = e.extractors.map((u) => u.api_flavor).join(", ");
18368
- throw new Error(`Unknown apiFlavor '${i}', allowed values: ${r}`);
18773
+ const s = t.extractors.map((p) => p.api_flavor).join(", ");
18774
+ throw new Error(`Unknown apiFlavor '${i}', allowed values: ${s}`);
18369
18775
  }
18370
- if (!q.guard(t))
18371
- throw new Error(`Expected response data to be a mapping object, got ${d(t)}`);
18372
- const o = w(a.model_path, t, C, !1, []), s = y(a.root), m = w(s, t, q, !0, []), n = {};
18373
- for (const r of a.mappings) {
18374
- const u = w(r.path, m, D, r.required, s);
18375
- if (u !== null) {
18376
- const p = n[r.dest] ?? 0;
18377
- n[r.dest] = p + u;
18776
+ if (!q.guard(e))
18777
+ throw new Error(`Expected response data to be a mapping object, got ${_(e)}`);
18778
+ const o = v(a.model_path, e, V, !1, []), r = T(a.root), m = v(r, e, q, !0, []), n = {};
18779
+ for (const s of a.mappings) {
18780
+ const p = v(s.path, m, O, s.required, r);
18781
+ if (p !== null) {
18782
+ const u = n[s.dest] ?? 0;
18783
+ n[s.dest] = u + p;
18378
18784
  }
18379
18785
  }
18380
18786
  if (!Object.keys(n).length)
18381
18787
  throw new Error(`No usage information found at ${JSON.stringify(a.root)}`);
18382
18788
  return { model: o, usage: n };
18383
18789
  }
18384
- function w(e, t, i, a, o) {
18385
- const [s, ...m] = y(e).reverse();
18386
- if (typeof s != "string")
18387
- throw new Error(`Expected last step of path to be a string, got ${d(s)}`);
18790
+ function v(t, e, i, a, o) {
18791
+ const [r, ...m] = T(t).reverse();
18792
+ if (typeof r != "string")
18793
+ throw new Error(`Expected last step of path to be a string, got ${_(r)}`);
18388
18794
  m.reverse();
18389
- let n = t;
18390
- const r = [];
18391
- for (const p of m) {
18392
- if (r.push(p), typeof p == "object")
18795
+ let n = e;
18796
+ const s = [];
18797
+ for (const u of m) {
18798
+ if (s.push(u), typeof u == "object")
18393
18799
  if (Array.isArray(n))
18394
- n = R(p, n);
18800
+ n = E(u, n);
18395
18801
  else {
18396
18802
  if (a)
18397
- throw new Error(`Expected \`${k(o, r)}\` value to be a mapping, got ${d(n)}`);
18803
+ throw new Error(`Expected \`${k(o, s)}\` value to be a mapping, got ${_(n)}`);
18398
18804
  return null;
18399
18805
  }
18400
18806
  else if (q.guard(n))
18401
- n = n[p];
18807
+ n = n[u];
18402
18808
  else {
18403
18809
  if (a)
18404
- throw new Error(`Expected \`${k(o, r)}\` value to be a mapping, got ${d(n)}`);
18810
+ throw new Error(`Expected \`${k(o, s)}\` value to be a mapping, got ${_(n)}`);
18405
18811
  return null;
18406
18812
  }
18407
18813
  if (typeof n > "u")
18408
18814
  if (a) {
18409
- const c = typeof p == "object" ? "Unable to find item" : "Missing value";
18410
- throw new Error(`${c} at \`${k(o, r)}\``);
18815
+ const c = typeof u == "object" ? "Unable to find item" : "Missing value";
18816
+ throw new Error(`${c} at \`${k(o, s)}\``);
18411
18817
  } else
18412
18818
  return null;
18413
18819
  }
18414
18820
  if (!q.guard(n)) {
18415
18821
  if (a)
18416
- throw new Error(`Expected \`${k(o, r)}\` value to be a mapping, got ${d(n)}`);
18822
+ throw new Error(`Expected \`${k(o, s)}\` value to be a mapping, got ${_(n)}`);
18417
18823
  return null;
18418
18824
  }
18419
- const u = n[s];
18420
- if (typeof u > "u") {
18825
+ const p = n[r];
18826
+ if (typeof p > "u") {
18421
18827
  if (a)
18422
- throw r.push(s), new Error(`Missing value at \`${k(o, r)}\``);
18828
+ throw s.push(r), new Error(`Missing value at \`${k(o, s)}\``);
18423
18829
  return null;
18424
18830
  }
18425
- if (i.guard(u))
18426
- return u;
18831
+ if (i.guard(p))
18832
+ return p;
18427
18833
  if (a)
18428
- throw r.push(s), new Error(`Expected \`${k(o, r)}\` value to be a ${i.name}, got ${d(u)}`);
18834
+ throw s.push(r), new Error(`Expected \`${k(o, s)}\` value to be a ${i.name}, got ${_(p)}`);
18429
18835
  return null;
18430
18836
  }
18431
- function R(e, t) {
18432
- for (const i of t)
18837
+ function E(t, e) {
18838
+ for (const i of e)
18433
18839
  if (q.guard(i)) {
18434
- const a = i[e.field];
18435
- if (typeof a == "string" && g(e.match, a))
18840
+ const a = i[t.field];
18841
+ if (typeof a == "string" && g(t.match, a))
18436
18842
  return i;
18437
18843
  }
18438
18844
  }
18439
- function y(e) {
18440
- return Array.isArray(e) ? [...e] : [e];
18845
+ function T(t) {
18846
+ return Array.isArray(t) ? [...t] : [t];
18441
18847
  }
18442
- function d(e) {
18443
- return e === null ? "null" : Array.isArray(e) ? "array" : typeof e == "object" ? "mapping" : typeof e;
18848
+ function _(t) {
18849
+ return t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "mapping" : typeof t;
18444
18850
  }
18445
18851
  const q = {
18446
- guard: (e) => d(e) === "mapping",
18852
+ guard: (t) => _(t) === "mapping",
18447
18853
  name: "mapping"
18448
- }, C = {
18449
- guard: (e) => typeof e == "string",
18854
+ }, V = {
18855
+ guard: (t) => typeof t == "string",
18450
18856
  name: "string"
18451
- }, D = {
18452
- guard: (e) => typeof e == "number",
18857
+ }, O = {
18858
+ guard: (t) => typeof t == "number",
18453
18859
  name: "number"
18454
- }, k = (e, t) => [...e.map(B), ...t.map(B)].join("."), B = (e) => typeof e == "string" ? e : JSON.stringify(e);
18455
- class K {
18860
+ }, k = (t, e) => [...t.map(L), ...e.map(L)].join("."), L = (t) => typeof t == "string" ? t : JSON.stringify(t);
18861
+ class U {
18456
18862
  base;
18457
18863
  tiers;
18458
- constructor(t) {
18459
- this.base = t.base, this.tiers = [...t.tiers].sort((i, a) => i.start - a.start);
18864
+ constructor(e) {
18865
+ this.base = e.base, this.tiers = [...e.tiers].sort((i, a) => i.start - a.start);
18460
18866
  }
18461
18867
  }
18462
18868
  export {
18463
- A as REMOTE_DATA_JSON_URL,
18464
- K as TieredPrices,
18465
- V as calcPrice,
18466
- F as extractUsage,
18467
- O as findProvider,
18468
- N as updatePrices,
18469
- E as waitForUpdate
18869
+ C as REMOTE_DATA_JSON_URL,
18870
+ U as TieredPrices,
18871
+ j as calcPrice,
18872
+ $ as extractUsage,
18873
+ H as findProvider,
18874
+ F as updatePrices,
18875
+ K as waitForUpdate
18470
18876
  };