mcp-rubber-duck 1.5.1 → 1.6.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.
Files changed (69) hide show
  1. package/.claude/agents/pricing-updater.md +111 -0
  2. package/.claude/commands/update-pricing.md +22 -0
  3. package/.releaserc.json +4 -0
  4. package/CHANGELOG.md +14 -0
  5. package/dist/config/types.d.ts +72 -0
  6. package/dist/config/types.d.ts.map +1 -1
  7. package/dist/config/types.js +8 -0
  8. package/dist/config/types.js.map +1 -1
  9. package/dist/data/default-pricing.d.ts +18 -0
  10. package/dist/data/default-pricing.d.ts.map +1 -0
  11. package/dist/data/default-pricing.js +307 -0
  12. package/dist/data/default-pricing.js.map +1 -0
  13. package/dist/providers/enhanced-manager.d.ts +2 -1
  14. package/dist/providers/enhanced-manager.d.ts.map +1 -1
  15. package/dist/providers/enhanced-manager.js +20 -2
  16. package/dist/providers/enhanced-manager.js.map +1 -1
  17. package/dist/providers/manager.d.ts +3 -1
  18. package/dist/providers/manager.d.ts.map +1 -1
  19. package/dist/providers/manager.js +12 -1
  20. package/dist/providers/manager.js.map +1 -1
  21. package/dist/server.d.ts +2 -0
  22. package/dist/server.d.ts.map +1 -1
  23. package/dist/server.js +35 -4
  24. package/dist/server.js.map +1 -1
  25. package/dist/services/pricing.d.ts +56 -0
  26. package/dist/services/pricing.d.ts.map +1 -0
  27. package/dist/services/pricing.js +124 -0
  28. package/dist/services/pricing.js.map +1 -0
  29. package/dist/services/usage.d.ts +48 -0
  30. package/dist/services/usage.d.ts.map +1 -0
  31. package/dist/services/usage.js +243 -0
  32. package/dist/services/usage.js.map +1 -0
  33. package/dist/tools/get-usage-stats.d.ts +8 -0
  34. package/dist/tools/get-usage-stats.d.ts.map +1 -0
  35. package/dist/tools/get-usage-stats.js +92 -0
  36. package/dist/tools/get-usage-stats.js.map +1 -0
  37. package/package.json +1 -1
  38. package/src/config/types.ts +51 -0
  39. package/src/data/default-pricing.ts +368 -0
  40. package/src/providers/enhanced-manager.ts +41 -4
  41. package/src/providers/manager.ts +22 -1
  42. package/src/server.ts +42 -4
  43. package/src/services/pricing.ts +155 -0
  44. package/src/services/usage.ts +293 -0
  45. package/src/tools/get-usage-stats.ts +109 -0
  46. package/tests/approval.test.ts +440 -0
  47. package/tests/cache.test.ts +240 -0
  48. package/tests/config.test.ts +468 -0
  49. package/tests/consensus.test.ts +10 -0
  50. package/tests/conversation.test.ts +86 -0
  51. package/tests/duck-debate.test.ts +105 -1
  52. package/tests/duck-iterate.test.ts +30 -0
  53. package/tests/duck-judge.test.ts +93 -0
  54. package/tests/duck-vote.test.ts +46 -0
  55. package/tests/health.test.ts +129 -0
  56. package/tests/pricing.test.ts +335 -0
  57. package/tests/providers.test.ts +591 -0
  58. package/tests/safe-logger.test.ts +314 -0
  59. package/tests/tools/approve-mcp-request.test.ts +239 -0
  60. package/tests/tools/ask-duck.test.ts +159 -0
  61. package/tests/tools/chat-duck.test.ts +191 -0
  62. package/tests/tools/compare-ducks.test.ts +190 -0
  63. package/tests/tools/duck-council.test.ts +219 -0
  64. package/tests/tools/get-pending-approvals.test.ts +195 -0
  65. package/tests/tools/get-usage-stats.test.ts +236 -0
  66. package/tests/tools/list-ducks.test.ts +144 -0
  67. package/tests/tools/list-models.test.ts +163 -0
  68. package/tests/tools/mcp-status.test.ts +330 -0
  69. package/tests/usage.test.ts +661 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/services/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAS7B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,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AAC,kBAAkB,GAAG,IAAI,CAAC;QACjC,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAc,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,CAAC,IAAI,GAAG,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QACvD,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { UsageService } from '../services/usage.js';
