@pydantic/genai-prices 0.0.42 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +660 -244
- package/dist/index.cjs +3 -3
- package/dist/index.js +469 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47,6 +47,28 @@ const x = [
|
|
|
47
47
|
required: !0
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
api_flavor: "chat",
|
|
53
|
+
root: "usage",
|
|
54
|
+
model_path: "model",
|
|
55
|
+
mappings: [
|
|
56
|
+
{
|
|
57
|
+
path: "prompt_tokens",
|
|
58
|
+
dest: "input_tokens",
|
|
59
|
+
required: !0
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
path: "cached_tokens",
|
|
63
|
+
dest: "cache_read_tokens",
|
|
64
|
+
required: !1
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
path: "completion_tokens",
|
|
68
|
+
dest: "output_tokens",
|
|
69
|
+
required: !0
|
|
70
|
+
}
|
|
71
|
+
]
|
|
50
72
|
}
|
|
51
73
|
],
|
|
52
74
|
models: [
|
|
@@ -596,24 +618,50 @@ const x = [
|
|
|
596
618
|
}
|
|
597
619
|
},
|
|
598
620
|
{
|
|
599
|
-
id: "
|
|
600
|
-
name: "
|
|
621
|
+
id: "deepseek.r1-v1:0",
|
|
622
|
+
name: "DeepSeek-R1",
|
|
601
623
|
match: {
|
|
602
|
-
contains: "
|
|
624
|
+
contains: "r1"
|
|
603
625
|
},
|
|
604
626
|
prices: {
|
|
605
|
-
input_mtok:
|
|
627
|
+
input_mtok: 1.35,
|
|
628
|
+
output_mtok: 5.4
|
|
606
629
|
}
|
|
607
630
|
},
|
|
608
631
|
{
|
|
609
|
-
id: "
|
|
610
|
-
name: "DeepSeek-R1",
|
|
632
|
+
id: "global.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
611
633
|
match: {
|
|
612
|
-
|
|
634
|
+
starts_with: "global.anthropic.claude-haiku-4-5-20251001-v1"
|
|
613
635
|
},
|
|
614
636
|
prices: {
|
|
615
|
-
input_mtok: 1
|
|
616
|
-
|
|
637
|
+
input_mtok: 1,
|
|
638
|
+
cache_write_mtok: 1.25,
|
|
639
|
+
cache_read_mtok: 0.1,
|
|
640
|
+
output_mtok: 5
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
id: "global.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
645
|
+
match: {
|
|
646
|
+
starts_with: "global.anthropic.claude-sonnet-4-20250514-v1"
|
|
647
|
+
},
|
|
648
|
+
prices: {
|
|
649
|
+
input_mtok: 3,
|
|
650
|
+
cache_write_mtok: 3.75,
|
|
651
|
+
cache_read_mtok: 0.3,
|
|
652
|
+
output_mtok: 15
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
id: "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
657
|
+
match: {
|
|
658
|
+
starts_with: "global.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
659
|
+
},
|
|
660
|
+
prices: {
|
|
661
|
+
input_mtok: 3,
|
|
662
|
+
cache_write_mtok: 3.75,
|
|
663
|
+
cache_read_mtok: 0.3,
|
|
664
|
+
output_mtok: 15
|
|
617
665
|
}
|
|
618
666
|
},
|
|
619
667
|
{
|
|
@@ -835,6 +883,374 @@ const x = [
|
|
|
835
883
|
input_mtok: 0.15,
|
|
836
884
|
output_mtok: 0.6
|
|
837
885
|
}
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
id: "regional.anthropic.claude-3-5-haiku-20241022-v1:0",
|
|
889
|
+
match: {
|
|
890
|
+
or: [
|
|
891
|
+
{
|
|
892
|
+
starts_with: "us.anthropic.claude-3-5-haiku-20241022-v1"
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
starts_with: "au.anthropic.claude-3-5-haiku-20241022-v1"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
starts_with: "apac.anthropic.claude-3-5-haiku-20241022-v1"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
starts_with: "eu.anthropic.claude-3-5-haiku-20241022-v1"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
starts_with: "us-gov.anthropic.claude-3-5-haiku-20241022-v1"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
starts_with: "jp.anthropic.claude-3-5-haiku-20241022-v1"
|
|
908
|
+
}
|
|
909
|
+
]
|
|
910
|
+
},
|
|
911
|
+
prices: {
|
|
912
|
+
input_mtok: 0.8,
|
|
913
|
+
cache_write_mtok: 1,
|
|
914
|
+
cache_read_mtok: 0.08,
|
|
915
|
+
output_mtok: 4
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
id: "regional.anthropic.claude-3-5-sonnet-20240620-v1:0",
|
|
920
|
+
match: {
|
|
921
|
+
or: [
|
|
922
|
+
{
|
|
923
|
+
starts_with: "us.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
starts_with: "au.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
starts_with: "apac.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
starts_with: "eu.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
starts_with: "us-gov.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
starts_with: "jp.anthropic.claude-3-5-sonnet-20240620-v1"
|
|
939
|
+
}
|
|
940
|
+
]
|
|
941
|
+
},
|
|
942
|
+
prices: {
|
|
943
|
+
input_mtok: 3,
|
|
944
|
+
cache_write_mtok: 3.75,
|
|
945
|
+
cache_read_mtok: 0.3,
|
|
946
|
+
output_mtok: 15
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
id: "regional.anthropic.claude-3-5-sonnet-20241022-v2:0",
|
|
951
|
+
match: {
|
|
952
|
+
or: [
|
|
953
|
+
{
|
|
954
|
+
starts_with: "us.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
starts_with: "au.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
starts_with: "apac.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
starts_with: "eu.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
starts_with: "us-gov.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
starts_with: "jp.anthropic.claude-3-5-sonnet-20241022-v2"
|
|
970
|
+
}
|
|
971
|
+
]
|
|
972
|
+
},
|
|
973
|
+
prices: {
|
|
974
|
+
input_mtok: 3,
|
|
975
|
+
cache_write_mtok: 3.75,
|
|
976
|
+
cache_read_mtok: 0.3,
|
|
977
|
+
output_mtok: 15
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
id: "regional.anthropic.claude-3-7-sonnet-20250219-v1:0",
|
|
982
|
+
match: {
|
|
983
|
+
or: [
|
|
984
|
+
{
|
|
985
|
+
starts_with: "us.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
starts_with: "au.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
starts_with: "apac.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
starts_with: "eu.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
starts_with: "us-gov.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
starts_with: "jp.anthropic.claude-3-7-sonnet-20250219-v1"
|
|
1001
|
+
}
|
|
1002
|
+
]
|
|
1003
|
+
},
|
|
1004
|
+
prices: {
|
|
1005
|
+
input_mtok: 3,
|
|
1006
|
+
cache_write_mtok: 3.75,
|
|
1007
|
+
cache_read_mtok: 0.3,
|
|
1008
|
+
output_mtok: 15
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
id: "regional.anthropic.claude-3-haiku-20240307-v1:0",
|
|
1013
|
+
match: {
|
|
1014
|
+
or: [
|
|
1015
|
+
{
|
|
1016
|
+
starts_with: "us.anthropic.claude-3-haiku-20240307-v1"
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
starts_with: "au.anthropic.claude-3-haiku-20240307-v1"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
starts_with: "apac.anthropic.claude-3-haiku-20240307-v1"
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
starts_with: "eu.anthropic.claude-3-haiku-20240307-v1"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
starts_with: "us-gov.anthropic.claude-3-haiku-20240307-v1"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
starts_with: "jp.anthropic.claude-3-haiku-20240307-v1"
|
|
1032
|
+
}
|
|
1033
|
+
]
|
|
1034
|
+
},
|
|
1035
|
+
prices: {
|
|
1036
|
+
input_mtok: 0.25,
|
|
1037
|
+
output_mtok: 1.25
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
id: "regional.anthropic.claude-3-opus-20240229-v1:0",
|
|
1042
|
+
match: {
|
|
1043
|
+
or: [
|
|
1044
|
+
{
|
|
1045
|
+
starts_with: "us.anthropic.claude-3-opus-20240229-v1"
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
starts_with: "au.anthropic.claude-3-opus-20240229-v1"
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
starts_with: "apac.anthropic.claude-3-opus-20240229-v1"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
starts_with: "eu.anthropic.claude-3-opus-20240229-v1"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
starts_with: "us-gov.anthropic.claude-3-opus-20240229-v1"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
starts_with: "jp.anthropic.claude-3-opus-20240229-v1"
|
|
1061
|
+
}
|
|
1062
|
+
]
|
|
1063
|
+
},
|
|
1064
|
+
prices: {
|
|
1065
|
+
input_mtok: 15,
|
|
1066
|
+
output_mtok: 75
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
id: "regional.anthropic.claude-3-sonnet-20240229-v1:0",
|
|
1071
|
+
match: {
|
|
1072
|
+
or: [
|
|
1073
|
+
{
|
|
1074
|
+
starts_with: "us.anthropic.claude-3-sonnet-20240229-v1"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
starts_with: "au.anthropic.claude-3-sonnet-20240229-v1"
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
starts_with: "apac.anthropic.claude-3-sonnet-20240229-v1"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
starts_with: "eu.anthropic.claude-3-sonnet-20240229-v1"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
starts_with: "us-gov.anthropic.claude-3-sonnet-20240229-v1"
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
starts_with: "jp.anthropic.claude-3-sonnet-20240229-v1"
|
|
1090
|
+
}
|
|
1091
|
+
]
|
|
1092
|
+
},
|
|
1093
|
+
prices: {
|
|
1094
|
+
input_mtok: 3,
|
|
1095
|
+
cache_write_mtok: 3.75,
|
|
1096
|
+
cache_read_mtok: 0.3,
|
|
1097
|
+
output_mtok: 15
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
id: "regional.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
1102
|
+
match: {
|
|
1103
|
+
or: [
|
|
1104
|
+
{
|
|
1105
|
+
starts_with: "us.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
starts_with: "au.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
starts_with: "apac.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
starts_with: "eu.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
starts_with: "us-gov.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
starts_with: "jp.anthropic.claude-haiku-4-5-20251001-v1"
|
|
1121
|
+
}
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
prices: {
|
|
1125
|
+
input_mtok: 1.1,
|
|
1126
|
+
cache_write_mtok: 1.375,
|
|
1127
|
+
cache_read_mtok: 0.11,
|
|
1128
|
+
output_mtok: 5.5
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
id: "regional.anthropic.claude-opus-4-1-20250805-v1:0",
|
|
1133
|
+
match: {
|
|
1134
|
+
or: [
|
|
1135
|
+
{
|
|
1136
|
+
starts_with: "us.anthropic.claude-opus-4-1-20250805-v1"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
starts_with: "au.anthropic.claude-opus-4-1-20250805-v1"
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
starts_with: "apac.anthropic.claude-opus-4-1-20250805-v1"
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
starts_with: "eu.anthropic.claude-opus-4-1-20250805-v1"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
starts_with: "us-gov.anthropic.claude-opus-4-1-20250805-v1"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
starts_with: "jp.anthropic.claude-opus-4-1-20250805-v1"
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1155
|
+
prices: {
|
|
1156
|
+
input_mtok: 15,
|
|
1157
|
+
cache_write_mtok: 18.75,
|
|
1158
|
+
cache_read_mtok: 1.5,
|
|
1159
|
+
output_mtok: 75
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
id: "regional.anthropic.claude-opus-4-20250514-v1:0",
|
|
1164
|
+
match: {
|
|
1165
|
+
or: [
|
|
1166
|
+
{
|
|
1167
|
+
starts_with: "us.anthropic.claude-opus-4-20250514-v1"
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
starts_with: "au.anthropic.claude-opus-4-20250514-v1"
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
starts_with: "apac.anthropic.claude-opus-4-20250514-v1"
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
starts_with: "eu.anthropic.claude-opus-4-20250514-v1"
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
starts_with: "us-gov.anthropic.claude-opus-4-20250514-v1"
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
starts_with: "jp.anthropic.claude-opus-4-20250514-v1"
|
|
1183
|
+
}
|
|
1184
|
+
]
|
|
1185
|
+
},
|
|
1186
|
+
prices: {
|
|
1187
|
+
input_mtok: 15,
|
|
1188
|
+
cache_write_mtok: 18.75,
|
|
1189
|
+
cache_read_mtok: 1.5,
|
|
1190
|
+
output_mtok: 75
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
id: "regional.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
1195
|
+
match: {
|
|
1196
|
+
or: [
|
|
1197
|
+
{
|
|
1198
|
+
starts_with: "us.anthropic.claude-sonnet-4-20250514-v1"
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
starts_with: "au.anthropic.claude-sonnet-4-20250514-v1"
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
starts_with: "apac.anthropic.claude-sonnet-4-20250514-v1"
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
starts_with: "eu.anthropic.claude-sonnet-4-20250514-v1"
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
starts_with: "us-gov.anthropic.claude-sonnet-4-20250514-v1"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
starts_with: "jp.anthropic.claude-sonnet-4-20250514-v1"
|
|
1214
|
+
}
|
|
1215
|
+
]
|
|
1216
|
+
},
|
|
1217
|
+
prices: {
|
|
1218
|
+
input_mtok: 3,
|
|
1219
|
+
cache_write_mtok: 3.75,
|
|
1220
|
+
cache_read_mtok: 0.3,
|
|
1221
|
+
output_mtok: 15
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
id: "regional.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
1226
|
+
match: {
|
|
1227
|
+
or: [
|
|
1228
|
+
{
|
|
1229
|
+
starts_with: "us.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
starts_with: "au.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
starts_with: "apac.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
starts_with: "eu.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
starts_with: "us-gov.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
starts_with: "jp.anthropic.claude-sonnet-4-5-20250929-v1"
|
|
1245
|
+
}
|
|
1246
|
+
]
|
|
1247
|
+
},
|
|
1248
|
+
prices: {
|
|
1249
|
+
input_mtok: 3.3,
|
|
1250
|
+
cache_write_mtok: 4.125,
|
|
1251
|
+
cache_read_mtok: 0.33,
|
|
1252
|
+
output_mtok: 16.5
|
|
1253
|
+
}
|
|
838
1254
|
}
|
|
839
1255
|
]
|
|
840
1256
|
},
|
|
@@ -12238,34 +12654,34 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
12238
12654
|
function M(t, e) {
|
|
12239
12655
|
if (e <= 0) return 0;
|
|
12240
12656
|
let a = 0;
|
|
12241
|
-
const i = [...t.tiers].sort((
|
|
12242
|
-
a +=
|
|
12243
|
-
for (let
|
|
12244
|
-
const s = i[
|
|
12657
|
+
const i = [...t.tiers].sort((m, s) => m.start - s.start), o = i[0]?.start ?? e, r = Math.min(e, o);
|
|
12658
|
+
a += r * t.base / 1e6;
|
|
12659
|
+
for (let m = 0; m < i.length; m++) {
|
|
12660
|
+
const s = i[m], n = i[m + 1]?.start ?? 1 / 0, u = Math.max(0, Math.min(e, n) - s.start);
|
|
12245
12661
|
u > 0 && (a += u * s.price / 1e6);
|
|
12246
12662
|
}
|
|
12247
12663
|
return a;
|
|
12248
12664
|
}
|
|
12249
|
-
function
|
|
12665
|
+
function c(t, e, a) {
|
|
12250
12666
|
return t === void 0 || e === void 0 ? 0 : typeof t == "number" ? t * e / 1e6 : M(t, e);
|
|
12251
12667
|
}
|
|
12252
12668
|
function I(t, e) {
|
|
12253
12669
|
let a = 0, i = 0;
|
|
12254
|
-
const o = t.cache_read_tokens ?? 0,
|
|
12670
|
+
const o = t.cache_read_tokens ?? 0, r = t.cache_write_tokens ?? 0, m = t.cache_audio_read_tokens ?? 0, s = t.output_audio_tokens ?? 0;
|
|
12255
12671
|
let n = t.input_audio_tokens ?? 0;
|
|
12256
|
-
if (n -=
|
|
12672
|
+
if (n -= m, n < 0)
|
|
12257
12673
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
12258
12674
|
let u = t.input_tokens ?? 0;
|
|
12259
|
-
if (u -= o, u -=
|
|
12675
|
+
if (u -= o, u -= r, u -= n, u < 0)
|
|
12260
12676
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
12261
12677
|
let p = o;
|
|
12262
|
-
if (p -=
|
|
12678
|
+
if (p -= m, p < 0)
|
|
12263
12679
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
12264
|
-
a +=
|
|
12265
|
-
let
|
|
12266
|
-
if (
|
|
12680
|
+
a += c(e.input_mtok, u), a += c(e.cache_read_mtok, p), a += c(e.cache_write_mtok, r), a += c(e.input_audio_mtok, n), a += c(e.cache_audio_read_mtok, m);
|
|
12681
|
+
let _ = t.output_tokens ?? 0;
|
|
12682
|
+
if (_ -= s, _ < 0)
|
|
12267
12683
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
12268
|
-
i +=
|
|
12684
|
+
i += c(e.output_mtok, _), i += c(e.output_audio_mtok, t.output_audio_tokens);
|
|
12269
12685
|
let w = a + i;
|
|
12270
12686
|
return e.requests_kcount !== void 0 && (w += e.requests_kcount / 1e3), {
|
|
12271
12687
|
input_price: a,
|
|
@@ -12284,11 +12700,11 @@ function L(t, e) {
|
|
|
12284
12700
|
if (e >= new Date(o.start_date))
|
|
12285
12701
|
return i.prices;
|
|
12286
12702
|
} else {
|
|
12287
|
-
const
|
|
12288
|
-
if (s <
|
|
12289
|
-
if (
|
|
12703
|
+
const r = e.toISOString().slice(11, 19), m = o.start_time, s = o.end_time;
|
|
12704
|
+
if (s < m) {
|
|
12705
|
+
if (r >= m || r < s)
|
|
12290
12706
|
return i.prices;
|
|
12291
|
-
} else if (
|
|
12707
|
+
} else if (r >= m && r < s)
|
|
12292
12708
|
return i.prices;
|
|
12293
12709
|
}
|
|
12294
12710
|
}
|
|
@@ -12336,12 +12752,12 @@ function O(t, e, a) {
|
|
|
12336
12752
|
f?.();
|
|
12337
12753
|
const i = e.toLowerCase().trim(), o = a?.provider ?? B(g, { modelId: i, providerApiUrl: a?.providerApiUrl, providerId: a?.providerId });
|
|
12338
12754
|
if (!o) return null;
|
|
12339
|
-
const
|
|
12340
|
-
if (!
|
|
12341
|
-
const
|
|
12755
|
+
const r = T(o.models, i);
|
|
12756
|
+
if (!r) return null;
|
|
12757
|
+
const m = a?.timestamp ?? /* @__PURE__ */ new Date(), s = L(r, m), n = I(t, s);
|
|
12342
12758
|
return {
|
|
12343
12759
|
auto_update_timestamp: void 0,
|
|
12344
|
-
model:
|
|
12760
|
+
model: r,
|
|
12345
12761
|
model_price: s,
|
|
12346
12762
|
provider: o,
|
|
12347
12763
|
...n
|
|
@@ -12358,11 +12774,11 @@ function E(t, e, a) {
|
|
|
12358
12774
|
const n = t.extractors.map((u) => u.api_flavor).join(", ");
|
|
12359
12775
|
throw new Error(`Unknown apiFlavor '${a}', allowed values: ${n}`);
|
|
12360
12776
|
}
|
|
12361
|
-
if (!
|
|
12362
|
-
throw new Error(`Expected response data to be a mapping object, got ${
|
|
12363
|
-
const o = q(i.model_path, e, R, !1, []),
|
|
12777
|
+
if (!k.guard(e))
|
|
12778
|
+
throw new Error(`Expected response data to be a mapping object, got ${l(e)}`);
|
|
12779
|
+
const o = q(i.model_path, e, R, !1, []), r = y(i.root), m = q(r, e, k, !0, []), s = {};
|
|
12364
12780
|
for (const n of i.mappings) {
|
|
12365
|
-
const u = q(n.path,
|
|
12781
|
+
const u = q(n.path, m, z, n.required, r);
|
|
12366
12782
|
if (u !== null) {
|
|
12367
12783
|
const p = s[n.dest] ?? 0;
|
|
12368
12784
|
s[n.dest] = p + u;
|
|
@@ -12373,55 +12789,55 @@ function E(t, e, a) {
|
|
|
12373
12789
|
return { model: o, usage: s };
|
|
12374
12790
|
}
|
|
12375
12791
|
function q(t, e, a, i, o) {
|
|
12376
|
-
const [
|
|
12377
|
-
if (typeof
|
|
12378
|
-
throw new Error(`Expected last step of path to be a string, got ${
|
|
12379
|
-
|
|
12792
|
+
const [r, ...m] = y(t).reverse();
|
|
12793
|
+
if (typeof r != "string")
|
|
12794
|
+
throw new Error(`Expected last step of path to be a string, got ${l(r)}`);
|
|
12795
|
+
m.reverse();
|
|
12380
12796
|
let s = e;
|
|
12381
12797
|
const n = [];
|
|
12382
|
-
for (const p of
|
|
12798
|
+
for (const p of m) {
|
|
12383
12799
|
if (n.push(p), typeof p == "object")
|
|
12384
12800
|
if (Array.isArray(s))
|
|
12385
12801
|
s = A(p, s);
|
|
12386
12802
|
else {
|
|
12387
12803
|
if (i)
|
|
12388
|
-
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${
|
|
12804
|
+
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${l(s)}`);
|
|
12389
12805
|
return null;
|
|
12390
12806
|
}
|
|
12391
|
-
else if (
|
|
12807
|
+
else if (k.guard(s))
|
|
12392
12808
|
s = s[p];
|
|
12393
12809
|
else {
|
|
12394
12810
|
if (i)
|
|
12395
|
-
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${
|
|
12811
|
+
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${l(s)}`);
|
|
12396
12812
|
return null;
|
|
12397
12813
|
}
|
|
12398
12814
|
if (typeof s > "u")
|
|
12399
12815
|
if (i) {
|
|
12400
|
-
const
|
|
12401
|
-
throw new Error(`${
|
|
12816
|
+
const _ = typeof p == "object" ? "Unable to find item" : "Missing value";
|
|
12817
|
+
throw new Error(`${_} at \`${d(o, n)}\``);
|
|
12402
12818
|
} else
|
|
12403
12819
|
return null;
|
|
12404
12820
|
}
|
|
12405
|
-
if (!
|
|
12821
|
+
if (!k.guard(s)) {
|
|
12406
12822
|
if (i)
|
|
12407
|
-
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${
|
|
12823
|
+
throw new Error(`Expected \`${d(o, n)}\` value to be a mapping, got ${l(s)}`);
|
|
12408
12824
|
return null;
|
|
12409
12825
|
}
|
|
12410
|
-
const u = s[
|
|
12826
|
+
const u = s[r];
|
|
12411
12827
|
if (typeof u > "u") {
|
|
12412
12828
|
if (i)
|
|
12413
|
-
throw n.push(
|
|
12829
|
+
throw n.push(r), new Error(`Missing value at \`${d(o, n)}\``);
|
|
12414
12830
|
return null;
|
|
12415
12831
|
}
|
|
12416
12832
|
if (a.guard(u))
|
|
12417
12833
|
return u;
|
|
12418
12834
|
if (i)
|
|
12419
|
-
throw n.push(
|
|
12835
|
+
throw n.push(r), new Error(`Expected \`${d(o, n)}\` value to be a ${a.name}, got ${l(u)}`);
|
|
12420
12836
|
return null;
|
|
12421
12837
|
}
|
|
12422
12838
|
function A(t, e) {
|
|
12423
12839
|
for (const a of e)
|
|
12424
|
-
if (
|
|
12840
|
+
if (k.guard(a)) {
|
|
12425
12841
|
const i = a[t.field];
|
|
12426
12842
|
if (typeof i == "string" && h(t.match, i))
|
|
12427
12843
|
return a;
|
|
@@ -12430,11 +12846,11 @@ function A(t, e) {
|
|
|
12430
12846
|
function y(t) {
|
|
12431
12847
|
return Array.isArray(t) ? [...t] : [t];
|
|
12432
12848
|
}
|
|
12433
|
-
function
|
|
12849
|
+
function l(t) {
|
|
12434
12850
|
return t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "mapping" : typeof t;
|
|
12435
12851
|
}
|
|
12436
|
-
const
|
|
12437
|
-
guard: (t) =>
|
|
12852
|
+
const k = {
|
|
12853
|
+
guard: (t) => l(t) === "mapping",
|
|
12438
12854
|
name: "mapping"
|
|
12439
12855
|
}, R = {
|
|
12440
12856
|
guard: (t) => typeof t == "string",
|