@lov3kaizen/agentsea-costs 0.5.2 → 0.8.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 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-3-5-sonnet-20241022',
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-3-5-sonnet-20241022',
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-4o',
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-4o',
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-3-5-sonnet-20241022',
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-3-5-sonnet-20241022',
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-3-5-sonnet-20241022',
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-3-5-sonnet-20241022');
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-3-5-sonnet-20241022',
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-3-5-sonnet-20241022',
195
- 'gpt-4o',
194
+ 'claude-sonnet-4-6',
195
+ 'gpt-5.2',
196
196
  { input: 1000000, output: 500000 }, // sample workload
197
197
  );
198
198
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
 
3
- type AIProvider = 'anthropic' | 'openai' | 'google' | 'azure' | 'bedrock' | 'cohere' | 'mistral' | 'replicate' | 'custom';
3
+ type AIProvider = 'anthropic' | 'openai' | 'google' | 'azure' | 'bedrock' | 'cohere' | 'mistral' | 'deepseek' | 'xai' | 'replicate' | 'custom';
4
4
  interface TokenUsage {
5
5
  inputTokens: number;
6
6
  outputTokens: number;