@bymax-one/nest-ai-tokens 1.0.0
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/CHANGELOG.md +113 -0
- package/LICENSE +21 -0
- package/README.md +795 -0
- package/dist/prices/index.cjs +218 -0
- package/dist/prices/index.d.cts +131 -0
- package/dist/prices/index.d.ts +131 -0
- package/dist/prices/index.mjs +216 -0
- package/dist/prisma/index.cjs +1197 -0
- package/dist/prisma/index.d.cts +677 -0
- package/dist/prisma/index.d.ts +677 -0
- package/dist/prisma/index.mjs +1195 -0
- package/dist/prisma/migrations/0001_init.sql +198 -0
- package/dist/prisma/schema.prisma.fragment +197 -0
- package/dist/redis/index.cjs +110 -0
- package/dist/redis/index.d.cts +98 -0
- package/dist/redis/index.d.ts +98 -0
- package/dist/redis/index.mjs +107 -0
- package/dist/server/index.cjs +4405 -0
- package/dist/server/index.d.cts +3202 -0
- package/dist/server/index.d.ts +3202 -0
- package/dist/server/index.mjs +4354 -0
- package/dist/shared/index.cjs +659 -0
- package/dist/shared/index.d.cts +1044 -0
- package/dist/shared/index.d.ts +1044 -0
- package/dist/shared/index.mjs +629 -0
- package/package.json +216 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// src/prices/model-prices.seed.ts
|
|
2
|
+
var ZERO_RATES = {
|
|
3
|
+
inputNanoUsdPerMillion: 0n,
|
|
4
|
+
outputNanoUsdPerMillion: 0n,
|
|
5
|
+
cacheReadNanoUsdPerMillion: 0n,
|
|
6
|
+
cacheWrite5mNanoUsdPerMillion: 0n,
|
|
7
|
+
cacheWrite1hNanoUsdPerMillion: 0n,
|
|
8
|
+
reasoningNanoUsdPerMillion: 0n,
|
|
9
|
+
audioInNanoUsdPerMillion: 0n,
|
|
10
|
+
audioOutNanoUsdPerMillion: 0n,
|
|
11
|
+
imageInNanoUsdPerMillion: 0n,
|
|
12
|
+
imageOutNanoUsdPerMillion: 0n
|
|
13
|
+
};
|
|
14
|
+
function makeRow(input) {
|
|
15
|
+
return {
|
|
16
|
+
provider: input.provider,
|
|
17
|
+
model: input.model,
|
|
18
|
+
operation: input.operation ?? "chat",
|
|
19
|
+
serviceTier: input.serviceTier ?? "standard",
|
|
20
|
+
...ZERO_RATES,
|
|
21
|
+
...input.rates,
|
|
22
|
+
...input.tierThresholdTokens !== void 0 ? { tierThresholdTokens: input.tierThresholdTokens } : {},
|
|
23
|
+
...input.tierInputNanoUsdPerMillion !== void 0 ? { tierInputNanoUsdPerMillion: input.tierInputNanoUsdPerMillion } : {},
|
|
24
|
+
...input.tierOutputNanoUsdPerMillion !== void 0 ? { tierOutputNanoUsdPerMillion: input.tierOutputNanoUsdPerMillion } : {},
|
|
25
|
+
...input.unitRates !== void 0 ? { unitRates: input.unitRates } : {},
|
|
26
|
+
currency: "USD",
|
|
27
|
+
source: "snapshot"
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var MODEL_PRICES_SEED = [
|
|
31
|
+
// ── OpenAI ───────────────────────────────────────────────────────────────
|
|
32
|
+
// source: OpenAI pricing snapshot 2026-07 — gpt-5 $1.25/$10 per M, cached input $0.125/M.
|
|
33
|
+
makeRow({
|
|
34
|
+
provider: "openai",
|
|
35
|
+
model: "gpt-5",
|
|
36
|
+
rates: {
|
|
37
|
+
inputNanoUsdPerMillion: 1250000000n,
|
|
38
|
+
outputNanoUsdPerMillion: 10000000000n,
|
|
39
|
+
cacheReadNanoUsdPerMillion: 125000000n,
|
|
40
|
+
reasoningNanoUsdPerMillion: 10000000000n
|
|
41
|
+
},
|
|
42
|
+
unitRates: { web_search_requests: 10000000n }
|
|
43
|
+
// VERIFY: $0.01 per built-in web-search call.
|
|
44
|
+
}),
|
|
45
|
+
// source: OpenAI pricing snapshot 2026-07 — Batch API ~50% of standard.
|
|
46
|
+
makeRow({
|
|
47
|
+
provider: "openai",
|
|
48
|
+
model: "gpt-5",
|
|
49
|
+
serviceTier: "batch",
|
|
50
|
+
rates: {
|
|
51
|
+
inputNanoUsdPerMillion: 625000000n,
|
|
52
|
+
outputNanoUsdPerMillion: 5000000000n,
|
|
53
|
+
cacheReadNanoUsdPerMillion: 62500000n,
|
|
54
|
+
reasoningNanoUsdPerMillion: 5000000000n
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
// source: OpenAI pricing snapshot 2026-07 — gpt-5-mini $0.25/$2 per M.
|
|
58
|
+
makeRow({
|
|
59
|
+
provider: "openai",
|
|
60
|
+
model: "gpt-5-mini",
|
|
61
|
+
rates: {
|
|
62
|
+
inputNanoUsdPerMillion: 250000000n,
|
|
63
|
+
outputNanoUsdPerMillion: 2000000000n,
|
|
64
|
+
cacheReadNanoUsdPerMillion: 25000000n,
|
|
65
|
+
reasoningNanoUsdPerMillion: 2000000000n
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
// source: OpenAI pricing snapshot 2026-07 — text-embedding-3-small $0.02/M.
|
|
69
|
+
makeRow({
|
|
70
|
+
provider: "openai",
|
|
71
|
+
model: "text-embedding-3-small",
|
|
72
|
+
operation: "embeddings",
|
|
73
|
+
rates: { inputNanoUsdPerMillion: 20000000n }
|
|
74
|
+
}),
|
|
75
|
+
// source: OpenAI pricing snapshot 2026-07 — text-embedding-3-large $0.13/M.
|
|
76
|
+
makeRow({
|
|
77
|
+
provider: "openai",
|
|
78
|
+
model: "text-embedding-3-large",
|
|
79
|
+
operation: "embeddings",
|
|
80
|
+
rates: { inputNanoUsdPerMillion: 130000000n }
|
|
81
|
+
}),
|
|
82
|
+
// ── Anthropic ────────────────────────────────────────────────────────────
|
|
83
|
+
// source: Anthropic pricing snapshot 2026-07 — Opus $15/$75 per M; cache read 0.1×, write5m 1.25×, write1h 2× input.
|
|
84
|
+
makeRow({
|
|
85
|
+
provider: "anthropic",
|
|
86
|
+
model: "claude-opus-4",
|
|
87
|
+
rates: {
|
|
88
|
+
inputNanoUsdPerMillion: 15000000000n,
|
|
89
|
+
outputNanoUsdPerMillion: 75000000000n,
|
|
90
|
+
cacheReadNanoUsdPerMillion: 1500000000n,
|
|
91
|
+
cacheWrite5mNanoUsdPerMillion: 18750000000n,
|
|
92
|
+
cacheWrite1hNanoUsdPerMillion: 30000000000n,
|
|
93
|
+
reasoningNanoUsdPerMillion: 75000000000n
|
|
94
|
+
},
|
|
95
|
+
unitRates: { web_search_requests: 10000000n }
|
|
96
|
+
// source: Anthropic web search $10 / 1,000 requests.
|
|
97
|
+
}),
|
|
98
|
+
// source: Anthropic pricing snapshot 2026-07 — Sonnet $3/$15 per M.
|
|
99
|
+
makeRow({
|
|
100
|
+
provider: "anthropic",
|
|
101
|
+
model: "claude-sonnet-4",
|
|
102
|
+
rates: {
|
|
103
|
+
inputNanoUsdPerMillion: 3000000000n,
|
|
104
|
+
outputNanoUsdPerMillion: 15000000000n,
|
|
105
|
+
cacheReadNanoUsdPerMillion: 300000000n,
|
|
106
|
+
cacheWrite5mNanoUsdPerMillion: 3750000000n,
|
|
107
|
+
cacheWrite1hNanoUsdPerMillion: 6000000000n,
|
|
108
|
+
reasoningNanoUsdPerMillion: 15000000000n
|
|
109
|
+
}
|
|
110
|
+
}),
|
|
111
|
+
// source: Anthropic pricing snapshot 2026-07 — Haiku $0.80/$4 per M.
|
|
112
|
+
makeRow({
|
|
113
|
+
provider: "anthropic",
|
|
114
|
+
model: "claude-haiku-4",
|
|
115
|
+
rates: {
|
|
116
|
+
inputNanoUsdPerMillion: 800000000n,
|
|
117
|
+
outputNanoUsdPerMillion: 4000000000n,
|
|
118
|
+
cacheReadNanoUsdPerMillion: 80000000n,
|
|
119
|
+
cacheWrite5mNanoUsdPerMillion: 1000000000n,
|
|
120
|
+
cacheWrite1hNanoUsdPerMillion: 1600000000n,
|
|
121
|
+
reasoningNanoUsdPerMillion: 4000000000n
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
// source: Anthropic pricing snapshot 2026-07 — Sonnet Batch API ~50% of standard.
|
|
125
|
+
makeRow({
|
|
126
|
+
provider: "anthropic",
|
|
127
|
+
model: "claude-sonnet-4",
|
|
128
|
+
serviceTier: "batch",
|
|
129
|
+
rates: {
|
|
130
|
+
inputNanoUsdPerMillion: 1500000000n,
|
|
131
|
+
outputNanoUsdPerMillion: 7500000000n,
|
|
132
|
+
cacheReadNanoUsdPerMillion: 150000000n,
|
|
133
|
+
cacheWrite5mNanoUsdPerMillion: 1875000000n,
|
|
134
|
+
cacheWrite1hNanoUsdPerMillion: 3000000000n,
|
|
135
|
+
reasoningNanoUsdPerMillion: 7500000000n
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
// ── Google Gemini ────────────────────────────────────────────────────────
|
|
139
|
+
// source: Gemini pricing snapshot 2026-07 — 2.5 Pro $1.25/$10 (≤200k), $2.50/$15 above; cache read ~10% input.
|
|
140
|
+
makeRow({
|
|
141
|
+
provider: "gemini",
|
|
142
|
+
model: "gemini-2.5-pro",
|
|
143
|
+
rates: {
|
|
144
|
+
inputNanoUsdPerMillion: 1250000000n,
|
|
145
|
+
outputNanoUsdPerMillion: 10000000000n,
|
|
146
|
+
cacheReadNanoUsdPerMillion: 125000000n,
|
|
147
|
+
reasoningNanoUsdPerMillion: 10000000000n
|
|
148
|
+
},
|
|
149
|
+
tierThresholdTokens: 2e5,
|
|
150
|
+
tierInputNanoUsdPerMillion: 2500000000n,
|
|
151
|
+
tierOutputNanoUsdPerMillion: 15000000000n
|
|
152
|
+
}),
|
|
153
|
+
// source: Gemini pricing snapshot 2026-07 — 2.5 Flash $0.30/$2.50; long-context tier VERIFY.
|
|
154
|
+
makeRow({
|
|
155
|
+
provider: "gemini",
|
|
156
|
+
model: "gemini-2.5-flash",
|
|
157
|
+
rates: {
|
|
158
|
+
inputNanoUsdPerMillion: 300000000n,
|
|
159
|
+
outputNanoUsdPerMillion: 2500000000n,
|
|
160
|
+
cacheReadNanoUsdPerMillion: 30000000n,
|
|
161
|
+
reasoningNanoUsdPerMillion: 2500000000n
|
|
162
|
+
},
|
|
163
|
+
tierThresholdTokens: 2e5,
|
|
164
|
+
// VERIFY: Flash long-context surcharge.
|
|
165
|
+
tierInputNanoUsdPerMillion: 600000000n,
|
|
166
|
+
tierOutputNanoUsdPerMillion: 5000000000n
|
|
167
|
+
}),
|
|
168
|
+
// ── Mistral ──────────────────────────────────────────────────────────────
|
|
169
|
+
// source: Mistral pricing snapshot 2026-07 — Large $2/$6 per M.
|
|
170
|
+
makeRow({
|
|
171
|
+
provider: "mistral",
|
|
172
|
+
model: "mistral-large-latest",
|
|
173
|
+
rates: { inputNanoUsdPerMillion: 2000000000n, outputNanoUsdPerMillion: 6000000000n }
|
|
174
|
+
}),
|
|
175
|
+
// source: Mistral pricing snapshot 2026-07 — Medium $0.40/$2 per M.
|
|
176
|
+
makeRow({
|
|
177
|
+
provider: "mistral",
|
|
178
|
+
model: "mistral-medium-latest",
|
|
179
|
+
rates: { inputNanoUsdPerMillion: 400000000n, outputNanoUsdPerMillion: 2000000000n }
|
|
180
|
+
}),
|
|
181
|
+
// source: Mistral pricing snapshot 2026-07 — Small $0.10/$0.30 per M.
|
|
182
|
+
makeRow({
|
|
183
|
+
provider: "mistral",
|
|
184
|
+
model: "mistral-small-latest",
|
|
185
|
+
rates: { inputNanoUsdPerMillion: 100000000n, outputNanoUsdPerMillion: 300000000n }
|
|
186
|
+
}),
|
|
187
|
+
// ── DeepSeek / xAI / Groq (headline models) ──────────────────────────────
|
|
188
|
+
// source: DeepSeek pricing snapshot 2026-07 — chat $0.27/$1.10 per M; cache hit $0.07/M.
|
|
189
|
+
makeRow({
|
|
190
|
+
provider: "deepseek",
|
|
191
|
+
model: "deepseek-chat",
|
|
192
|
+
rates: {
|
|
193
|
+
inputNanoUsdPerMillion: 270000000n,
|
|
194
|
+
outputNanoUsdPerMillion: 1100000000n,
|
|
195
|
+
cacheReadNanoUsdPerMillion: 70000000n
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
// source: xAI pricing snapshot 2026-07 — Grok $3/$15 per M.
|
|
199
|
+
makeRow({
|
|
200
|
+
provider: "xai",
|
|
201
|
+
model: "grok-4",
|
|
202
|
+
rates: {
|
|
203
|
+
inputNanoUsdPerMillion: 3000000000n,
|
|
204
|
+
outputNanoUsdPerMillion: 15000000000n,
|
|
205
|
+
reasoningNanoUsdPerMillion: 15000000000n
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
// source: Groq pricing snapshot 2026-07 — Llama 3.3 70B $0.59/$0.79 per M. VERIFY.
|
|
209
|
+
makeRow({
|
|
210
|
+
provider: "groq",
|
|
211
|
+
model: "llama-3.3-70b-versatile",
|
|
212
|
+
rates: { inputNanoUsdPerMillion: 590000000n, outputNanoUsdPerMillion: 790000000n }
|
|
213
|
+
})
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
export { MODEL_PRICES_SEED };
|