2
+ export declare function getUsageStatsTool(usageService: UsageService, args: Record<string, unknown>): {
3
+ content: {
4
+ type: string;
5
+ text: string;
6
+ }[];
7
+ };
8
+ //# sourceMappingURL=get-usage-stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-usage-stats.d.ts","sourceRoot":"","sources":["../../src/tools/get-usage-stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAOpD,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;EA4E9B"}
@@ -0,0 +1,92 @@
1
+ import { duckArt } from '../utils/ascii-art.js';
2
+ import { logger } from '../utils/logger.js';
3
+ const VALID_PERIODS = ['today', '7d', '30d', 'all'];
4
+ export function getUsageStatsTool(usageService, args) {
5
+ const { period = 'today' } = args;
6
+ // Validate period
7
+ if (!VALID_PERIODS.includes(period)) {
8
+ throw new Error(`Invalid period "${period}". Valid options: ${VALID_PERIODS.join(', ')}`);
9
+ }
10
+ const stats = usageService.getStats(period);
11
+ // Format output
12
+ let output = `${duckArt.panel}\n\n`;
13
+ output += `📊 Usage Statistics: ${formatPeriodLabel(period)}\n`;
14
+ output += `━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`;
15
+ output += `Period: ${stats.startDate} to ${stats.endDate}\n\n`;
16
+ // Totals section
17
+ output += `📈 TOTALS\n`;
18
+ output += `─────────────────────\n`;
19
+ output += `Requests: ${stats.totals.requests.toLocaleString()}\n`;
20
+ output += `Prompt Tokens: ${stats.totals.promptTokens.toLocaleString()}\n`;
21
+ output += `Completion Tokens: ${stats.totals.completionTokens.toLocaleString()}\n`;
22
+ output += `Total Tokens: ${(stats.totals.promptTokens + stats.totals.completionTokens).toLocaleString()}\n`;
23
+ output += `Cache Hits: ${stats.totals.cacheHits.toLocaleString()}\n`;
24
+ output += `Errors: ${stats.totals.errors.toLocaleString()}\n`;
25
+ if (stats.totals.estimatedCostUSD !== undefined) {
26
+ output += `💰 Estimated Cost: $${formatCost(stats.totals.estimatedCostUSD)} USD\n`;
27
+ }
28
+ // Per-provider breakdown
29
+ const providers = Object.keys(stats.usage);
30
+ if (providers.length > 0) {
31
+ output += `\n🦆 BY PROVIDER\n`;
32
+ output += `─────────────────────\n`;
33
+ for (const provider of providers) {
34
+ const models = stats.usage[provider];
35
+ output += `\n**${provider}**\n`;
36
+ for (const [model, modelStats] of Object.entries(models)) {
37
+ output += ` ${model}:\n`;
38
+ output += ` Requests: ${modelStats.requests.toLocaleString()}\n`;
39
+ output += ` Tokens: ${modelStats.promptTokens.toLocaleString()} in / ${modelStats.completionTokens.toLocaleString()} out\n`;
40
+ if (modelStats.cacheHits > 0) {
41
+ output += ` Cache Hits: ${modelStats.cacheHits.toLocaleString()}\n`;
42
+ }
43
+ if (modelStats.errors > 0) {
44
+ output += ` Errors: ${modelStats.errors.toLocaleString()}\n`;
45
+ }
46
+ }
47
+ if (stats.costByProvider && stats.costByProvider[provider] !== undefined) {
48
+ output += ` 💰 Provider Cost: $${formatCost(stats.costByProvider[provider])}\n`;
49
+ }
50
+ }
51
+ }
52
+ else {
53
+ output += `\nNo usage data for this period.\n`;
54
+ }
55
+ // Footer note about cost
56
+ if (stats.totals.estimatedCostUSD === undefined && stats.totals.requests > 0) {
57
+ output += `\n💡 Cost estimates not available. Configure pricing in config.json or update to latest version.\n`;
58
+ }
59
+ logger.info(`Retrieved usage stats for period: ${period}`);
60
+ return {
61
+ content: [
62
+ {
63
+ type: 'text',
64
+ text: output,
65
+ },
66
+ ],
67
+ };
68
+ }
69
+ function formatPeriodLabel(period) {
70
+ switch (period) {
71
+ case 'today':
72
+ return 'Today';
73
+ case '7d':
74
+ return 'Last 7 Days';
75
+ case '30d':
76
+ return 'Last 30 Days';
77
+ case 'all':
78
+ return 'All Time';
79
+ }
80
+ }
81
+ function formatCost(cost) {
82
+ if (cost < 0.01) {
83
+ return cost.toFixed(6);
84
+ }
85
+ else if (cost < 1) {
86
+ return cost.toFixed(4);
87
+ }
88
+ else {
89
+ return cost.toFixed(2);
90
+ }
91
+ }
92
+ //# sourceMappingURL=get-usage-stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-usage-stats.js","sourceRoot":"","sources":["../../src/tools/get-usage-stats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,aAAa,GAAsB,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEvE,MAAM,UAAU,iBAAiB,CAC/B,YAA0B,EAC1B,IAA6B;IAE7B,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAA2B,CAAC;IAEzD,kBAAkB;IAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAyB,CAAC,EAAE,CAAC;QACv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;YACnF,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,oCAAoC,CAAC;IACjD,CAAC;IAED,yBAAyB;IACzB,IAAI,KAAK,CAAC,MAAM,CAAC,gBAAgB,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,oGAAoG,CAAC;IACjH,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;IAE3D,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM;aACb;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAuB;IAChD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,aAAa,CAAC;QACvB,KAAK,KAAK;YACR,OAAO,cAAc,CAAC;QACxB,KAAK,KAAK;YACR,OAAO,UAAU,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;SAAM,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-rubber-duck",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "An MCP server that bridges to multiple OpenAI-compatible LLMs - your AI rubber duck debugging panel",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -33,6 +33,16 @@ export const MCPBridgeConfigSchema = z.object({
33
33
  mcp_servers: z.array(MCPServerConfigSchema).default([]),
