@lov3kaizen/agentsea-costs 0.6.0 → 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/README.md +11 -11
- package/dist/index.js +179 -6
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ const costManager = createCostManager({
|
|
|
41
41
|
// Track an Anthropic API call
|
|
42
42
|
await costManager.trackAnthropicResponse(
|
|
43
43
|
{
|
|
44
|
-
model: 'claude-
|
|
44
|
+
model: 'claude-sonnet-4-6',
|
|
45
45
|
usage: {
|
|
46
46
|
input_tokens: 1500,
|
|
47
47
|
output_tokens: 500,
|
|
@@ -80,7 +80,7 @@ const costManager = new CostManager({ storage });
|
|
|
80
80
|
// Track any LLM call
|
|
81
81
|
await costManager.track({
|
|
82
82
|
provider: 'anthropic',
|
|
83
|
-
model: 'claude-
|
|
83
|
+
model: 'claude-sonnet-4-6',
|
|
84
84
|
tokens: {
|
|
85
85
|
inputTokens: 1000,
|
|
86
86
|
outputTokens: 500,
|
|
@@ -96,7 +96,7 @@ await costManager.track({
|
|
|
96
96
|
|
|
97
97
|
// Track OpenAI responses directly
|
|
98
98
|
await costManager.trackOpenAIResponse({
|
|
99
|
-
model: 'gpt-
|
|
99
|
+
model: 'gpt-5.2',
|
|
100
100
|
usage: {
|
|
101
101
|
prompt_tokens: 1000,
|
|
102
102
|
completion_tokens: 500,
|
|
@@ -107,7 +107,7 @@ await costManager.trackOpenAIResponse({
|
|
|
107
107
|
// Track errors
|
|
108
108
|
await costManager.trackError({
|
|
109
109
|
provider: 'openai',
|
|
110
|
-
model: 'gpt-
|
|
110
|
+
model: 'gpt-5.2',
|
|
111
111
|
error: 'Rate limit exceeded',
|
|
112
112
|
estimatedInputTokens: 1000,
|
|
113
113
|
});
|
|
@@ -125,7 +125,7 @@ const userTracker = costManager.scoped({
|
|
|
125
125
|
// All calls through this tracker include the scope
|
|
126
126
|
await userTracker.track({
|
|
127
127
|
provider: 'anthropic',
|
|
128
|
-
model: 'claude-
|
|
128
|
+
model: 'claude-sonnet-4-6',
|
|
129
129
|
tokens: {
|
|
130
130
|
inputTokens: 500,
|
|
131
131
|
outputTokens: 200,
|
|
@@ -145,7 +145,7 @@ const counter = new TokenCounter(registry);
|
|
|
145
145
|
// Count tokens
|
|
146
146
|
const result = await counter.countTokens({
|
|
147
147
|
text: 'Hello, how can I help you today?',
|
|
148
|
-
model: 'claude-
|
|
148
|
+
model: 'claude-sonnet-4-6',
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
console.log(`Tokens: ${result.tokens}`);
|
|
@@ -154,7 +154,7 @@ console.log(`Estimated cost: $${result.estimatedInputCost}`);
|
|
|
154
154
|
// Estimate cost before making a call
|
|
155
155
|
const estimate = await counter.estimateCost({
|
|
156
156
|
input: 'Your prompt here...',
|
|
157
|
-
model: 'claude-
|
|
157
|
+
model: 'claude-sonnet-4-6',
|
|
158
158
|
estimatedOutputTokens: 1000,
|
|
159
159
|
});
|
|
160
160
|
|
|
@@ -169,14 +169,14 @@ import { ModelPricingRegistry } from '@lov3kaizen/agentsea-costs';
|
|
|
169
169
|
const registry = new ModelPricingRegistry();
|
|
170
170
|
|
|
171
171
|
// Get pricing for a model
|
|
172
|
-
const pricing = registry.getPricing('anthropic', 'claude-
|
|
172
|
+
const pricing = registry.getPricing('anthropic', 'claude-sonnet-4-6');
|
|
173
173
|
console.log(`Input: $${pricing.inputPricePerMillion}/1M tokens`);
|
|
174
174
|
console.log(`Output: $${pricing.outputPricePerMillion}/1M tokens`);
|
|
175
175
|
|
|
176
176
|
// Calculate cost
|
|
177
177
|
const cost = registry.calculateCost(
|
|
178
178
|
'anthropic',
|
|
179
|
-
'claude-
|
|
179
|
+
'claude-sonnet-4-6',
|
|
180
180
|
1000, // input tokens
|
|
181
181
|
500, // output tokens
|
|
182
182
|
);
|
|
@@ -191,8 +191,8 @@ const cheapest = registry.findCheapestModel({
|
|
|
191
191
|
|
|
192
192
|
// Compare models
|
|
193
193
|
const comparison = registry.comparePricing(
|
|
194
|
-
'claude-
|
|
195
|
-
'gpt-
|
|
194
|
+
'claude-sonnet-4-6',
|
|
195
|
+
'gpt-5.2',
|
|
196
196
|
{ input: 1000000, output: 500000 }, // sample workload
|
|
197
197
|
);
|
|
198
198
|
|
package/dist/index.js
CHANGED
|
@@ -7,16 +7,107 @@ import { Cron } from 'croner';
|
|
|
7
7
|
// src/pricing/ModelPricingRegistry.ts
|
|
8
8
|
var DEFAULT_PRICING = [
|
|
9
9
|
// ---- Anthropic Models ----
|
|
10
|
+
// Claude Fable 5 — most capable model. Adaptive thinking + effort param;
|
|
11
|
+
// no budget_tokens extended thinking, no assistant prefill;
|
|
12
|
+
// temperature/top_p removed at the API level.
|
|
13
|
+
{
|
|
14
|
+
model: "claude-fable-5",
|
|
15
|
+
provider: "anthropic",
|
|
16
|
+
displayName: "Claude Fable 5",
|
|
17
|
+
inputPricePerMillion: 10,
|
|
18
|
+
outputPricePerMillion: 50,
|
|
19
|
+
cacheReadPricePerMillion: 1,
|
|
20
|
+
cacheWritePricePerMillion: 12.5,
|
|
21
|
+
contextWindow: 1e6,
|
|
22
|
+
maxOutputTokens: 128e3,
|
|
23
|
+
currency: "USD",
|
|
24
|
+
capabilities: {
|
|
25
|
+
vision: true,
|
|
26
|
+
functionCalling: true,
|
|
27
|
+
streaming: true,
|
|
28
|
+
jsonMode: true,
|
|
29
|
+
systemMessage: true,
|
|
30
|
+
extendedThinking: true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
// Claude Opus 4.8 — recommended default. Adaptive thinking + effort param;
|
|
34
|
+
// no budget_tokens extended thinking, no assistant prefill;
|
|
35
|
+
// temperature/top_p removed at the API level.
|
|
36
|
+
{
|
|
37
|
+
model: "claude-opus-4-8",
|
|
38
|
+
provider: "anthropic",
|
|
39
|
+
displayName: "Claude Opus 4.8",
|
|
40
|
+
inputPricePerMillion: 5,
|
|
41
|
+
outputPricePerMillion: 25,
|
|
42
|
+
cacheReadPricePerMillion: 0.5,
|
|
43
|
+
cacheWritePricePerMillion: 6.25,
|
|
44
|
+
contextWindow: 1e6,
|
|
45
|
+
maxOutputTokens: 128e3,
|
|
46
|
+
currency: "USD",
|
|
47
|
+
capabilities: {
|
|
48
|
+
vision: true,
|
|
49
|
+
functionCalling: true,
|
|
50
|
+
streaming: true,
|
|
51
|
+
jsonMode: true,
|
|
52
|
+
systemMessage: true,
|
|
53
|
+
extendedThinking: true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
// Claude Opus 4.7 — previous-generation Opus. Adaptive thinking + effort
|
|
57
|
+
// param; no budget_tokens extended thinking, no assistant prefill;
|
|
58
|
+
// temperature/top_p removed at the API level.
|
|
59
|
+
{
|
|
60
|
+
model: "claude-opus-4-7",
|
|
61
|
+
provider: "anthropic",
|
|
62
|
+
displayName: "Claude Opus 4.7",
|
|
63
|
+
inputPricePerMillion: 5,
|
|
64
|
+
outputPricePerMillion: 25,
|
|
65
|
+
cacheReadPricePerMillion: 0.5,
|
|
66
|
+
cacheWritePricePerMillion: 6.25,
|
|
67
|
+
contextWindow: 1e6,
|
|
68
|
+
maxOutputTokens: 128e3,
|
|
69
|
+
currency: "USD",
|
|
70
|
+
capabilities: {
|
|
71
|
+
vision: true,
|
|
72
|
+
functionCalling: true,
|
|
73
|
+
streaming: true,
|
|
74
|
+
jsonMode: true,
|
|
75
|
+
systemMessage: true,
|
|
76
|
+
extendedThinking: true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
// Claude Sonnet 4.6 — best speed/intelligence balance. Adaptive thinking +
|
|
80
|
+
// effort param; no budget_tokens extended thinking, no assistant prefill.
|
|
81
|
+
{
|
|
82
|
+
model: "claude-sonnet-4-6",
|
|
83
|
+
provider: "anthropic",
|
|
84
|
+
displayName: "Claude Sonnet 4.6",
|
|
85
|
+
inputPricePerMillion: 3,
|
|
86
|
+
outputPricePerMillion: 15,
|
|
87
|
+
cacheReadPricePerMillion: 0.3,
|
|
88
|
+
cacheWritePricePerMillion: 3.75,
|
|
89
|
+
contextWindow: 1e6,
|
|
90
|
+
maxOutputTokens: 64e3,
|
|
91
|
+
currency: "USD",
|
|
92
|
+
capabilities: {
|
|
93
|
+
vision: true,
|
|
94
|
+
functionCalling: true,
|
|
95
|
+
streaming: true,
|
|
96
|
+
jsonMode: true,
|
|
97
|
+
systemMessage: true,
|
|
98
|
+
extendedThinking: true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
10
101
|
{
|
|
11
102
|
model: "claude-opus-4-6",
|
|
12
103
|
provider: "anthropic",
|
|
13
104
|
displayName: "Claude Opus 4.6",
|
|
14
|
-
inputPricePerMillion:
|
|
15
|
-
outputPricePerMillion:
|
|
16
|
-
cacheReadPricePerMillion:
|
|
17
|
-
cacheWritePricePerMillion:
|
|
18
|
-
contextWindow:
|
|
19
|
-
maxOutputTokens:
|
|
105
|
+
inputPricePerMillion: 5,
|
|
106
|
+
outputPricePerMillion: 25,
|
|
107
|
+
cacheReadPricePerMillion: 0.5,
|
|
108
|
+
cacheWritePricePerMillion: 6.25,
|
|
109
|
+
contextWindow: 1e6,
|
|
110
|
+
maxOutputTokens: 128e3,
|
|
20
111
|
currency: "USD",
|
|
21
112
|
capabilities: {
|
|
22
113
|
vision: true,
|
|
@@ -86,10 +177,12 @@ var DEFAULT_PRICING = [
|
|
|
86
177
|
extendedThinking: true
|
|
87
178
|
}
|
|
88
179
|
},
|
|
180
|
+
/** @deprecated Retiring 2026-06-15. Use 'claude-opus-4-8' instead. */
|
|
89
181
|
{
|
|
90
182
|
model: "claude-opus-4-0-20250514",
|
|
91
183
|
provider: "anthropic",
|
|
92
184
|
displayName: "Claude Opus 4",
|
|
185
|
+
deprecated: true,
|
|
93
186
|
inputPricePerMillion: 15,
|
|
94
187
|
outputPricePerMillion: 75,
|
|
95
188
|
cacheReadPricePerMillion: 1.5,
|
|
@@ -106,10 +199,12 @@ var DEFAULT_PRICING = [
|
|
|
106
199
|
extendedThinking: true
|
|
107
200
|
}
|
|
108
201
|
},
|
|
202
|
+
/** @deprecated Retiring 2026-06-15. Use 'claude-sonnet-4-6' instead. */
|
|
109
203
|
{
|
|
110
204
|
model: "claude-sonnet-4-0-20250514",
|
|
111
205
|
provider: "anthropic",
|
|
112
206
|
displayName: "Claude Sonnet 4",
|
|
207
|
+
deprecated: true,
|
|
113
208
|
inputPricePerMillion: 3,
|
|
114
209
|
outputPricePerMillion: 15,
|
|
115
210
|
cacheReadPricePerMillion: 0.3,
|
|
@@ -126,10 +221,12 @@ var DEFAULT_PRICING = [
|
|
|
126
221
|
extendedThinking: true
|
|
127
222
|
}
|
|
128
223
|
},
|
|
224
|
+
/** @deprecated Retired 2026-02-19 (API returns 404). Use 'claude-sonnet-4-6' instead. */
|
|
129
225
|
{
|
|
130
226
|
model: "claude-3-7-sonnet-20250219",
|
|
131
227
|
provider: "anthropic",
|
|
132
228
|
displayName: "Claude 3.7 Sonnet",
|
|
229
|
+
deprecated: true,
|
|
133
230
|
inputPricePerMillion: 3,
|
|
134
231
|
outputPricePerMillion: 15,
|
|
135
232
|
cacheReadPricePerMillion: 0.3,
|
|
@@ -147,10 +244,12 @@ var DEFAULT_PRICING = [
|
|
|
147
244
|
computerUse: true
|
|
148
245
|
}
|
|
149
246
|
},
|
|
247
|
+
/** @deprecated Retired 2025-10-28 (API returns 404). Use 'claude-sonnet-4-6' instead. */
|
|
150
248
|
{
|
|
151
249
|
model: "claude-3-5-sonnet-20241022",
|
|
152
250
|
provider: "anthropic",
|
|
153
251
|
displayName: "Claude 3.5 Sonnet",
|
|
252
|
+
deprecated: true,
|
|
154
253
|
inputPricePerMillion: 3,
|
|
155
254
|
outputPricePerMillion: 15,
|
|
156
255
|
cacheReadPricePerMillion: 0.3,
|
|
@@ -167,10 +266,12 @@ var DEFAULT_PRICING = [
|
|
|
167
266
|
computerUse: true
|
|
168
267
|
}
|
|
169
268
|
},
|
|
269
|
+
/** @deprecated Retired 2026-02-19 (API returns 404). Use 'claude-haiku-4-5' instead. */
|
|
170
270
|
{
|
|
171
271
|
model: "claude-3-5-haiku-20241022",
|
|
172
272
|
provider: "anthropic",
|
|
173
273
|
displayName: "Claude 3.5 Haiku",
|
|
274
|
+
deprecated: true,
|
|
174
275
|
inputPricePerMillion: 0.8,
|
|
175
276
|
outputPricePerMillion: 4,
|
|
176
277
|
cacheReadPricePerMillion: 0.08,
|
|
@@ -186,10 +287,12 @@ var DEFAULT_PRICING = [
|
|
|
186
287
|
systemMessage: true
|
|
187
288
|
}
|
|
188
289
|
},
|
|
290
|
+
/** @deprecated Retired 2026-01-05 (API returns 404). Use 'claude-opus-4-8' instead. */
|
|
189
291
|
{
|
|
190
292
|
model: "claude-3-opus-20240229",
|
|
191
293
|
provider: "anthropic",
|
|
192
294
|
displayName: "Claude 3 Opus",
|
|
295
|
+
deprecated: true,
|
|
193
296
|
inputPricePerMillion: 15,
|
|
194
297
|
outputPricePerMillion: 75,
|
|
195
298
|
cacheReadPricePerMillion: 1.5,
|
|
@@ -205,10 +308,12 @@ var DEFAULT_PRICING = [
|
|
|
205
308
|
systemMessage: true
|
|
206
309
|
}
|
|
207
310
|
},
|
|
311
|
+
/** @deprecated Retired 2026-04-19 (API returns 404). Use 'claude-haiku-4-5' instead. */
|
|
208
312
|
{
|
|
209
313
|
model: "claude-3-haiku-20240307",
|
|
210
314
|
provider: "anthropic",
|
|
211
315
|
displayName: "Claude 3 Haiku",
|
|
316
|
+
deprecated: true,
|
|
212
317
|
inputPricePerMillion: 0.25,
|
|
213
318
|
outputPricePerMillion: 1.25,
|
|
214
319
|
cacheReadPricePerMillion: 0.03,
|
|
@@ -276,6 +381,40 @@ var DEFAULT_PRICING = [
|
|
|
276
381
|
systemMessage: true
|
|
277
382
|
}
|
|
278
383
|
},
|
|
384
|
+
{
|
|
385
|
+
model: "gpt-5.5",
|
|
386
|
+
provider: "openai",
|
|
387
|
+
displayName: "GPT-5.5",
|
|
388
|
+
inputPricePerMillion: 5,
|
|
389
|
+
outputPricePerMillion: 30,
|
|
390
|
+
contextWindow: 105e4,
|
|
391
|
+
maxOutputTokens: 128e3,
|
|
392
|
+
currency: "USD",
|
|
393
|
+
capabilities: {
|
|
394
|
+
vision: true,
|
|
395
|
+
functionCalling: true,
|
|
396
|
+
streaming: true,
|
|
397
|
+
jsonMode: true,
|
|
398
|
+
systemMessage: true
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
model: "gpt-5.4-mini",
|
|
403
|
+
provider: "openai",
|
|
404
|
+
displayName: "GPT-5.4 Mini",
|
|
405
|
+
inputPricePerMillion: 0.75,
|
|
406
|
+
outputPricePerMillion: 4.5,
|
|
407
|
+
contextWindow: 4e5,
|
|
408
|
+
maxOutputTokens: 128e3,
|
|
409
|
+
currency: "USD",
|
|
410
|
+
capabilities: {
|
|
411
|
+
vision: true,
|
|
412
|
+
functionCalling: true,
|
|
413
|
+
streaming: true,
|
|
414
|
+
jsonMode: true,
|
|
415
|
+
systemMessage: true
|
|
416
|
+
}
|
|
417
|
+
},
|
|
279
418
|
{
|
|
280
419
|
model: "gpt-5.2",
|
|
281
420
|
provider: "openai",
|
|
@@ -688,6 +827,40 @@ var DEFAULT_PRICING = [
|
|
|
688
827
|
}
|
|
689
828
|
},
|
|
690
829
|
// ---- Google Models ----
|
|
830
|
+
{
|
|
831
|
+
model: "gemini-3.1-pro-preview",
|
|
832
|
+
provider: "google",
|
|
833
|
+
displayName: "Gemini 3.1 Pro Preview",
|
|
834
|
+
inputPricePerMillion: 2,
|
|
835
|
+
outputPricePerMillion: 12,
|
|
836
|
+
contextWindow: 1048576,
|
|
837
|
+
maxOutputTokens: 65536,
|
|
838
|
+
currency: "USD",
|
|
839
|
+
capabilities: {
|
|
840
|
+
vision: true,
|
|
841
|
+
functionCalling: true,
|
|
842
|
+
streaming: true,
|
|
843
|
+
jsonMode: true,
|
|
844
|
+
systemMessage: true
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
model: "gemini-3.5-flash",
|
|
849
|
+
provider: "google",
|
|
850
|
+
displayName: "Gemini 3.5 Flash",
|
|
851
|
+
inputPricePerMillion: 1.5,
|
|
852
|
+
outputPricePerMillion: 9,
|
|
853
|
+
contextWindow: 1048576,
|
|
854
|
+
maxOutputTokens: 65536,
|
|
855
|
+
currency: "USD",
|
|
856
|
+
capabilities: {
|
|
857
|
+
vision: true,
|
|
858
|
+
functionCalling: true,
|
|
859
|
+
streaming: true,
|
|
860
|
+
jsonMode: true,
|
|
861
|
+
systemMessage: true
|
|
862
|
+
}
|
|
863
|
+
},
|
|
691
864
|
{
|
|
692
865
|
model: "gemini-2.5-pro",
|
|
693
866
|
provider: "google",
|