@omnicross/contracts 0.1.8 → 0.1.9

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.
@@ -29,9 +29,9 @@ __export(canonical_models_exports, {
29
29
  });
30
30
  module.exports = __toCommonJS(canonical_models_exports);
31
31
  var OPENAI_MODELS = {
32
- "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
33
- "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
34
- "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
32
+ "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
33
+ "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
34
+ "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
35
35
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
36
36
  "gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
37
37
  "gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -200,6 +200,7 @@ function normalizeModelId(rawId) {
200
200
  return noSuffix.toLowerCase();
201
201
  }
202
202
  var MODEL_ALIASES = {
203
+ "gpt-5.6": "gpt-5.6-sol",
203
204
  "deepseek-chat": "deepseek-v3",
204
205
  "deepseek-reasoner": "deepseek-r1"
205
206
  };
@@ -71,9 +71,8 @@ declare function normalizeModelId(rawId: string): string;
71
71
  * assertion at module load enforces this so the alias map can't drift to
72
72
  * point at non-existent entries.
73
73
  *
74
- * Currently covers DeepSeek's marketing names (`deepseek-chat` is the
75
- * marketing alias for the latest non-reasoning model historically v3,
76
- * may rotate as new releases land).
74
+ * Includes official API aliases plus vendor marketing names. DeepSeek's
75
+ * `deepseek-chat` historically targets v3 and may rotate as new releases land.
77
76
  */
78
77
  declare const MODEL_ALIASES: Record<string, string>;
79
78
  /**
@@ -71,9 +71,8 @@ declare function normalizeModelId(rawId: string): string;
71
71
  * assertion at module load enforces this so the alias map can't drift to
72
72
  * point at non-existent entries.
73
73
  *
74
- * Currently covers DeepSeek's marketing names (`deepseek-chat` is the
75
- * marketing alias for the latest non-reasoning model historically v3,
76
- * may rotate as new releases land).
74
+ * Includes official API aliases plus vendor marketing names. DeepSeek's
75
+ * `deepseek-chat` historically targets v3 and may rotate as new releases land.
77
76
  */
78
77
  declare const MODEL_ALIASES: Record<string, string>;