34
34
  });
35
35
 
36
+ export const ModelPricingSchema = z.object({
37
+ inputPricePerMillion: z.number().min(0),
38
+ outputPricePerMillion: z.number().min(0),
39
+ });
40
+
41
+ export const PricingConfigSchema = z.record(
42
+ z.string(), // provider name
43
+ z.record(z.string(), ModelPricingSchema) // model name -> pricing
44
+ );
45
+
36
46
  export const ConfigSchema = z.object({
37
47
  providers: z.record(z.string(), ProviderConfigSchema),
38
48
  default_provider: z.string().optional(),
@@ -41,11 +51,14 @@ export const ConfigSchema = z.object({
41
51
  enable_failover: z.boolean().default(true),
42
52
  log_level: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
43
53
  mcp_bridge: MCPBridgeConfigSchema.optional(),
54
+ pricing: PricingConfigSchema.optional(),
44
55
  });
45
56
 
46
57
  export type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
47
58
  export type MCPServerConfig = z.infer<typeof MCPServerConfigSchema>;
48
59
  export type MCPBridgeConfig = z.infer<typeof MCPBridgeConfigSchema>;
60
+ export type ModelPricing = z.infer<typeof ModelPricingSchema>;
61
+ export type PricingConfig = z.infer<typeof PricingConfigSchema>;
49
62
  export type Config = z.infer<typeof ConfigSchema>;
50
63
 
51
64
  export interface ConversationMessage {
@@ -178,4 +191,42 @@ export interface DebateResult {
178
191
  synthesis: string;
179
192
  synthesizer: string;
180
193
  totalRounds: number;
194
+ }
195
+
196
+ // Usage Statistics Types
197
+ export interface ModelUsageStats {
198
+ requests: number;
199
+ promptTokens: number;
200
+ completionTokens: number;
201
+ cacheHits: number;
202
+ errors: number;
203
+ }
204
+
205
+ export interface DailyUsage {
206
+ [provider: string]: {
207
+ [model: string]: ModelUsageStats;
208
+ };
209
+ }
210
+
211
+ export interface UsageData {
212
+ version: number;
213
+ daily: Record<string, DailyUsage>;
214
+ }
215
+
216
+ export type UsageTimePeriod = 'today' | '7d' | '30d' | 'all';
217
+
218
+ export interface UsageStatsResult {
219
+ period: UsageTimePeriod;
220
+ startDate: string;
221
+ endDate: string;
222
+ usage: DailyUsage;
223
+ totals: {
224
+ requests: number;
225
+ promptTokens: number;
226
+ completionTokens: number;
227
+ cacheHits: number;
228
+ errors: number;
229
+ estimatedCostUSD?: number;
230
+ };
231
+ costByProvider?: Record<string, number>;
181
232
  }
@@ -0,0 +1,368 @@
1
+ import { PricingConfig } from '../config/types.js';
2
+
3
+ /**
4
+ * Default pricing data for common LLM providers.
5
+ * Prices are in USD per million tokens.
6
+ * Last updated: 2026-01-08
7
+ *
8
+ * To update pricing:
9
+ * 1. Research current pricing from provider websites
10
+ * 2. Update the values below
11
+ * 3. Update the lastUpdated field
12
+ * 4. Release a new version
13
+ *
14
+ * Users can override these defaults in their config.json file.
15
+ */
16
+ export const DEFAULT_PRICING_VERSION = 2;
17
+ export const DEFAULT_PRICING_LAST_UPDATED = '2026-01-08';
18
+
19
+ export const DEFAULT_PRICING: PricingConfig = {
20
+ openai: {
21
+ // GPT-5 models (released 2025)
22
+ 'gpt-5': { inputPricePerMillion: 1.25, outputPricePerMillion: 10 },
23
+ 'gpt-5.1': { inputPricePerMillion: 1.25, outputPricePerMillion: 10 },
24
+ 'gpt-5.2': { inputPricePerMillion: 1.25, outputPricePerMillion: 10 },
25
+ 'gpt-5-mini': { inputPricePerMillion: 0.25, outputPricePerMillion: 2 },
26
+ 'gpt-5-nano': { inputPricePerMillion: 0.05, outputPricePerMillion: 0.4 },
27
+
28
+ // GPT-4.1 models
29
+ 'gpt-4.1': { inputPricePerMillion: 2, outputPricePerMillion: 8 },
30
+ 'gpt-4.1-mini': { inputPricePerMillion: 0.4, outputPricePerMillion: 1.6 },
31
+ 'gpt-4.1-nano': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.4 },
32
+
33
+ // GPT-4o models
34
+ 'gpt-4o': { inputPricePerMillion: 2.5, outputPricePerMillion: 10 },
35
+ 'gpt-4o-2024-11-20': { inputPricePerMillion: 2.5, outputPricePerMillion: 10 },
36
+ 'gpt-4o-2024-08-06': { inputPricePerMillion: 2.5, outputPricePerMillion: 10 },
37
+ 'gpt-4o-2024-05-13': { inputPricePerMillion: 5, outputPricePerMillion: 15 },
38
+ 'gpt-4o-mini': { inputPricePerMillion: 0.15, outputPricePerMillion: 0.6 },
39
+ 'gpt-4o-mini-2024-07-18': { inputPricePerMillion: 0.15, outputPricePerMillion: 0.6 },
40
+
41
+ // GPT-4 Turbo
42
+ 'gpt-4-turbo': { inputPricePerMillion: 10, outputPricePerMillion: 30 },
43
+ 'gpt-4-turbo-2024-04-09': { inputPricePerMillion: 10, outputPricePerMillion: 30 },
44
+ 'gpt-4-turbo-preview': { inputPricePerMillion: 10, outputPricePerMillion: 30 },
45
+
46
+ // GPT-4
47
+ 'gpt-4': { inputPricePerMillion: 30, outputPricePerMillion: 60 },
48
+ 'gpt-4-0613': { inputPricePerMillion: 30, outputPricePerMillion: 60 },
49
+
50
+ // GPT-3.5 Turbo
51
+ 'gpt-3.5-turbo': { inputPricePerMillion: 0.5, outputPricePerMillion: 1.5 },
52
+ 'gpt-3.5-turbo-0125': { inputPricePerMillion: 0.5, outputPricePerMillion: 1.5 },
53
+
54
+ // o4 reasoning models
55
+ 'o4-mini': { inputPricePerMillion: 1.1, outputPricePerMillion: 4.4 },
56
+
57
+ // o3 reasoning models
58
+ 'o3': { inputPricePerMillion: 2, outputPricePerMillion: 8 },
59
+ 'o3-mini': { inputPricePerMillion: 1.1, outputPricePerMillion: 4.4 },
60
+
61
+ // o1 reasoning models
62
+ 'o1': { inputPricePerMillion: 15, outputPricePerMillion: 60 },
63
+ 'o1-2024-12-17': { inputPricePerMillion: 15, outputPricePerMillion: 60 },
64
+ 'o1-preview': { inputPricePerMillion: 15, outputPricePerMillion: 60 },
65
+ 'o1-preview-2024-09-12': { inputPricePerMillion: 15, outputPricePerMillion: 60 },
66
+ 'o1-mini': { inputPricePerMillion: 3, outputPricePerMillion: 12 },
67
+ 'o1-mini-2024-09-12': { inputPricePerMillion: 3, outputPricePerMillion: 12 },
68
+ },
69
+
70
+ anthropic: {
71
+ // Claude 4.5 models (current generation)
72
+ 'claude-opus-4-5-20251101': { inputPricePerMillion: 5, outputPricePerMillion: 25 },
73
+ 'claude-opus-4-5': { inputPricePerMillion: 5, outputPricePerMillion: 25 },
74
+ 'claude-sonnet-4-5-20250929': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
75
+ 'claude-sonnet-4-5': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
76
+ 'claude-haiku-4-5': { inputPricePerMillion: 1, outputPricePerMillion: 5 },
77
+
78
+ // Claude 4.1 models
79
+ 'claude-opus-4-1': { inputPricePerMillion: 15, outputPricePerMillion: 75 },
80
+
81
+ // Claude 4 models
82
+ 'claude-opus-4-20250514': { inputPricePerMillion: 15, outputPricePerMillion: 75 },
83
+ 'claude-opus-4': { inputPricePerMillion: 15, outputPricePerMillion: 75 },
84
+ 'claude-sonnet-4-20250514': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
85
+ 'claude-sonnet-4': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
86
+
87
+ // Claude 3.7 models (deprecated but kept for compatibility)
88
+ 'claude-3-7-sonnet-20250219': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
89
+ 'claude-sonnet-3-7': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
90
+
91
+ // Claude 3.5 models
92
+ 'claude-3-5-sonnet-20241022': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
93
+ 'claude-3-5-haiku-20241022': { inputPricePerMillion: 0.8, outputPricePerMillion: 4 },
94
+ 'claude-haiku-3-5': { inputPricePerMillion: 0.8, outputPricePerMillion: 4 },
95
+
96
+ // Claude 3 models (deprecated but kept for compatibility)
97
+ 'claude-3-opus-20240229': { inputPricePerMillion: 15, outputPricePerMillion: 75 },
98
+ 'claude-opus-3': { inputPricePerMillion: 15, outputPricePerMillion: 75 },
99
+ 'claude-3-sonnet-20240229': { inputPricePerMillion: 3, outputPricePerMillion: 15 },
100
+ 'claude-3-haiku-20240307': { inputPricePerMillion: 0.25, outputPricePerMillion: 1.25 },
101
+ 'claude-haiku-3': { inputPricePerMillion: 0.25, outputPricePerMillion: 1.25 },
102
+ },
103
+
104
+ google: {
105
+ // Gemini 3.0 (preview)
106
+ 'gemini-3-pro-preview': { inputPricePerMillion: 2, outputPricePerMillion: 12 },
107
+ 'gemini-3-flash-preview': { inputPricePerMillion: 0.5, outputPricePerMillion: 3 },
108
+ 'gemini-3-pro-image-preview': { inputPricePerMillion: 2, outputPricePerMillion: 120 },
109
+
110
+ // Gemini 2.5
111
+ 'gemini-2.5-pro': { inputPricePerMillion: 1.25, outputPricePerMillion: 10 },
112
+ 'gemini-2.5-pro-latest': { inputPricePerMillion: 1.25, outputPricePerMillion: 10 },
113
+ 'gemini-2.5-flash': { inputPricePerMillion: 0.3, outputPricePerMillion: 2.5 },
114
+ 'gemini-2.5-flash-latest': { inputPricePerMillion: 0.3, outputPricePerMillion: 2.5 },
115
+ 'gemini-2.5-flash-lite': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.4 },
116
+ 'gemini-2.5-flash-preview-09-2025': { inputPricePerMillion: 0.3, outputPricePerMillion: 2.5 },
117
+ 'gemini-2.5-flash-lite-preview-09-2025': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.4 },
118
+ 'gemini-2.5-flash-native-audio-preview-12-2025': {
119
+ inputPricePerMillion: 0.5,
120
+ outputPricePerMillion: 2,
121
+ },
122
+ 'gemini-2.5-computer-use-preview-10-2025': {
123
+ inputPricePerMillion: 1.25,
124
+ outputPricePerMillion: 10,
125
+ },
126
+
127
+ // Gemini 2.0
128
+ 'gemini-2.0-flash': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.4 },
129
+ 'gemini-2.0-flash-lite': { inputPricePerMillion: 0.075, outputPricePerMillion: 0.3 },
130
+ 'gemini-2.0-flash-exp': { inputPricePerMillion: 0, outputPricePerMillion: 0 }, // Free during preview
131
+
132
+ // Gemini 1.5
133
+ 'gemini-1.5-pro': { inputPricePerMillion: 1.25, outputPricePerMillion: 5 },
134
+ 'gemini-1.5-pro-latest': { inputPricePerMillion: 1.25, outputPricePerMillion: 5 },
135
+ 'gemini-1.5-flash': { inputPricePerMillion: 0.075, outputPricePerMillion: 0.3 },
136
+ 'gemini-1.5-flash-latest': { inputPricePerMillion: 0.075, outputPricePerMillion: 0.3 },
137
+ 'gemini-1.5-flash-8b': { inputPricePerMillion: 0.0375, outputPricePerMillion: 0.15 },
138
+
139
+ // Gemini 1.0
140
+ 'gemini-1.0-pro': { inputPricePerMillion: 0.5, outputPricePerMillion: 1.5 },
141
+ 'gemini-pro': { inputPricePerMillion: 0.5, outputPricePerMillion: 1.5 },
142
+
143
+ // Embeddings
144
+ 'gemini-embedding-001': { inputPricePerMillion: 0.15, outputPricePerMillion: 0 },
145
+
146
+ // Robotics (preview)
147
+ 'gemini-robotics-er-1.5-preview': { inputPricePerMillion: 0.3, outputPricePerMillion: 2.5 },
148
+
149
+ // Gemma (free)
150
+ 'gemma-3': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
151
+ 'gemma-3n': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
152
+ },
153
+
154
+ groq: {
155
+ // Llama 4
156
+ 'llama-4-scout-17b-128k': { inputPricePerMillion: 0.11, outputPricePerMillion: 0.34 },
157
+ 'llama-4-maverick-17b-128k': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.6 },
158
+ 'llama-guard-4-12b': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.2 },
159
+
160
+ // Llama 3.3
161
+ 'llama-3.3-70b-versatile': { inputPricePerMillion: 0.59, outputPricePerMillion: 0.79 },
162
+ 'llama-3.3-70b-specdec': { inputPricePerMillion: 0.59, outputPricePerMillion: 0.99 },
163
+
164
+ // Llama 3.1
165
+ 'llama-3.1-70b-versatile': { inputPricePerMillion: 0.59, outputPricePerMillion: 0.79 },
166
+ 'llama-3.1-8b-instant': { inputPricePerMillion: 0.05, outputPricePerMillion: 0.08 },
167
+
168
+ // Llama 3.2
169
+ 'llama-3.2-90b-vision-preview': { inputPricePerMillion: 0.9, outputPricePerMillion: 0.9 },
170
+ 'llama-3.2-11b-vision-preview': { inputPricePerMillion: 0.18, outputPricePerMillion: 0.18 },
171
+ 'llama-3.2-3b-preview': { inputPricePerMillion: 0.06, outputPricePerMillion: 0.06 },
172
+ 'llama-3.2-1b-preview': { inputPricePerMillion: 0.04, outputPricePerMillion: 0.04 },
173
+
174
+ // GPT-OSS models
175
+ 'gpt-oss-120b-128k': { inputPricePerMillion: 0.15, outputPricePerMillion: 0.6 },
176
+ 'gpt-oss-20b-128k': { inputPricePerMillion: 0.075, outputPricePerMillion: 0.3 },
177
+ 'gpt-oss-safeguard-20b': { inputPricePerMillion: 0.075, outputPricePerMillion: 0.3 },
178
+
179
+ // Qwen
180
+ 'qwen3-32b-131k': { inputPricePerMillion: 0.29, outputPricePerMillion: 0.59 },
181
+
182
+ // Kimi
183
+ 'kimi-k2-0905-256k': { inputPricePerMillion: 1, outputPricePerMillion: 3 },
184
+
185
+ // Mixtral
186
+ 'mixtral-8x7b-32768': { inputPricePerMillion: 0.24, outputPricePerMillion: 0.24 },
187
+
188
+ // Gemma
189
+ 'gemma2-9b-it': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.2 },
190
+ 'gemma-7b-it': { inputPricePerMillion: 0.07, outputPricePerMillion: 0.07 },
191
+ },
192
+
193
+ deepseek: {
194
+ // DeepSeek V3.2 (current models)
195
+ 'deepseek-chat': { inputPricePerMillion: 0.28, outputPricePerMillion: 0.42 },
196
+ 'deepseek-reasoner': { inputPricePerMillion: 0.28, outputPricePerMillion: 0.42 },
197
+ // Legacy aliases kept for compatibility
198
+ 'deepseek-v3': { inputPricePerMillion: 0.28, outputPricePerMillion: 0.42 },
199
+ 'deepseek-r1': { inputPricePerMillion: 0.28, outputPricePerMillion: 0.42 },
200
+ },
201
+
202
+ mistral: {
203
+ // Mistral Large
204
+ 'mistral-large-latest': { inputPricePerMillion: 2, outputPricePerMillion: 6 },
205
+ 'mistral-large-2411': { inputPricePerMillion: 2, outputPricePerMillion: 6 },
206
+
207
+ // Mistral Medium 3
208
+ 'mistral-medium-latest': { inputPricePerMillion: 0.4, outputPricePerMillion: 2 },
209
+ 'mistral-medium-3': { inputPricePerMillion: 0.4, outputPricePerMillion: 2 },
210
+
211
+ // Mistral Small 3
212
+ 'mistral-small-latest': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.3 },
213
+ 'mistral-small-2409': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.3 },
214
+ 'mistral-small-3': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.3 },
215
+
216
+ // Codestral
217
+ 'codestral-latest': { inputPricePerMillion: 0.3, outputPricePerMillion: 0.9 },
218
+ 'codestral-2501': { inputPricePerMillion: 0.3, outputPricePerMillion: 0.9 },
219
+
220
+ // Devstral 2
221
+ 'devstral-2': { inputPricePerMillion: 0.4, outputPricePerMillion: 2 },
222
+ 'devstral-small-2': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.3 },
223
+
224
+ // Ministral
225
+ 'ministral-8b-latest': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.1 },
226
+ 'ministral-3b-latest': { inputPricePerMillion: 0.04, outputPricePerMillion: 0.04 },
227
+
228
+ // Pixtral
229
+ 'pixtral-large-latest': { inputPricePerMillion: 2, outputPricePerMillion: 6 },
230
+
231
+ // Open models
232
+ 'open-mistral-nemo': { inputPricePerMillion: 0.15, outputPricePerMillion: 0.15 },
233
+ },
234
+
235
+ together: {
236
+ // Llama 4
237
+ 'meta-llama/Llama-4-Maverick': { inputPricePerMillion: 0.27, outputPricePerMillion: 0.85 },
238
+ 'meta-llama/Llama-4-Scout': { inputPricePerMillion: 0.18, outputPricePerMillion: 0.59 },
239
+
240
+ // Llama 3.3
241
+ 'meta-llama/Llama-3.3-70B-Instruct-Turbo': {
242
+ inputPricePerMillion: 0.88,
243
+ outputPricePerMillion: 0.88,
244
+ },
245
+
246
+ // Llama 3.2
247
+ 'meta-llama/Llama-3.2-3B-Instruct-Turbo': {
248
+ inputPricePerMillion: 0.06,
249
+ outputPricePerMillion: 0.06,
250
+ },
251
+
252
+ // Llama 3.1
253
+ 'meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo': {
254
+ inputPricePerMillion: 3.5,
255
+ outputPricePerMillion: 3.5,
256
+ },
257
+ 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo': {
258
+ inputPricePerMillion: 0.88,
259
+ outputPricePerMillion: 0.88,
260
+ },
261
+ 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo': {
262
+ inputPricePerMillion: 0.18,
263
+ outputPricePerMillion: 0.18,
264
+ },
265
+
266
+ // Llama 3
267
+ 'meta-llama/Llama-3-8B-Instruct-Lite': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.1 },
268
+ 'meta-llama/Llama-3-70B-Instruct-Turbo': {
269
+ inputPricePerMillion: 0.88,
270
+ outputPricePerMillion: 0.88,
271
+ },
272
+
273
+ // DeepSeek
274
+ 'deepseek-ai/DeepSeek-R1': { inputPricePerMillion: 3, outputPricePerMillion: 7 },
275
+ 'deepseek-ai/DeepSeek-R1-Distill-Qwen-14B': {
276
+ inputPricePerMillion: 0.18,
277
+ outputPricePerMillion: 0.18,
278
+ },
279
+ 'deepseek-ai/DeepSeek-R1-Distill-Llama-70B': {
280
+ inputPricePerMillion: 2,
281
+ outputPricePerMillion: 2,
282
+ },
283
+ 'deepseek-ai/DeepSeek-R1-0528-tput': {
284
+ inputPricePerMillion: 0.55,
285
+ outputPricePerMillion: 2.19,
286
+ },
287
+ 'deepseek-ai/DeepSeek-V3-1': { inputPricePerMillion: 0.6, outputPricePerMillion: 1.7 },
288
+ 'deepseek-ai/DeepSeek-V3': { inputPricePerMillion: 1.25, outputPricePerMillion: 1.25 },
289
+
290
+ // GPT-OSS
291
+ 'gpt-oss-120B': { inputPricePerMillion: 0.15, outputPricePerMillion: 0.6 },
292
+ 'gpt-oss-20B': { inputPricePerMillion: 0.05, outputPricePerMillion: 0.2 },
293
+
294
+ // Qwen 3
295
+ 'Qwen/Qwen3-Next-80B-A3B-Instruct': { inputPricePerMillion: 0.15, outputPricePerMillion: 1.5 },
296
+ 'Qwen/Qwen3-Next-80B-A3B-Thinking': { inputPricePerMillion: 0.15, outputPricePerMillion: 1.5 },
297
+ 'Qwen/Qwen3-VL-32B-Instruct': { inputPricePerMillion: 0.5, outputPricePerMillion: 1.5 },
298
+ 'Qwen/Qwen3-Coder-480B-A35B-Instruct': { inputPricePerMillion: 2, outputPricePerMillion: 2 },
299
+ 'Qwen/Qwen3-235B-A22B-Instruct-FP8': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.6 },
300
+ 'Qwen/Qwen3-235B-A22B-Thinking-FP8': { inputPricePerMillion: 0.65, outputPricePerMillion: 3 },
301
+ 'Qwen/Qwen3-235B-A22B-FP8-Throughput': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.6 },
302
+
303
+ // Qwen 2.5
304
+ 'Qwen/Qwen2.5-72B-Instruct-Turbo': { inputPricePerMillion: 1.2, outputPricePerMillion: 1.2 },
305
+ 'Qwen/Qwen2.5-VL-72B-Instruct': { inputPricePerMillion: 1.95, outputPricePerMillion: 8 },
306
+ 'Qwen/Qwen2.5-Coder-32B-Instruct': { inputPricePerMillion: 0.8, outputPricePerMillion: 0.8 },
307
+ 'Qwen/Qwen2.5-7B-Instruct-Turbo': { inputPricePerMillion: 0.3, outputPricePerMillion: 0.3 },
308
+ 'Qwen/QwQ-32B': { inputPricePerMillion: 1.2, outputPricePerMillion: 1.2 },
309
+
310
+ // Kimi
311
+ 'Kimi/K2-Instruct': { inputPricePerMillion: 1, outputPricePerMillion: 3 },
312
+ 'Kimi/K2-Thinking': { inputPricePerMillion: 1.2, outputPricePerMillion: 4 },
313
+ 'Kimi/K2-0905': { inputPricePerMillion: 1, outputPricePerMillion: 3 },
314
+
315
+ // GLM
316
+ 'THUDM/GLM-4.6': { inputPricePerMillion: 0.6, outputPricePerMillion: 2.2 },
317
+ 'THUDM/GLM-4.5-Air': { inputPricePerMillion: 0.2, outputPricePerMillion: 1.1 },
318
+
319
+ // Mistral
320
+ 'mistralai/Mistral-7B-Instruct-v0.2': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.2 },
321
+ 'mistralai/Mistral-Small-3': { inputPricePerMillion: 0.8, outputPricePerMillion: 0.8 },
322
+ 'mistralai/Mixtral-8x7B-Instruct-v0.1': { inputPricePerMillion: 0.6, outputPricePerMillion: 0.6 },
323
+
324
+ // Cogito
325
+ 'Cogito/cogito-v2-109B-MoE': { inputPricePerMillion: 0.18, outputPricePerMillion: 0.59 },
326
+ 'Cogito/cogito-v2-405B': { inputPricePerMillion: 3.5, outputPricePerMillion: 3.5 },
327
+ 'Cogito/cogito-v2-671B-MoE': { inputPricePerMillion: 1.25, outputPricePerMillion: 1.25 },
328
+ 'Cogito/cogito-v2-70B': { inputPricePerMillion: 0.88, outputPricePerMillion: 0.88 },
329
+
330
+ // Arcee
331
+ 'arcee-ai/AFM-4.5B': { inputPricePerMillion: 0.1, outputPricePerMillion: 0.4 },
332
+ 'arcee-ai/Coder-Large': { inputPricePerMillion: 0.5, outputPricePerMillion: 0.8 },
333
+ 'arcee-ai/Maestro': { inputPricePerMillion: 0.9, outputPricePerMillion: 3.3 },
334
+ 'arcee-ai/Virtuoso-Large': { inputPricePerMillion: 0.75, outputPricePerMillion: 1.2 },
335
+
336
+ // Refuel
337
+ 'refuel-ai/Refuel-LLM-2': { inputPricePerMillion: 0.6, outputPricePerMillion: 0.6 },
338
+ 'refuel-ai/Refuel-LLM-2-Small': { inputPricePerMillion: 0.2, outputPricePerMillion: 0.2 },
339
+
340
+ // Typhoon
341
+ 'scb10x/Typhoon-2-70B-Instruct': { inputPricePerMillion: 0.88, outputPricePerMillion: 0.88 },
342
+
343
+ // Marin
344
+ 'marin-ai/Marin-8B-Instruct': { inputPricePerMillion: 0.18, outputPricePerMillion: 0.18 },
345
+
346
+ // Gemma
347
+ 'google/gemma-3n-E4B-it': { inputPricePerMillion: 0.02, outputPricePerMillion: 0.04 },
348
+ },
349
+
350
+ // Local models typically have no per-token cost
351
+ ollama: {
352
+ // All local models are free
353
+ 'llama3.2': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
354
+ 'llama3.1': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
355
+ 'llama3': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
356
+ 'llama4': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
357
+ 'mistral': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
358
+ 'codellama': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
359
+ 'phi3': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
360
+ 'phi4': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
361
+ 'gemma2': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
362
+ 'gemma3': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
363
+ 'qwen2.5': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
364
+ 'qwen3': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
365
+ 'deepseek-r1': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
366
+ 'deepseek-v3': { inputPricePerMillion: 0, outputPricePerMillion: 0 },
367
+ },
368
+ };