@pydantic/genai-prices 0.0.63 → 0.0.65
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 +339 -92
- package/dist/index.cjs +2 -2
- package/dist/index.js +265 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2761,6 +2761,253 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2761
2761
|
}
|
|
2762
2762
|
]
|
|
2763
2763
|
},
|
|
2764
|
+
{
|
|
2765
|
+
id: "doubleword",
|
|
2766
|
+
name: "Doubleword",
|
|
2767
|
+
pricing_urls: ["https://docs.doubleword.ai/inference-api/models"],
|
|
2768
|
+
api_pattern: "https://api\\.doubleword\\.ai",
|
|
2769
|
+
price_comments: "Doubleword publishes Realtime, Async, and Batch prices. This provider currently encodes only Realtime pricing.",
|
|
2770
|
+
extractors: [
|
|
2771
|
+
{
|
|
2772
|
+
api_flavor: "chat",
|
|
2773
|
+
root: "usage",
|
|
2774
|
+
model_path: "model",
|
|
2775
|
+
mappings: [
|
|
2776
|
+
{
|
|
2777
|
+
path: "prompt_tokens",
|
|
2778
|
+
dest: "input_tokens",
|
|
2779
|
+
required: !0
|
|
2780
|
+
},
|
|
2781
|
+
{
|
|
2782
|
+
path: ["prompt_tokens_details", "cached_tokens"],
|
|
2783
|
+
dest: "cache_read_tokens",
|
|
2784
|
+
required: !1
|
|
2785
|
+
},
|
|
2786
|
+
{
|
|
2787
|
+
path: ["prompt_tokens_details", "cache_write_tokens"],
|
|
2788
|
+
dest: "cache_write_tokens",
|
|
2789
|
+
required: !1
|
|
2790
|
+
},
|
|
2791
|
+
{
|
|
2792
|
+
path: "completion_tokens",
|
|
2793
|
+
dest: "output_tokens",
|
|
2794
|
+
required: !0
|
|
2795
|
+
}
|
|
2796
|
+
]
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
api_flavor: "responses",
|
|
2800
|
+
root: "usage",
|
|
2801
|
+
model_path: "model",
|
|
2802
|
+
mappings: [
|
|
2803
|
+
{
|
|
2804
|
+
path: "input_tokens",
|
|
2805
|
+
dest: "input_tokens",
|
|
2806
|
+
required: !0
|
|
2807
|
+
},
|
|
2808
|
+
{
|
|
2809
|
+
path: ["input_tokens_details", "cached_tokens"],
|
|
2810
|
+
dest: "cache_read_tokens",
|
|
2811
|
+
required: !1
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
path: "output_tokens",
|
|
2815
|
+
dest: "output_tokens",
|
|
2816
|
+
required: !0
|
|
2817
|
+
}
|
|
2818
|
+
]
|
|
2819
|
+
},
|
|
2820
|
+
{
|
|
2821
|
+
api_flavor: "embeddings",
|
|
2822
|
+
root: "usage",
|
|
2823
|
+
model_path: "model",
|
|
2824
|
+
mappings: [
|
|
2825
|
+
{
|
|
2826
|
+
path: "prompt_tokens",
|
|
2827
|
+
dest: "input_tokens",
|
|
2828
|
+
required: !0
|
|
2829
|
+
}
|
|
2830
|
+
]
|
|
2831
|
+
}
|
|
2832
|
+
],
|
|
2833
|
+
models: [
|
|
2834
|
+
{
|
|
2835
|
+
id: "Qwen/Qwen3-14B-FP8",
|
|
2836
|
+
name: "Qwen3 14B",
|
|
2837
|
+
match: {
|
|
2838
|
+
equals: "Qwen/Qwen3-14B-FP8"
|
|
2839
|
+
},
|
|
2840
|
+
prices: {
|
|
2841
|
+
input_mtok: 0.05,
|
|
2842
|
+
output_mtok: 0.6
|
|
2843
|
+
}
|
|
2844
|
+
},
|
|
2845
|
+
{
|
|
2846
|
+
id: "Qwen/Qwen3-Embedding-8B",
|
|
2847
|
+
name: "Qwen3 Embedding 8B",
|
|
2848
|
+
match: {
|
|
2849
|
+
equals: "Qwen/Qwen3-Embedding-8B"
|
|
2850
|
+
},
|
|
2851
|
+
prices: {
|
|
2852
|
+
input_mtok: 0.04
|
|
2853
|
+
}
|
|
2854
|
+
},
|
|
2855
|
+
{
|
|
2856
|
+
id: "Qwen/Qwen3-VL-235B-A22B-Instruct-FP8",
|
|
2857
|
+
name: "Qwen3 VL 235B A22B Instruct",
|
|
2858
|
+
match: {
|
|
2859
|
+
equals: "Qwen/Qwen3-VL-235B-A22B-Instruct-FP8"
|
|
2860
|
+
},
|
|
2861
|
+
prices: {
|
|
2862
|
+
input_mtok: 0.6,
|
|
2863
|
+
output_mtok: 1.2
|
|
2864
|
+
}
|
|
2865
|
+
},
|
|
2866
|
+
{
|
|
2867
|
+
id: "Qwen/Qwen3-VL-30B-A3B-Instruct-FP8",
|
|
2868
|
+
name: "Qwen3 VL 30B A3B Instruct",
|
|
2869
|
+
match: {
|
|
2870
|
+
equals: "Qwen/Qwen3-VL-30B-A3B-Instruct-FP8"
|
|
2871
|
+
},
|
|
2872
|
+
prices: {
|
|
2873
|
+
input_mtok: 0.16,
|
|
2874
|
+
output_mtok: 0.8
|
|
2875
|
+
}
|
|
2876
|
+
},
|
|
2877
|
+
{
|
|
2878
|
+
id: "Qwen/Qwen3.5-35B-A3B-FP8",
|
|
2879
|
+
name: "Qwen3.5 35B A3B",
|
|
2880
|
+
match: {
|
|
2881
|
+
equals: "Qwen/Qwen3.5-35B-A3B-FP8"
|
|
2882
|
+
},
|
|
2883
|
+
prices: {
|
|
2884
|
+
input_mtok: 0.25,
|
|
2885
|
+
output_mtok: 2
|
|
2886
|
+
}
|
|
2887
|
+
},
|
|
2888
|
+
{
|
|
2889
|
+
id: "Qwen/Qwen3.5-397B-A17B",
|
|
2890
|
+
name: "Qwen3.5 397B A17B",
|
|
2891
|
+
match: {
|
|
2892
|
+
equals: "Qwen/Qwen3.5-397B-A17B"
|
|
2893
|
+
},
|
|
2894
|
+
prices: {
|
|
2895
|
+
input_mtok: 0.6,
|
|
2896
|
+
output_mtok: 3.6
|
|
2897
|
+
}
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
id: "Qwen/Qwen3.5-9B",
|
|
2901
|
+
name: "Qwen3.5 9B",
|
|
2902
|
+
match: {
|
|
2903
|
+
equals: "Qwen/Qwen3.5-9B"
|
|
2904
|
+
},
|
|
2905
|
+
prices: {
|
|
2906
|
+
input_mtok: 0.08,
|
|
2907
|
+
output_mtok: 0.7
|
|
2908
|
+
}
|
|
2909
|
+
},
|
|
2910
|
+
{
|
|
2911
|
+
id: "Qwen/Qwen3.6-35B-A3B-FP8",
|
|
2912
|
+
name: "Qwen3.6 35B A3B",
|
|
2913
|
+
match: {
|
|
2914
|
+
equals: "Qwen/Qwen3.6-35B-A3B-FP8"
|
|
2915
|
+
},
|
|
2916
|
+
prices: {
|
|
2917
|
+
input_mtok: 0.25,
|
|
2918
|
+
output_mtok: 2
|
|
2919
|
+
}
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
id: "deepseek-ai/DeepSeek-V4-Flash",
|
|
2923
|
+
name: "DeepSeek V4 Flash",
|
|
2924
|
+
match: {
|
|
2925
|
+
equals: "deepseek-ai/DeepSeek-V4-Flash"
|
|
2926
|
+
},
|
|
2927
|
+
prices: {
|
|
2928
|
+
input_mtok: 0.14,
|
|
2929
|
+
output_mtok: 0.28
|
|
2930
|
+
}
|
|
2931
|
+
},
|
|
2932
|
+
{
|
|
2933
|
+
id: "deepseek-ai/DeepSeek-V4-Pro",
|
|
2934
|
+
name: "DeepSeek V4 Pro",
|
|
2935
|
+
match: {
|
|
2936
|
+
equals: "deepseek-ai/DeepSeek-V4-Pro"
|
|
2937
|
+
},
|
|
2938
|
+
prices: {
|
|
2939
|
+
input_mtok: 1.74,
|
|
2940
|
+
output_mtok: 3.48
|
|
2941
|
+
}
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
id: "google/gemma-4-31B-it",
|
|
2945
|
+
name: "Gemma 4 31B IT",
|
|
2946
|
+
match: {
|
|
2947
|
+
equals: "google/gemma-4-31B-it"
|
|
2948
|
+
},
|
|
2949
|
+
prices: {
|
|
2950
|
+
input_mtok: 0.14,
|
|
2951
|
+
output_mtok: 0.4
|
|
2952
|
+
}
|
|
2953
|
+
},
|
|
2954
|
+
{
|
|
2955
|
+
id: "mistralai/Devstral-2-123B-Instruct-2512",
|
|
2956
|
+
name: "Devstral 2 123B Instruct 2512",
|
|
2957
|
+
match: {
|
|
2958
|
+
equals: "mistralai/Devstral-2-123B-Instruct-2512"
|
|
2959
|
+
},
|
|
2960
|
+
prices: {
|
|
2961
|
+
input_mtok: 0.4,
|
|
2962
|
+
output_mtok: 2
|
|
2963
|
+
}
|
|
2964
|
+
},
|
|
2965
|
+
{
|
|
2966
|
+
id: "moonshotai/Kimi-K2.6",
|
|
2967
|
+
name: "Kimi K2.6",
|
|
2968
|
+
match: {
|
|
2969
|
+
equals: "moonshotai/Kimi-K2.6"
|
|
2970
|
+
},
|
|
2971
|
+
prices: {
|
|
2972
|
+
input_mtok: 0.95,
|
|
2973
|
+
output_mtok: 4
|
|
2974
|
+
}
|
|
2975
|
+
},
|
|
2976
|
+
{
|
|
2977
|
+
id: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4",
|
|
2978
|
+
name: "Nemotron 3 Super 120B A12B",
|
|
2979
|
+
match: {
|
|
2980
|
+
equals: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4"
|
|
2981
|
+
},
|
|
2982
|
+
prices: {
|
|
2983
|
+
input_mtok: 0.3,
|
|
2984
|
+
output_mtok: 0.75
|
|
2985
|
+
}
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
id: "openai/gpt-oss-20b",
|
|
2989
|
+
name: "GPT OSS 20B",
|
|
2990
|
+
match: {
|
|
2991
|
+
equals: "openai/gpt-oss-20b"
|
|
2992
|
+
},
|
|
2993
|
+
prices: {
|
|
2994
|
+
input_mtok: 0.04,
|
|
2995
|
+
output_mtok: 0.3
|
|
2996
|
+
}
|
|
2997
|
+
},
|
|
2998
|
+
{
|
|
2999
|
+
id: "zai-org/GLM-5.1-FP8",
|
|
3000
|
+
name: "GLM 5.1",
|
|
3001
|
+
match: {
|
|
3002
|
+
equals: "zai-org/GLM-5.1-FP8"
|
|
3003
|
+
},
|
|
3004
|
+
prices: {
|
|
3005
|
+
input_mtok: 1.4,
|
|
3006
|
+
output_mtok: 4.4
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
]
|
|
3010
|
+
},
|
|
2764
3011
|
{
|
|
2765
3012
|
id: "fireworks",
|
|
2766
3013
|
name: "Fireworks",
|
|
@@ -18929,11 +19176,11 @@ function A(t, e) {
|
|
|
18929
19176
|
if (e.output_mtok !== void 0 && (f = (t.output_tokens ?? 0) - (e.output_audio_mtok === void 0 ? 0 : p)), f < 0)
|
|
18930
19177
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
18931
19178
|
a += d(e.output_mtok, f, "output_mtok", o), a += d(e.output_audio_mtok, t.output_audio_tokens, "output_audio_mtok", o);
|
|
18932
|
-
let
|
|
18933
|
-
return e.requests_kcount !== void 0 && (
|
|
19179
|
+
let L = i + a;
|
|
19180
|
+
return e.requests_kcount !== void 0 && (L += e.requests_kcount / 1e3), {
|
|
18934
19181
|
input_price: i,
|
|
18935
19182
|
output_price: a,
|
|
18936
|
-
total_price:
|
|
19183
|
+
total_price: L
|
|
18937
19184
|
};
|
|
18938
19185
|
}
|
|
18939
19186
|
function G(t, e) {
|
|
@@ -18958,7 +19205,7 @@ function G(t, e) {
|
|
|
18958
19205
|
return t.prices[0].prices;
|
|
18959
19206
|
}
|
|
18960
19207
|
function g(t, e) {
|
|
18961
|
-
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;
|
|
19208
|
+
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.toLowerCase() === t.equals.toLowerCase() : "starts_with" in t ? e.toLowerCase().startsWith(t.starts_with.toLowerCase()) : "ends_with" in t ? e.toLowerCase().endsWith(t.ends_with.toLowerCase()) : "contains" in t ? e.toLowerCase().includes(t.contains.toLowerCase()) : "regex" in t ? new RegExp(t.regex).test(e) : !1;
|
|
18962
19209
|
}
|
|
18963
19210
|
function z(t, e) {
|
|
18964
19211
|
const i = e.toLowerCase().trim(), a = t.find((o) => o.id === i);
|
|
@@ -18975,11 +19222,11 @@ function x(t, { modelId: e, providerApiUrl: i, providerId: a }) {
|
|
|
18975
19222
|
if (e)
|
|
18976
19223
|
return t.find((o) => o.model_match && g(o.model_match, e));
|
|
18977
19224
|
}
|
|
18978
|
-
function
|
|
19225
|
+
function C(t, e) {
|
|
18979
19226
|
return t.find((i) => g(i.match, e));
|
|
18980
19227
|
}
|
|
18981
19228
|
function P(t, e, i) {
|
|
18982
|
-
const a =
|
|
19229
|
+
const a = C(t.models, e);
|
|
18983
19230
|
if (a) return a;
|
|
18984
19231
|
if (t.fallback_model_providers && i)
|
|
18985
19232
|
for (const o of t.fallback_model_providers) {
|
|
@@ -18990,7 +19237,7 @@ function P(t, e, i) {
|
|
|
18990
19237
|
}
|
|
18991
19238
|
}
|
|
18992
19239
|
}
|
|
18993
|
-
const
|
|
19240
|
+
const R = "https://raw.githubusercontent.com/pydantic/genai-prices/main/prices/data.json";
|
|
18994
19241
|
let h = Q, B = Promise.resolve(Q), I = null;
|
|
18995
19242
|
function D(t) {
|
|
18996
19243
|
t !== null && ("then" in t ? (B = t, t.then((e) => {
|
|
@@ -19000,10 +19247,10 @@ function D(t) {
|
|
|
19000
19247
|
function N(t) {
|
|
19001
19248
|
I = t;
|
|
19002
19249
|
}
|
|
19003
|
-
function
|
|
19250
|
+
function O(t) {
|
|
19004
19251
|
t({
|
|
19005
19252
|
onCalc: N,
|
|
19006
|
-
remoteDataUrl:
|
|
19253
|
+
remoteDataUrl: R,
|
|
19007
19254
|
setProviderData: D
|
|
19008
19255
|
});
|
|
19009
19256
|
}
|
|
@@ -19043,9 +19290,9 @@ function $(t, e, i) {
|
|
|
19043
19290
|
}
|
|
19044
19291
|
if (!q.guard(e))
|
|
19045
19292
|
throw new Error(`Expected response data to be a mapping object, got ${_(e)}`);
|
|
19046
|
-
const o = v(a.model_path, e,
|
|
19293
|
+
const o = v(a.model_path, e, E, !1, []), r = T(a.root), m = v(r, e, q, !0, []), n = {};
|
|
19047
19294
|
for (const s of a.mappings) {
|
|
19048
|
-
const p = v(s.path, m,
|
|
19295
|
+
const p = v(s.path, m, F, s.required, r);
|
|
19049
19296
|
if (p !== null) {
|
|
19050
19297
|
const u = n[s.dest] ?? 0;
|
|
19051
19298
|
n[s.dest] = u + p;
|
|
@@ -19065,7 +19312,7 @@ function v(t, e, i, a, o) {
|
|
|
19065
19312
|
for (const u of m) {
|
|
19066
19313
|
if (s.push(u), typeof u == "object")
|
|
19067
19314
|
if (Array.isArray(n))
|
|
19068
|
-
n =
|
|
19315
|
+
n = V(u, n);
|
|
19069
19316
|
else {
|
|
19070
19317
|
if (a)
|
|
19071
19318
|
throw new Error(`Expected \`${k(o, s)}\` value to be a mapping, got ${_(n)}`);
|
|
@@ -19102,7 +19349,7 @@ function v(t, e, i, a, o) {
|
|
|
19102
19349
|
throw s.push(r), new Error(`Expected \`${k(o, s)}\` value to be a ${i.name}, got ${_(p)}`);
|
|
19103
19350
|
return null;
|
|
19104
19351
|
}
|
|
19105
|
-
function
|
|
19352
|
+
function V(t, e) {
|
|
19106
19353
|
for (const i of e)
|
|
19107
19354
|
if (q.guard(i)) {
|
|
19108
19355
|
const a = i[t.field];
|
|
@@ -19119,13 +19366,13 @@ function _(t) {
|
|
|
19119
19366
|
const q = {
|
|
19120
19367
|
guard: (t) => _(t) === "mapping",
|
|
19121
19368
|
name: "mapping"
|
|
19122
|
-
},
|
|
19369
|
+
}, E = {
|
|
19123
19370
|
guard: (t) => typeof t == "string",
|
|
19124
19371
|
name: "string"
|
|
19125
|
-
},
|
|
19372
|
+
}, F = {
|
|
19126
19373
|
guard: (t) => typeof t == "number",
|
|
19127
19374
|
name: "number"
|
|
19128
|
-
}, k = (t, e) => [...t.map(
|
|
19375
|
+
}, k = (t, e) => [...t.map(y), ...e.map(y)].join("."), y = (t) => typeof t == "string" ? t : JSON.stringify(t);
|
|
19129
19376
|
class U {
|
|
19130
19377
|
base;
|
|
19131
19378
|
tiers;
|
|
@@ -19134,11 +19381,11 @@ class U {
|
|
|
19134
19381
|
}
|
|
19135
19382
|
}
|
|
19136
19383
|
export {
|
|
19137
|
-
|
|
19384
|
+
R as REMOTE_DATA_JSON_URL,
|
|
19138
19385
|
U as TieredPrices,
|
|
19139
19386
|
j as calcPrice,
|
|
19140
19387
|
$ as extractUsage,
|
|
19141
19388
|
H as findProvider,
|
|
19142
|
-
|
|
19389
|
+
O as updatePrices,
|
|
19143
19390
|
K as waitForUpdate
|
|
19144
19391
|
};
|