79
78
  /**
@@ -1,8 +1,8 @@
1
1
  // src/canonical-models.ts
2
2
  var OPENAI_MODELS = {
3
- "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
4
- "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
5
- "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
3
+ "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
4
+ "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
5
+ "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
6
6
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
7
7
  "gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
8
8
  "gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -171,6 +171,7 @@ function normalizeModelId(rawId) {
171
171
  return noSuffix.toLowerCase();
172
172
  }
173
173
  var MODEL_ALIASES = {
174
+ "gpt-5.6": "gpt-5.6-sol",
174
175
  "deepseek-chat": "deepseek-v3",
175
176
  "deepseek-reasoner": "deepseek-r1"
176
177
  };
package/dist/index.cjs CHANGED
@@ -35,6 +35,7 @@ __export(index_exports, {
35
35
  EFFORT_RATIO: () => EFFORT_RATIO,
36
36
  EXTENDED_CONTEXT_CAPABLE_MODELS: () => EXTENDED_CONTEXT_CAPABLE_MODELS,
37
37
  KNOWN_MODELS: () => KNOWN_MODELS,
38
+ LEGACY_THINKING_TOKEN_LIMITS: () => LEGACY_THINKING_TOKEN_LIMITS,
38
39
  LLM_PROVIDER_PRESETS: () => LLM_PROVIDER_PRESETS,
39
40
  MAX_CONCURRENCY_DEFAULTS: () => MAX_CONCURRENCY_DEFAULTS,
40
41
  MODEL_ALIASES: () => MODEL_ALIASES,
@@ -51,6 +52,7 @@ __export(index_exports, {
51
52
  buildQwenThinkingConfig: () => buildQwenThinkingConfig,
52
53
  calculateThinkingBudget: () => calculateThinkingBudget,
53
54
  canDisableThinking: () => canDisableThinking,
55
+ findLegacyTokenLimit: () => findLegacyTokenLimit,
54
56
  findTokenLimit: () => findTokenLimit,
55
57
  getAllProviderPresets: () => getAllProviderPresets,
56
58
  getClaudeMaxTokens: () => getClaudeMaxTokens,
@@ -92,9 +94,9 @@ var DEFAULT_BILLING_CONFIG = {
92
94
 
93
95
  // src/canonical-models.ts
94
96
  var OPENAI_MODELS = {
95
- "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
96
- "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
97
- "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
97
+ "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
98
+ "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
99
+ "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
98
100
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
99
101
  "gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
100
102
  "gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -263,6 +265,7 @@ function normalizeModelId(rawId) {
263
265
  return noSuffix.toLowerCase();
264
266
  }
265
267
  var MODEL_ALIASES = {
268
+ "gpt-5.6": "gpt-5.6-sol",
266
269
  "deepseek-chat": "deepseek-v3",
267
270
  "deepseek-reasoner": "deepseek-r1"
268
271
  };
@@ -2583,7 +2586,7 @@ var EFFORT_RATIO = {
2583
2586
  max: 0.95
2584
2587
  };
2585
2588
  var DEFAULT_MAX_TOKENS = 4096;
2586
- var THINKING_TOKEN_MAP = {
2589
+ var LEGACY_THINKING_TOKEN_LIMITS = {
2587
2590
  // Gemini
2588
2591
  "gemini-2\\.5-flash-lite": { min: 512, max: 24576 },
2589
2592
  "gemini-.*-flash": { min: 0, max: 24576 },
@@ -2639,6 +2642,7 @@ var THINKING_TOKEN_MAP = {
2639
2642
  // Doubao
2640
2643
  "doubao.*think": { min: 0, max: 16384 }
2641
2644
  };
2645
+ var THINKING_TOKEN_MAP = LEGACY_THINKING_TOKEN_LIMITS;
2642
2646
  var REASONING_MODEL_PATTERNS = [
2643
2647
  /^o[134](-mini|-preview|-pro)?$/i,
2644
2648
  /^gpt-5(\.\d)?(-pro|-codex|-codex-max)?/i,
@@ -2671,8 +2675,14 @@ function findTokenLimit(modelOrId) {
2671
2675
  if (modelOrId.thinkingTokenLimit) return modelOrId.thinkingTokenLimit;
2672
2676
  return findTokenLimit(modelOrId.id);
2673
2677
  }
2674
- const lowerModelId = modelOrId.toLowerCase();
2675
- for (const [pattern, limit] of Object.entries(THINKING_TOKEN_MAP)) {
2678
+ const canonicalLimit = lookupCanonicalCapabilities(modelOrId)?.thinkingTokenLimit;
2679
+ if (canonicalLimit) return canonicalLimit;
2680
+ return findLegacyTokenLimit(modelOrId);
2681
+ }
2682
+ function findLegacyTokenLimit(modelId) {
2683
+ if (!modelId) return null;
2684
+ const lowerModelId = modelId.toLowerCase();
2685
+ for (const [pattern, limit] of Object.entries(LEGACY_THINKING_TOKEN_LIMITS)) {
2676
2686
  const regex = new RegExp(pattern, "i");
2677
2687
  if (regex.test(lowerModelId)) {
2678
2688
  return limit;
@@ -2802,6 +2812,7 @@ function isLocalProvider(id) {
2802
2812
  EFFORT_RATIO,
2803
2813
  EXTENDED_CONTEXT_CAPABLE_MODELS,
2804
2814
  KNOWN_MODELS,
2815
+ LEGACY_THINKING_TOKEN_LIMITS,
2805
2816
  LLM_PROVIDER_PRESETS,
2806
2817
  MAX_CONCURRENCY_DEFAULTS,
2807
2818
  MODEL_ALIASES,
@@ -2818,6 +2829,7 @@ function isLocalProvider(id) {
2818
2829
  buildQwenThinkingConfig,
2819
2830
  calculateThinkingBudget,
2820
2831
  canDisableThinking,
2832
+ findLegacyTokenLimit,
2821
2833
  findTokenLimit,
2822
2834
  getAllProviderPresets,
2823
2835
  getClaudeMaxTokens,
package/dist/index.d.cts CHANGED
@@ -15,7 +15,7 @@ export { MessageBlock, MessageBlockBase, MessageBlockType, TextBlock, ThinkingBl
15
15
  export { DEFAULT_LITELLM_PRICING_URL, DEFAULT_OPENROUTER_PRICING_URL, PricingConflict, PricingConflictDecision, PricingEntry, PricingEntryInput, PricingFetchResult, PricingResolution, PricingSource, PricingSourceRefreshResult } from './pricing-types.cjs';
16
16
  export { CATALOG_VERSION, CODING_PLAN_URL_PRESETS, DEFAULT_SEED_PRESET_IDS, LLM_PROVIDER_PRESETS, MAX_CONCURRENCY_DEFAULTS, PROVIDER_MODEL_MAPPINGS, PROVIDER_SEARCH_CONFIGS, getAllProviderPresets, getCodingPlanBaseUrl, getPresetById, getPresetRevision, getProviderSearchConfig, resolveFollowProviderModel } from './provider-presets/index.cjs';
17
17
  export { SUBSCRIPTION_MODEL_CATALOG, subscriptionProviderHasCatalog } from './subscription-model-catalog.cjs';
18
- export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.cjs';
18
+ export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, LEGACY_THINKING_TOKEN_LIMITS, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findLegacyTokenLimit, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.cjs';
19
19
  export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageCacheKeySource, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals } from './usage-stats-types.cjs';
20
20
  export { UsageEngineOrigin, UsageTokens } from './usage-types.cjs';
21
21
  export { DEFAULT_VOUCHER_CONFIG, VoucherConfig, VoucherCreated, VoucherGrant, VoucherInfo, VoucherRecord, VoucherRedeemResult, VoucherStatus, VoucherType } from './voucher-types.cjs';
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export { MessageBlock, MessageBlockBase, MessageBlockType, TextBlock, ThinkingBl
15
15
  export { DEFAULT_LITELLM_PRICING_URL, DEFAULT_OPENROUTER_PRICING_URL, PricingConflict, PricingConflictDecision, PricingEntry, PricingEntryInput, PricingFetchResult, PricingResolution, PricingSource, PricingSourceRefreshResult } from './pricing-types.js';
16
16
  export { CATALOG_VERSION, CODING_PLAN_URL_PRESETS, DEFAULT_SEED_PRESET_IDS, LLM_PROVIDER_PRESETS, MAX_CONCURRENCY_DEFAULTS, PROVIDER_MODEL_MAPPINGS, PROVIDER_SEARCH_CONFIGS, getAllProviderPresets, getCodingPlanBaseUrl, getPresetById, getPresetRevision, getProviderSearchConfig, resolveFollowProviderModel } from './provider-presets/index.js';
17
17
  export { SUBSCRIPTION_MODEL_CATALOG, subscriptionProviderHasCatalog } from './subscription-model-catalog.js';
18
- export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.js';
18
+ export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, LEGACY_THINKING_TOKEN_LIMITS, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findLegacyTokenLimit, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.js';
19
19
  export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageCacheKeySource, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals } from './usage-stats-types.js';
20
20
  export { UsageEngineOrigin, UsageTokens } from './usage-types.js';
21
21
  export { DEFAULT_VOUCHER_CONFIG, VoucherConfig, VoucherCreated, VoucherGrant, VoucherInfo, VoucherRecord, VoucherRedeemResult, VoucherStatus, VoucherType } from './voucher-types.js';
package/dist/index.js CHANGED
@@ -15,9 +15,9 @@ var DEFAULT_BILLING_CONFIG = {
15
15
 
16
16
  // src/canonical-models.ts
17
17
  var OPENAI_MODELS = {
18
- "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
19
- "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
20
- "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
18
+ "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
19
+ "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
20
+ "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
21
21
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
22
22
  "gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
23
23
  "gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -186,6 +186,7 @@ function normalizeModelId(rawId) {
186
186
  return noSuffix.toLowerCase();
187
187
  }
188
188
  var MODEL_ALIASES = {
189
+ "gpt-5.6": "gpt-5.6-sol",
189
190
  "deepseek-chat": "deepseek-v3",
190
191
  "deepseek-reasoner": "deepseek-r1"
191
192
  };
@@ -2506,7 +2507,7 @@ var EFFORT_RATIO = {
2506
2507
  max: 0.95
2507
2508
  };
2508
2509
  var DEFAULT_MAX_TOKENS = 4096;
2509
- var THINKING_TOKEN_MAP = {
2510
+ var LEGACY_THINKING_TOKEN_LIMITS = {
2510
2511
  // Gemini
2511
2512
  "gemini-2\\.5-flash-lite": { min: 512, max: 24576 },
2512
2513
  "gemini-.*-flash": { min: 0, max: 24576 },
@@ -2562,6 +2563,7 @@ var THINKING_TOKEN_MAP = {
2562
2563
  // Doubao
2563
2564
  "doubao.*think": { min: 0, max: 16384 }
2564
2565
  };
2566
+ var THINKING_TOKEN_MAP = LEGACY_THINKING_TOKEN_LIMITS;
2565
2567
  var REASONING_MODEL_PATTERNS = [
2566
2568
  /^o[134](-mini|-preview|-pro)?$/i,
2567
2569
  /^gpt-5(\.\d)?(-pro|-codex|-codex-max)?/i,
@@ -2594,8 +2596,14 @@ function findTokenLimit(modelOrId) {
2594
2596
  if (modelOrId.thinkingTokenLimit) return modelOrId.thinkingTokenLimit;
2595
2597
  return findTokenLimit(modelOrId.id);
2596
2598
  }
2597
- const lowerModelId = modelOrId.toLowerCase();
2598
- for (const [pattern, limit] of Object.entries(THINKING_TOKEN_MAP)) {
2599
+ const canonicalLimit = lookupCanonicalCapabilities(modelOrId)?.thinkingTokenLimit;
2600
+ if (canonicalLimit) return canonicalLimit;
2601
+ return findLegacyTokenLimit(modelOrId);
2602
+ }
2603
+ function findLegacyTokenLimit(modelId) {
2604
+ if (!modelId) return null;
2605
+ const lowerModelId = modelId.toLowerCase();
2606
+ for (const [pattern, limit] of Object.entries(LEGACY_THINKING_TOKEN_LIMITS)) {
2599
2607
  const regex = new RegExp(pattern, "i");
2600
2608
  if (regex.test(lowerModelId)) {
2601
2609
  return limit;
@@ -2724,6 +2732,7 @@ export {
2724
2732
  EFFORT_RATIO,
2725
2733
  EXTENDED_CONTEXT_CAPABLE_MODELS,
2726
2734
  KNOWN_MODELS,
2735
+ LEGACY_THINKING_TOKEN_LIMITS,
2727
2736
  LLM_PROVIDER_PRESETS,
2728
2737
  MAX_CONCURRENCY_DEFAULTS,
2729
2738
  MODEL_ALIASES,
@@ -2740,6 +2749,7 @@ export {
2740
2749
  buildQwenThinkingConfig,
2741
2750
  calculateThinkingBudget,
2742
2751
  canDisableThinking,
2752
+ findLegacyTokenLimit,
2743
2753
  findTokenLimit,
2744
2754
  getAllProviderPresets,
2745
2755
  getClaudeMaxTokens,
@@ -23,6 +23,7 @@ __export(thinking_config_exports, {
23
23
  CANNOT_DISABLE_THINKING_PATTERNS: () => CANNOT_DISABLE_THINKING_PATTERNS,
24
24
  DEFAULT_MAX_TOKENS: () => DEFAULT_MAX_TOKENS,
25
25
  EFFORT_RATIO: () => EFFORT_RATIO,
26
+ LEGACY_THINKING_TOKEN_LIMITS: () => LEGACY_THINKING_TOKEN_LIMITS,
26
27
  REASONING_MODEL_PATTERNS: () => REASONING_MODEL_PATTERNS,
27
28
  THINKING_TOKEN_MAP: () => THINKING_TOKEN_MAP,
28
29
  buildAnthropicThinking: () => buildAnthropicThinking,
@@ -30,12 +31,217 @@ __export(thinking_config_exports, {
30
31
  buildQwenThinkingConfig: () => buildQwenThinkingConfig,
31
32
  calculateThinkingBudget: () => calculateThinkingBudget,
32
33
  canDisableThinking: () => canDisableThinking,
34
+ findLegacyTokenLimit: () => findLegacyTokenLimit,
33
35
  findTokenLimit: () => findTokenLimit,
34
36
  getClaudeMaxTokens: () => getClaudeMaxTokens,
35
37
  getOpenAIReasoningEffort: () => getOpenAIReasoningEffort,
36
38
  isReasoningModel: () => isReasoningModel
37
39
  });
38
40
  module.exports = __toCommonJS(thinking_config_exports);
41
+
42
+ // src/canonical-models.ts
43
+ var OPENAI_MODELS = {
44
+ "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
45
+ "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
46
+ "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
47
+ "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
48
+ "gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
49
+ "gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
50
+ "gpt-5.3-codex": { category: "code", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
51
+ "gpt-5.2": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "minimal", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 65536 } },
52
+ "gpt-5": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true },
53
+ "gpt-4.1": { category: "chat", contextLength: 105e4, maxTokens: 32768, vision: true, functionCall: true },
54
+ "gpt-4o": { category: "chat", contextLength: 128e3, maxTokens: 16384, vision: true, functionCall: true },
55
+ "gpt-4o-mini": { category: "chat", contextLength: 128e3, maxTokens: 16384, functionCall: true },
56
+ "o3": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 65536 } },
57
+ "o4-mini": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
58
+ };
59
+ var ANTHROPIC_MODELS = {
60
+ "claude-fable-5": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
61
+ "claude-opus-5": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
62
+ "claude-opus-4-8": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
63
+ "claude-sonnet-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
64
+ "claude-opus-4-7": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
65
+ "claude-opus-4-7[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
66
+ "claude-opus-4-6": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 128e3 } },
67
+ "claude-opus-4-6[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 128e3 } },
68
+ "claude-sonnet-4-6": { category: "chat", contextLength: 2e5, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } },
69
+ "claude-sonnet-4-6[1m]": { category: "chat", contextLength: 1e6, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } },
70
+ "claude-haiku-4-5": { category: "chat", contextLength: 2e5, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } }
71
+ };
72
+ var GEMINI_MODELS = {
73
+ "gemini-3.5-flash": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 24576 } },
74
+ "gemini-3-flash": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 24576 } },
75
+ "gemini-3.1-pro": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 128, max: 32768 } }
76
+ };
77
+ var GROK_MODELS = {
78
+ "grok-4.5": { category: "chat", contextLength: 5e5, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
79
+ "grok-4.3": { category: "chat", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
80
+ "grok-4.20": { category: "chat", contextLength: 131072, maxTokens: 32768, vision: true, functionCall: true },
81
+ "grok-4.20-reasoning": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
82
+ "grok-4.20-multi-agent": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
83
+ };
84
+ var DEEPSEEK_MODELS = {
85
+ "deepseek-v4-flash": { category: "chat", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
86
+ "deepseek-v4-pro": { category: "reasoning", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
87
+ "deepseek-v3": { category: "chat", contextLength: 65536, maxTokens: 8192, functionCall: true },
88
+ "deepseek-v3.2": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true, reasoning: true },
89
+ "deepseek-r1": { category: "reasoning", contextLength: 64e3, maxTokens: 8192, reasoning: true, thinkingTokenLimit: { min: 0, max: 32768 } }
90
+ };
91
+ var ZHIPU_MODELS = {
92
+ "glm-5.2": { category: "chat", contextLength: 1048576, maxTokens: 131072, functionCall: true },
93
+ "glm-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
94
+ "glm-5.1": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
95
+ "glm-4.5-air": { category: "chat", contextLength: 128e3, maxTokens: 32768, functionCall: true },
96
+ "glm-4.6v": { category: "chat", contextLength: 128e3, maxTokens: 32768, vision: true, functionCall: true },
97
+ "glm-4.7": { category: "code", contextLength: 2e5, maxTokens: 128e3, functionCall: true }
98
+ };
99
+ var KIMI_MODELS = {
100
+ "kimi-k3": { category: "code", contextLength: 1048576, maxTokens: 1048576, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
101
+ "kimi-k2.6": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
102
+ "kimi-k2.5": { category: "chat", contextLength: 256e3, maxTokens: 65535, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
103
+ "kimi-k2-thinking": { category: "reasoning", contextLength: 256e3, reasoning: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
104
+ };
105
+ var DASHSCOPE_QWEN_MODELS = {
106
+ "qwen3-max": { category: "chat", contextLength: 262144, maxTokens: 65536, functionCall: true, webSearch: true },
107
+ "qwen3.5-plus": { category: "chat", contextLength: 1e6, vision: true, functionCall: true, webSearch: true },
108
+ "qwen-turbo": { category: "chat", contextLength: 1e6, vision: true, webSearch: true },
109
+ "qwen3-coder-plus": { category: "code", contextLength: 1e6, functionCall: true },
110
+ "qwen-3-coder-480b": { category: "code", contextLength: 131072, maxTokens: 8192, functionCall: true },
111
+ "qwen-3-32b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
112
+ "qwen2.5-coder-32b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true },
113
+ "qwen2.5-coder-7b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true }
114
+ };
115
+ var VOLCENGINE_DOUBAO_MODELS = {
116
+ "ark-code-latest": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true },
117
+ "doubao-seed-2.0-code": { category: "code", contextLength: 256e3, maxTokens: 128e3, vision: true, functionCall: true },
118
+ "doubao-seed-2.0-lite": { category: "chat", contextLength: 256e3, maxTokens: 32768, functionCall: true }
119
+ };
120
+ var TENCENT_HUNYUAN_MODELS = {
121
+ "tc-code-latest": { category: "code", functionCall: true },
122
+ "hunyuan-2.0-instruct": { category: "chat", functionCall: true },
123
+ "hunyuan-turbos": { category: "chat", functionCall: true }
124
+ };
125
+ var MINIMAX_MODELS = {
126
+ "minimax-m2.5": { category: "code", contextLength: 204800, functionCall: true },
127
+ "minimax-m2.5-highspeed": { category: "code", contextLength: 204800, functionCall: true },
128
+ "minimax-m2.1": { category: "code", contextLength: 204800, functionCall: true },
129
+ "minimax-m2.1-highspeed": { category: "code", contextLength: 204800, functionCall: true }
130
+ };
131
+ var XIAOMI_MIMO_CANONICAL = {
132
+ "mimo-v2.5": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
133
+ // mimo-v2.5-pro does not support vision (text + reasoning only).
134
+ "mimo-v2.5-pro": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: false, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
135
+ "mimo-v2-pro": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
136
+ "mimo-v2-flash": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true },
137
+ "mimo-v2-omni": { category: "chat", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true }
138
+ };
139
+ var META_LLAMA_MODELS = {
140
+ "llama-3.3-70b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
141
+ "llama-3.3-70b-versatile": { category: "chat", contextLength: 131072, maxTokens: 32768, functionCall: true },
142
+ "llama-3.3-70b-instruct": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
143
+ "llama-3.3-70b-instruct-turbo": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
144
+ "llama-3.1-8b-instant": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true }
145
+ };
146
+ var MISTRAL_MODELS = {
147
+ "mistral-large-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
148
+ "codestral-latest": { category: "code", contextLength: 256e3, maxTokens: 8192, functionCall: true },
149
+ "mistral-medium-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
150
+ "mixtral-8x7b-32768": { category: "chat", contextLength: 32768, maxTokens: 32768, functionCall: true }
151
+ };
152
+ var PERPLEXITY_MODELS = {
153
+ "sonar": { category: "chat", contextLength: 127072, maxTokens: 8192, webSearch: true },
154
+ "sonar-pro": { category: "chat", contextLength: 2e5, maxTokens: 8192, webSearch: true },
155
+ "sonar-reasoning-pro": { category: "reasoning", contextLength: 127072, maxTokens: 8192, reasoning: true, webSearch: true }
156
+ };
157
+ var BAIDU_ERNIE_MODELS = {
158
+ "qianfan-code-latest": { category: "code", contextLength: 98304, maxTokens: 65536, functionCall: true },
159
+ "ernie-4.5": { category: "chat", functionCall: true },
160
+ "ernie-3.5": { category: "chat" }
161
+ };
162
+ var KUAISHOU_KAT_MODELS = {
163
+ "kat-coder-pro-v1": { category: "code", contextLength: 256e3, maxTokens: 128e3, functionCall: true },
164
+ "kat-coder-air-v1": { category: "code", contextLength: 128e3, maxTokens: 32768, functionCall: true }
165
+ };
166
+ var VENDOR_GROUPS = [
167
+ { name: "OPENAI_MODELS", entries: OPENAI_MODELS },
168
+ { name: "ANTHROPIC_MODELS", entries: ANTHROPIC_MODELS },
169
+ { name: "GEMINI_MODELS", entries: GEMINI_MODELS },
170
+ { name: "GROK_MODELS", entries: GROK_MODELS },
171
+ { name: "DEEPSEEK_MODELS", entries: DEEPSEEK_MODELS },
172
+ { name: "ZHIPU_MODELS", entries: ZHIPU_MODELS },
173
+ { name: "KIMI_MODELS", entries: KIMI_MODELS },
174
+ { name: "DASHSCOPE_QWEN_MODELS", entries: DASHSCOPE_QWEN_MODELS },
175
+ { name: "VOLCENGINE_DOUBAO_MODELS", entries: VOLCENGINE_DOUBAO_MODELS },
176
+ { name: "TENCENT_HUNYUAN_MODELS", entries: TENCENT_HUNYUAN_MODELS },
177
+ { name: "MINIMAX_MODELS", entries: MINIMAX_MODELS },
178
+ { name: "XIAOMI_MIMO_CANONICAL", entries: XIAOMI_MIMO_CANONICAL },
179
+ { name: "META_LLAMA_MODELS", entries: META_LLAMA_MODELS },
180
+ { name: "MISTRAL_MODELS", entries: MISTRAL_MODELS },
181
+ { name: "PERPLEXITY_MODELS", entries: PERPLEXITY_MODELS },
182
+ { name: "BAIDU_ERNIE_MODELS", entries: BAIDU_ERNIE_MODELS },
183
+ { name: "KUAISHOU_KAT_MODELS", entries: KUAISHOU_KAT_MODELS }
184
+ ];
185
+ function assertNoDuplicateCanonicalIds() {
186
+ const seen = /* @__PURE__ */ new Map();
187
+ for (const { name, entries } of VENDOR_GROUPS) {
188
+ for (const id of Object.keys(entries)) {
189
+ const prior = seen.get(id);
190
+ if (prior) {
191
+ throw new Error(
192
+ `[canonical-models] duplicate id '${id}' registered in both '${prior}' and '${name}'. Each model must live in exactly one vendor group.`
193
+ );
194
+ }
195
+ seen.set(id, name);
196
+ }
197
+ }
198
+ }
199
+ assertNoDuplicateCanonicalIds();
200
+ var KNOWN_MODELS = Object.freeze(
201
+ Object.assign(
202
+ /* @__PURE__ */ Object.create(null),
203
+ ...VENDOR_GROUPS.map((g) => g.entries)
204
+ )
205
+ );
206
+ function normalizeModelId(rawId) {
207
+ if (!rawId) return "";
208
+ const slashIdx = rawId.lastIndexOf("/");
209
+ const base = slashIdx >= 0 ? rawId.slice(slashIdx + 1) : rawId;
210
+ const colonIdx = base.indexOf(":");
211
+ const noSuffix = colonIdx >= 0 ? base.slice(0, colonIdx) : base;
212
+ return noSuffix.toLowerCase();
213
+ }
214
+ var MODEL_ALIASES = {
215
+ "gpt-5.6": "gpt-5.6-sol",
216
+ "deepseek-chat": "deepseek-v3",
217
+ "deepseek-reasoner": "deepseek-r1"
218
+ };
219
+ function applyAlias(normalizedId) {
220
+ return MODEL_ALIASES[normalizedId] ?? normalizedId;
221
+ }
222
+ function assertAliasesPointToKnownModels() {
223
+ for (const [from, to] of Object.entries(MODEL_ALIASES)) {
224
+ if (!(to in KNOWN_MODELS)) {
225
+ throw new Error(
226
+ `[canonical-models] alias '${from}' \u2192 '${to}' points at unknown id. Either add '${to}' to a vendor group or fix the alias.`
227
+ );
228
+ }
229
+ }
230
+ }
231
+ assertAliasesPointToKnownModels();
232
+ function lookupCanonicalCapabilities(rawId, extendedContext = false) {
233
+ const normalized = normalizeModelId(rawId);
234
+ if (!normalized) return void 0;
235
+ const canonicalId = applyAlias(normalized);
236
+ if (extendedContext) {
237
+ const extendedKey = `${canonicalId}[1m]`;
238
+ const extended = KNOWN_MODELS[extendedKey];
239
+ if (extended) return extended;
240
+ }
241
+ return KNOWN_MODELS[canonicalId];
242
+ }
243
+
244
+ // src/thinking-config.ts
39
245
  var EFFORT_RATIO = {
40
246
  none: 0.01,
41
247
  minimal: 0.02,
@@ -46,7 +252,7 @@ var EFFORT_RATIO = {
46
252
  max: 0.95
47
253
  };
48
254
  var DEFAULT_MAX_TOKENS = 4096;
49
- var THINKING_TOKEN_MAP = {
255
+ var LEGACY_THINKING_TOKEN_LIMITS = {
50
256
  // Gemini
51
257
  "gemini-2\\.5-flash-lite": { min: 512, max: 24576 },
52
258
  "gemini-.*-flash": { min: 0, max: 24576 },
@@ -102,6 +308,7 @@ var THINKING_TOKEN_MAP = {
102
308
  // Doubao
103
309
  "doubao.*think": { min: 0, max: 16384 }
104
310
  };
311
+ var THINKING_TOKEN_MAP = LEGACY_THINKING_TOKEN_LIMITS;
105
312
  var REASONING_MODEL_PATTERNS = [
106
313
  /^o[134](-mini|-preview|-pro)?$/i,
107
314
  /^gpt-5(\.\d)?(-pro|-codex|-codex-max)?/i,
@@ -134,8 +341,14 @@ function findTokenLimit(modelOrId) {
134
341
  if (modelOrId.thinkingTokenLimit) return modelOrId.thinkingTokenLimit;
135
342
  return findTokenLimit(modelOrId.id);
136
343
  }
137
- const lowerModelId = modelOrId.toLowerCase();
138
- for (const [pattern, limit] of Object.entries(THINKING_TOKEN_MAP)) {
344
+ const canonicalLimit = lookupCanonicalCapabilities(modelOrId)?.thinkingTokenLimit;
345
+ if (canonicalLimit) return canonicalLimit;
346
+ return findLegacyTokenLimit(modelOrId);
347
+ }
348
+ function findLegacyTokenLimit(modelId) {
349
+ if (!modelId) return null;
350
+ const lowerModelId = modelId.toLowerCase();
351
+ for (const [pattern, limit] of Object.entries(LEGACY_THINKING_TOKEN_LIMITS)) {
139
352
  const regex = new RegExp(pattern, "i");
140
353
  if (regex.test(lowerModelId)) {
141
354
  return limit;
@@ -229,6 +442,7 @@ function buildQwenThinkingConfig(level, userMaxTokens) {
229
442
  CANNOT_DISABLE_THINKING_PATTERNS,
230
443
  DEFAULT_MAX_TOKENS,
231
444
  EFFORT_RATIO,
445
+ LEGACY_THINKING_TOKEN_LIMITS,
232
446
  REASONING_MODEL_PATTERNS,
233
447
  THINKING_TOKEN_MAP,
234
448
  buildAnthropicThinking,
@@ -236,6 +450,7 @@ function buildQwenThinkingConfig(level, userMaxTokens) {
236
450
  buildQwenThinkingConfig,
237
451
  calculateThinkingBudget,
238
452
  canDisableThinking,
453
+ findLegacyTokenLimit,
239
454
  findTokenLimit,
240
455
  getClaudeMaxTokens,
241
456
  getOpenAIReasoningEffort,
@@ -4,16 +4,14 @@ import { M as ModelConfig } from './llm-config-DeWNx1ig.cjs';
4
4
  /**
5
5
  * thinking-config — dependency-light thinking-budget / reasoning-effort helpers.
6
6
  *
7
- * The PURE budget/effort functions the `@omnicross/*` packages consume
7
+ * The budget/effort functions the `@omnicross/*` packages consume
8
8
  * (`getOpenAIReasoningEffort`, `buildAnthropicThinking`, `calculateThinkingBudget`,
9
9
  * `getClaudeMaxTokens`, `isReasoningModel`, `DEFAULT_MAX_TOKENS`) plus the in-file
10
10
  * regex/numeric data they rely on.
11
11
  *
12
- * This module is intentionally import-closed (0 runtime deps): it OMITS any
13
- * global model-thinking-level cache + its initializing side-effect (which would
14
- * pull the full canonical-models / provider-presets closure into the import
15
- * graph) and the cache-fed lookups (`getAvailableThinkLevels` / `validateThinkLevel`),
16
- * none of which the `@omnicross/*` packages call.
12
+ * Canonical model metadata is the authoritative token-limit source. The regex
13
+ * table in this module remains a compatibility fallback for unregistered model
14
+ * ids; it is not a second model registry.
17
15
  */
18
16
 
19
17
  /**
@@ -24,6 +22,14 @@ import { M as ModelConfig } from './llm-config-DeWNx1ig.cjs';
24
22
  declare const EFFORT_RATIO: Record<ThinkLevel, number>;
25
23
  /** Global default max_tokens — used only when an API requires max_tokens set. */
26
24
  declare const DEFAULT_MAX_TOKENS = 4096;
25
+ declare const LEGACY_THINKING_TOKEN_LIMITS: Record<string, {
26
+ min: number;
27
+ max: number;
28
+ }>;
29
+ /**
30
+ * @deprecated Use `findTokenLimit` for canonical-first lookup. This alias is
31
+ * retained for consumers that inspect the legacy regex fallback table.
32
+ */
27
33
  declare const THINKING_TOKEN_MAP: Record<string, {
28
34
  min: number;
29
35
  max: number;
@@ -37,13 +43,22 @@ declare function isReasoningModel(modelId: string): boolean;
37
43
  /** Whether the model can disable thinking. */
38
44
  declare function canDisableThinking(modelId: string): boolean;
39
45
  /**
40
- * Resolve the model's thinking-token limit. Prefers a declared
41
- * `ModelConfig.thinkingTokenLimit`, else falls back to a regex match.
46
+ * Resolve the model's thinking-token limit. Priority is an explicit model-row
47
+ * declaration, canonical metadata, then the legacy regex fallback table.
42
48
  */
43
49
  declare function findTokenLimit(modelOrId: string | ModelConfig): {
44
50
  min: number;
45
51
  max: number;
46
52
  } | null;
53
+ /**
54
+ * Match only the legacy regex compatibility table. New request builders should
55
+ * normally call `findTokenLimit`; the shared reasoning resolver uses this
56
+ * narrower helper after it has already merged provider and canonical metadata.
57
+ */
58
+ declare function findLegacyTokenLimit(modelId: string): {
59
+ min: number;
60
+ max: number;
61
+ } | null;
47
62
  /**
48
63
  * Calculate the thinking budget for a model + effort level.
49
64
  * Returns undefined when no budget can be computed.
@@ -51,7 +66,14 @@ declare function findTokenLimit(modelOrId: string | ModelConfig): {
51
66
  declare function calculateThinkingBudget(modelId: string, level: ThinkLevel, userMaxTokens?: number): number | undefined;
52
67
  /** Claude max_tokens after subtracting the thinking budget. */
53
68
  declare function getClaudeMaxTokens(userMaxTokens: number | undefined, thinkingBudget: number | undefined): number | undefined;
54
- /** OpenAI reasoning_effort mapping (pass-through; `max` maps to `high`). */
69
+ /**
70
+ * Context-free OpenAI reasoning_effort compatibility mapping.
71
+ *
72
+ * @deprecated This helper cannot determine whether a target model supports the
73
+ * requested effort. Internal request builders must use the model-aware core
74
+ * reasoning-plan resolver. Historical `max -> high` behavior is retained for
75
+ * external callers during the compatibility window.
76
+ */
55
77
  declare function getOpenAIReasoningEffort(level: ThinkLevel): string | undefined;
56
78
  /** Gemini thinkingConfig builder. */
57
79
  declare function buildGeminiThinkingConfig(modelId: string, level: ThinkLevel, userMaxTokens?: number): {
@@ -68,4 +90,4 @@ declare function buildQwenThinkingConfig(level: ThinkLevel, userMaxTokens?: numb
68
90
  thinking_budget?: number;
69
91
  };
70
92
 
71
- export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel };
93
+ export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, LEGACY_THINKING_TOKEN_LIMITS, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findLegacyTokenLimit, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel };
@@ -4,16 +4,14 @@ import { M as ModelConfig } from './llm-config-CKOaFFdy.js';
4
4
  /**
5
5
  * thinking-config — dependency-light thinking-budget / reasoning-effort helpers.
6
6
  *
7
- * The PURE budget/effort functions the `@omnicross/*` packages consume
7
+ * The budget/effort functions the `@omnicross/*` packages consume
8
8
  * (`getOpenAIReasoningEffort`, `buildAnthropicThinking`, `calculateThinkingBudget`,
9
9
  * `getClaudeMaxTokens`, `isReasoningModel`, `DEFAULT_MAX_TOKENS`) plus the in-file
10
10
  * regex/numeric data they rely on.
11
11
  *
12
- * This module is intentionally import-closed (0 runtime deps): it OMITS any
13
- * global model-thinking-level cache + its initializing side-effect (which would
14
- * pull the full canonical-models / provider-presets closure into the import
15
- * graph) and the cache-fed lookups (`getAvailableThinkLevels` / `validateThinkLevel`),
16
- * none of which the `@omnicross/*` packages call.
12
+ * Canonical model metadata is the authoritative token-limit source. The regex
13
+ * table in this module remains a compatibility fallback for unregistered model
14
+ * ids; it is not a second model registry.
17
15
  */
18
16
 
19
17
  /**
@@ -24,6 +22,14 @@ import { M as ModelConfig } from './llm-config-CKOaFFdy.js';
24
22
  declare const EFFORT_RATIO: Record<ThinkLevel, number>;
25
23
  /** Global default max_tokens — used only when an API requires max_tokens set. */
26
24
  declare const DEFAULT_MAX_TOKENS = 4096;
25
+ declare const LEGACY_THINKING_TOKEN_LIMITS: Record<string, {
26
+ min: number;
27
+ max: number;
28
+ }>;
29
+ /**
30
+ * @deprecated Use `findTokenLimit` for canonical-first lookup. This alias is
31
+ * retained for consumers that inspect the legacy regex fallback table.
32
+ */
27
33
  declare const THINKING_TOKEN_MAP: Record<string, {
28
34
  min: number;
29
35
  max: number;
@@ -37,13 +43,22 @@ declare function isReasoningModel(modelId: string): boolean;
37
43
  /** Whether the model can disable thinking. */
38
44
  declare function canDisableThinking(modelId: string): boolean;
39
45
  /**
40
- * Resolve the model's thinking-token limit. Prefers a declared
41
- * `ModelConfig.thinkingTokenLimit`, else falls back to a regex match.
46
+ * Resolve the model's thinking-token limit. Priority is an explicit model-row
47
+ * declaration, canonical metadata, then the legacy regex fallback table.
42
48
  */
43
49
  declare function findTokenLimit(modelOrId: string | ModelConfig): {
44
50
  min: number;
45
51
  max: number;
46
52
  } | null;
53
+ /**
54
+ * Match only the legacy regex compatibility table. New request builders should
55
+ * normally call `findTokenLimit`; the shared reasoning resolver uses this
56
+ * narrower helper after it has already merged provider and canonical metadata.
57
+ */
58
+ declare function findLegacyTokenLimit(modelId: string): {
59
+ min: number;
60
+ max: number;
61
+ } | null;
47
62
  /**
48
63
  * Calculate the thinking budget for a model + effort level.
49
64
  * Returns undefined when no budget can be computed.
@@ -51,7 +66,14 @@ declare function findTokenLimit(modelOrId: string | ModelConfig): {
51
66
  declare function calculateThinkingBudget(modelId: string, level: ThinkLevel, userMaxTokens?: number): number | undefined;
52
67
  /** Claude max_tokens after subtracting the thinking budget. */
53
68
  declare function getClaudeMaxTokens(userMaxTokens: number | undefined, thinkingBudget: number | undefined): number | undefined;
54
- /** OpenAI reasoning_effort mapping (pass-through; `max` maps to `high`). */
69
+ /**
70
+ * Context-free OpenAI reasoning_effort compatibility mapping.
71
+ *
72
+ * @deprecated This helper cannot determine whether a target model supports the
73
+ * requested effort. Internal request builders must use the model-aware core
74
+ * reasoning-plan resolver. Historical `max -> high` behavior is retained for
75
+ * external callers during the compatibility window.
76
+ */
55
77
  declare function getOpenAIReasoningEffort(level: ThinkLevel): string | undefined;
56
78
  /** Gemini thinkingConfig builder. */
57
79
  declare function buildGeminiThinkingConfig(modelId: string, level: ThinkLevel, userMaxTokens?: number): {
@@ -68,4 +90,4 @@ declare function buildQwenThinkingConfig(level: ThinkLevel, userMaxTokens?: numb
68
90
  thinking_budget?: number;
69
91
  };
70
92
 
71
- export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel };
93
+ export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, LEGACY_THINKING_TOKEN_LIMITS, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findLegacyTokenLimit, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel };
@@ -1,3 +1,205 @@
1
+ // src/canonical-models.ts
2
+ var OPENAI_MODELS = {
3
+ "gpt-5.6-sol": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
4
+ "gpt-5.6-terra": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
5
+ "gpt-5.6-luna": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 0, max: 128e3 } },
6
+ "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
7
+ "gpt-5.4": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
8
+ "gpt-5.4-mini": { category: "reasoning", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
9
+ "gpt-5.3-codex": { category: "code", contextLength: 4e5, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
10
+ "gpt-5.2": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "minimal", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 65536 } },
11
+ "gpt-5": { category: "reasoning", contextLength: 105e4, maxTokens: 65536, reasoning: true, vision: true, functionCall: true },
12
+ "gpt-4.1": { category: "chat", contextLength: 105e4, maxTokens: 32768, vision: true, functionCall: true },
13
+ "gpt-4o": { category: "chat", contextLength: 128e3, maxTokens: 16384, vision: true, functionCall: true },
14
+ "gpt-4o-mini": { category: "chat", contextLength: 128e3, maxTokens: 16384, functionCall: true },
15
+ "o3": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 65536 } },
16
+ "o4-mini": { category: "reasoning", contextLength: 2e5, maxTokens: 1e5, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
17
+ };
18
+ var ANTHROPIC_MODELS = {
19
+ "claude-fable-5": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
20
+ "claude-opus-5": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
21
+ "claude-opus-4-8": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
22
+ "claude-sonnet-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
23
+ "claude-opus-4-7": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
24
+ "claude-opus-4-7[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true },
25
+ "claude-opus-4-6": { category: "reasoning", contextLength: 2e5, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 128e3 } },
26
+ "claude-opus-4-6[1m]": { category: "reasoning", contextLength: 1e6, maxTokens: 128e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 128e3 } },
27
+ "claude-sonnet-4-6": { category: "chat", contextLength: 2e5, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } },
28
+ "claude-sonnet-4-6[1m]": { category: "chat", contextLength: 1e6, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } },
29
+ "claude-haiku-4-5": { category: "chat", contextLength: 2e5, maxTokens: 64e3, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh", "max"], thinkingTokenLimit: { min: 1024, max: 64e3 } }
30
+ };
31
+ var GEMINI_MODELS = {
32
+ "gemini-3.5-flash": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 24576 } },
33
+ "gemini-3-flash": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 24576 } },
34
+ "gemini-3.1-pro": { category: "chat", contextLength: 1e6, maxTokens: 65536, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["low", "medium", "high"], thinkingTokenLimit: { min: 128, max: 32768 } }
35
+ };
36
+ var GROK_MODELS = {
37
+ "grok-4.5": { category: "chat", contextLength: 5e5, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
38
+ "grok-4.3": { category: "chat", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
39
+ "grok-4.20": { category: "chat", contextLength: 131072, maxTokens: 32768, vision: true, functionCall: true },
40
+ "grok-4.20-reasoning": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
41
+ "grok-4.20-multi-agent": { category: "reasoning", contextLength: 131072, maxTokens: 32768, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
42
+ };
43
+ var DEEPSEEK_MODELS = {
44
+ "deepseek-v4-flash": { category: "chat", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
45
+ "deepseek-v4-pro": { category: "reasoning", contextLength: 1e6, maxTokens: 384e3, functionCall: true, reasoning: true, thinkingLevels: ["none", "high", "max"], thinkingTokenLimit: { min: 0, max: 32768 } },
46
+ "deepseek-v3": { category: "chat", contextLength: 65536, maxTokens: 8192, functionCall: true },
47
+ "deepseek-v3.2": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true, reasoning: true },
48
+ "deepseek-r1": { category: "reasoning", contextLength: 64e3, maxTokens: 8192, reasoning: true, thinkingTokenLimit: { min: 0, max: 32768 } }
49
+ };
50
+ var ZHIPU_MODELS = {
51
+ "glm-5.2": { category: "chat", contextLength: 1048576, maxTokens: 131072, functionCall: true },
52
+ "glm-5": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
53
+ "glm-5.1": { category: "chat", contextLength: 2e5, maxTokens: 128e3, functionCall: true },
54
+ "glm-4.5-air": { category: "chat", contextLength: 128e3, maxTokens: 32768, functionCall: true },
55
+ "glm-4.6v": { category: "chat", contextLength: 128e3, maxTokens: 32768, vision: true, functionCall: true },
56
+ "glm-4.7": { category: "code", contextLength: 2e5, maxTokens: 128e3, functionCall: true }
57
+ };
58
+ var KIMI_MODELS = {
59
+ "kimi-k3": { category: "code", contextLength: 1048576, maxTokens: 1048576, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
60
+ "kimi-k2.6": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
61
+ "kimi-k2.5": { category: "chat", contextLength: 256e3, maxTokens: 65535, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
62
+ "kimi-k2-thinking": { category: "reasoning", contextLength: 256e3, reasoning: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } }
63
+ };
64
+ var DASHSCOPE_QWEN_MODELS = {
65
+ "qwen3-max": { category: "chat", contextLength: 262144, maxTokens: 65536, functionCall: true, webSearch: true },
66
+ "qwen3.5-plus": { category: "chat", contextLength: 1e6, vision: true, functionCall: true, webSearch: true },
67
+ "qwen-turbo": { category: "chat", contextLength: 1e6, vision: true, webSearch: true },
68
+ "qwen3-coder-plus": { category: "code", contextLength: 1e6, functionCall: true },
69
+ "qwen-3-coder-480b": { category: "code", contextLength: 131072, maxTokens: 8192, functionCall: true },
70
+ "qwen-3-32b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
71
+ "qwen2.5-coder-32b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true },
72
+ "qwen2.5-coder-7b-instruct": { category: "code", contextLength: 32768, maxTokens: 8192, functionCall: true }
73
+ };
74
+ var VOLCENGINE_DOUBAO_MODELS = {
75
+ "ark-code-latest": { category: "code", contextLength: 256e3, maxTokens: 32768, functionCall: true },
76
+ "doubao-seed-2.0-code": { category: "code", contextLength: 256e3, maxTokens: 128e3, vision: true, functionCall: true },
77
+ "doubao-seed-2.0-lite": { category: "chat", contextLength: 256e3, maxTokens: 32768, functionCall: true }
78
+ };
79
+ var TENCENT_HUNYUAN_MODELS = {
80
+ "tc-code-latest": { category: "code", functionCall: true },
81
+ "hunyuan-2.0-instruct": { category: "chat", functionCall: true },
82
+ "hunyuan-turbos": { category: "chat", functionCall: true }
83
+ };
84
+ var MINIMAX_MODELS = {
85
+ "minimax-m2.5": { category: "code", contextLength: 204800, functionCall: true },
86
+ "minimax-m2.5-highspeed": { category: "code", contextLength: 204800, functionCall: true },
87
+ "minimax-m2.1": { category: "code", contextLength: 204800, functionCall: true },
88
+ "minimax-m2.1-highspeed": { category: "code", contextLength: 204800, functionCall: true }
89
+ };
90
+ var XIAOMI_MIMO_CANONICAL = {
91
+ "mimo-v2.5": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
92
+ // mimo-v2.5-pro does not support vision (text + reasoning only).
93
+ "mimo-v2.5-pro": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: false, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
94
+ "mimo-v2-pro": { category: "code", contextLength: 1e6, maxTokens: 32768, vision: true, functionCall: true, reasoning: true, thinkingLevels: ["none", "low", "medium", "high"], thinkingTokenLimit: { min: 0, max: 32768 } },
95
+ "mimo-v2-flash": { category: "code", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true },
96
+ "mimo-v2-omni": { category: "chat", contextLength: 256e3, maxTokens: 32768, vision: true, functionCall: true }
97
+ };
98
+ var META_LLAMA_MODELS = {
99
+ "llama-3.3-70b": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
100
+ "llama-3.3-70b-versatile": { category: "chat", contextLength: 131072, maxTokens: 32768, functionCall: true },
101
+ "llama-3.3-70b-instruct": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
102
+ "llama-3.3-70b-instruct-turbo": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
103
+ "llama-3.1-8b-instant": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true }
104
+ };
105
+ var MISTRAL_MODELS = {
106
+ "mistral-large-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
107
+ "codestral-latest": { category: "code", contextLength: 256e3, maxTokens: 8192, functionCall: true },
108
+ "mistral-medium-latest": { category: "chat", contextLength: 131072, maxTokens: 8192, functionCall: true },
109
+ "mixtral-8x7b-32768": { category: "chat", contextLength: 32768, maxTokens: 32768, functionCall: true }
110
+ };
111
+ var PERPLEXITY_MODELS = {
112
+ "sonar": { category: "chat", contextLength: 127072, maxTokens: 8192, webSearch: true },
113
+ "sonar-pro": { category: "chat", contextLength: 2e5, maxTokens: 8192, webSearch: true },
114
+ "sonar-reasoning-pro": { category: "reasoning", contextLength: 127072, maxTokens: 8192, reasoning: true, webSearch: true }
115
+ };
116
+ var BAIDU_ERNIE_MODELS = {
117
+ "qianfan-code-latest": { category: "code", contextLength: 98304, maxTokens: 65536, functionCall: true },
118
+ "ernie-4.5": { category: "chat", functionCall: true },
119
+ "ernie-3.5": { category: "chat" }
120
+ };
121
+ var KUAISHOU_KAT_MODELS = {
122
+ "kat-coder-pro-v1": { category: "code", contextLength: 256e3, maxTokens: 128e3, functionCall: true },
123
+ "kat-coder-air-v1": { category: "code", contextLength: 128e3, maxTokens: 32768, functionCall: true }
124
+ };
125
+ var VENDOR_GROUPS = [
126
+ { name: "OPENAI_MODELS", entries: OPENAI_MODELS },
127
+ { name: "ANTHROPIC_MODELS", entries: ANTHROPIC_MODELS },
128
+ { name: "GEMINI_MODELS", entries: GEMINI_MODELS },
129
+ { name: "GROK_MODELS", entries: GROK_MODELS },
130
+ { name: "DEEPSEEK_MODELS", entries: DEEPSEEK_MODELS },
131
+ { name: "ZHIPU_MODELS", entries: ZHIPU_MODELS },
132
+ { name: "KIMI_MODELS", entries: KIMI_MODELS },
133
+ { name: "DASHSCOPE_QWEN_MODELS", entries: DASHSCOPE_QWEN_MODELS },
134
+ { name: "VOLCENGINE_DOUBAO_MODELS", entries: VOLCENGINE_DOUBAO_MODELS },
135
+ { name: "TENCENT_HUNYUAN_MODELS", entries: TENCENT_HUNYUAN_MODELS },
136
+ { name: "MINIMAX_MODELS", entries: MINIMAX_MODELS },
137
+ { name: "XIAOMI_MIMO_CANONICAL", entries: XIAOMI_MIMO_CANONICAL },
138
+ { name: "META_LLAMA_MODELS", entries: META_LLAMA_MODELS },
139
+ { name: "MISTRAL_MODELS", entries: MISTRAL_MODELS },
140
+ { name: "PERPLEXITY_MODELS", entries: PERPLEXITY_MODELS },
141
+ { name: "BAIDU_ERNIE_MODELS", entries: BAIDU_ERNIE_MODELS },
142
+ { name: "KUAISHOU_KAT_MODELS", entries: KUAISHOU_KAT_MODELS }
143
+ ];
144
+ function assertNoDuplicateCanonicalIds() {
145
+ const seen = /* @__PURE__ */ new Map();
146
+ for (const { name, entries } of VENDOR_GROUPS) {
147
+ for (const id of Object.keys(entries)) {
148
+ const prior = seen.get(id);
149
+ if (prior) {
150
+ throw new Error(
151
+ `[canonical-models] duplicate id '${id}' registered in both '${prior}' and '${name}'. Each model must live in exactly one vendor group.`
152
+ );
153
+ }
154
+ seen.set(id, name);
155
+ }
156
+ }
157
+ }
158
+ assertNoDuplicateCanonicalIds();
159
+ var KNOWN_MODELS = Object.freeze(
160
+ Object.assign(
161
+ /* @__PURE__ */ Object.create(null),
162
+ ...VENDOR_GROUPS.map((g) => g.entries)
163
+ )
164
+ );
165
+ function normalizeModelId(rawId) {
166
+ if (!rawId) return "";
167
+ const slashIdx = rawId.lastIndexOf("/");
168
+ const base = slashIdx >= 0 ? rawId.slice(slashIdx + 1) : rawId;
169
+ const colonIdx = base.indexOf(":");
170
+ const noSuffix = colonIdx >= 0 ? base.slice(0, colonIdx) : base;
171
+ return noSuffix.toLowerCase();
172
+ }
173
+ var MODEL_ALIASES = {
174
+ "gpt-5.6": "gpt-5.6-sol",
175
+ "deepseek-chat": "deepseek-v3",
176
+ "deepseek-reasoner": "deepseek-r1"
177
+ };
178
+ function applyAlias(normalizedId) {
179
+ return MODEL_ALIASES[normalizedId] ?? normalizedId;
180
+ }
181
+ function assertAliasesPointToKnownModels() {
182
+ for (const [from, to] of Object.entries(MODEL_ALIASES)) {
183
+ if (!(to in KNOWN_MODELS)) {
184
+ throw new Error(
185
+ `[canonical-models] alias '${from}' \u2192 '${to}' points at unknown id. Either add '${to}' to a vendor group or fix the alias.`
186
+ );
187
+ }
188
+ }
189
+ }
190
+ assertAliasesPointToKnownModels();
191
+ function lookupCanonicalCapabilities(rawId, extendedContext = false) {
192
+ const normalized = normalizeModelId(rawId);
193
+ if (!normalized) return void 0;
194
+ const canonicalId = applyAlias(normalized);
195
+ if (extendedContext) {
196
+ const extendedKey = `${canonicalId}[1m]`;
197
+ const extended = KNOWN_MODELS[extendedKey];
198
+ if (extended) return extended;
199
+ }
200
+ return KNOWN_MODELS[canonicalId];
201
+ }
202
+
1
203
  // src/thinking-config.ts
2
204
  var EFFORT_RATIO = {
3
205
  none: 0.01,
@@ -9,7 +211,7 @@ var EFFORT_RATIO = {
9
211
  max: 0.95
10
212
  };
11
213
  var DEFAULT_MAX_TOKENS = 4096;
12
- var THINKING_TOKEN_MAP = {
214
+ var LEGACY_THINKING_TOKEN_LIMITS = {
13
215
  // Gemini
14
216
  "gemini-2\\.5-flash-lite": { min: 512, max: 24576 },
15
217
  "gemini-.*-flash": { min: 0, max: 24576 },
@@ -65,6 +267,7 @@ var THINKING_TOKEN_MAP = {
65
267
  // Doubao
66
268
  "doubao.*think": { min: 0, max: 16384 }
67
269
  };
270
+ var THINKING_TOKEN_MAP = LEGACY_THINKING_TOKEN_LIMITS;
68
271
  var REASONING_MODEL_PATTERNS = [
69
272
  /^o[134](-mini|-preview|-pro)?$/i,
70
273
  /^gpt-5(\.\d)?(-pro|-codex|-codex-max)?/i,
@@ -97,8 +300,14 @@ function findTokenLimit(modelOrId) {
97
300
  if (modelOrId.thinkingTokenLimit) return modelOrId.thinkingTokenLimit;
98
301
  return findTokenLimit(modelOrId.id);
99
302
  }
100
- const lowerModelId = modelOrId.toLowerCase();
101
- for (const [pattern, limit] of Object.entries(THINKING_TOKEN_MAP)) {
303
+ const canonicalLimit = lookupCanonicalCapabilities(modelOrId)?.thinkingTokenLimit;
304
+ if (canonicalLimit) return canonicalLimit;
305
+ return findLegacyTokenLimit(modelOrId);
306
+ }
307
+ function findLegacyTokenLimit(modelId) {
308
+ if (!modelId) return null;
309
+ const lowerModelId = modelId.toLowerCase();
310
+ for (const [pattern, limit] of Object.entries(LEGACY_THINKING_TOKEN_LIMITS)) {
102
311
  const regex = new RegExp(pattern, "i");
103
312
  if (regex.test(lowerModelId)) {
104
313
  return limit;
@@ -191,6 +400,7 @@ export {
191
400
  CANNOT_DISABLE_THINKING_PATTERNS,
192
401
  DEFAULT_MAX_TOKENS,
193
402
  EFFORT_RATIO,
403
+ LEGACY_THINKING_TOKEN_LIMITS,
194
404
  REASONING_MODEL_PATTERNS,
195
405
  THINKING_TOKEN_MAP,
196
406
  buildAnthropicThinking,
@@ -198,6 +408,7 @@ export {
198
408
  buildQwenThinkingConfig,
199
409
  calculateThinkingBudget,
200
410
  canDisableThinking,
411
+ findLegacyTokenLimit,
201
412
  findTokenLimit,
202
413
  getClaudeMaxTokens,
203
414
  getOpenAIReasoningEffort,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnicross/contracts",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Dependency-light, host-agnostic contract types + runtime-value helpers shared by the @omnicross/* packages.",
5
5
  "license": "MIT",
6
6
  "author": "Sayo (https://github.com/Dumoedss)",