@adversity/coding-tool-x 3.0.2 → 3.0.4

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.
@@ -1,5 +1,6 @@
1
1
  const { loadConfig } = require('../../config/loader');
2
2
  const DEFAULT_CONFIG = require('../../config/default');
3
+ const { CLAUDE_MODEL_PRICING, CLAUDE_MODEL_ALIASES } = require('../../config/model-pricing');
3
4
 
4
5
  const RATE_KEYS = ['input', 'output', 'cacheCreation', 'cacheRead', 'cached', 'reasoning'];
5
6
 
@@ -39,7 +40,7 @@ function resolvePricing(toolKey, modelPricing = {}, defaultPricing = {}) {
39
40
  function resolveModelPricing(toolKey, model, hardcodedPricing = {}, defaultPricing = {}) {
40
41
  const config = getPricingConfig(toolKey);
41
42
 
42
- // 1. Check per-model config
43
+ // 1. Check user custom config for specific model first
43
44
  const modelConfig = config?.models?.[model];
44
45
  if (modelConfig && modelConfig.mode === 'custom') {
45
46
  const result = { ...hardcodedPricing };
@@ -51,7 +52,7 @@ function resolveModelPricing(toolKey, model, hardcodedPricing = {}, defaultPrici
51
52
  return result;
52
53
  }
53
54
 
54
- // 2. Fall back to tool-level config
55
+ // 2. Check user custom config for tool-level
55
56
  if (config && config.mode === 'custom') {
56
57
  const result = { ...hardcodedPricing };
57
58
  RATE_KEYS.forEach((key) => {
@@ -62,7 +63,16 @@ function resolveModelPricing(toolKey, model, hardcodedPricing = {}, defaultPrici
62
63
  return result;
63
64
  }
64
65
 
65
- // 3. Use hardcoded pricing
66
+ // 3. Use centralized hardcoded pricing for known models (mode: 'auto')
67
+ // Normalize model name using aliases
68
+ const normalizedModel = CLAUDE_MODEL_ALIASES[model] || model;
69
+ const centralizedPricing = CLAUDE_MODEL_PRICING[normalizedModel];
70
+
71
+ if (centralizedPricing) {
72
+ return { ...defaultPricing, ...centralizedPricing };
73
+ }
74
+
75
+ // 4. Fall back to base pricing for unknown models
66
76
  return { ...defaultPricing, ...hardcodedPricing };
67
77
  }
68
78