@omnicross/contracts 0.1.7 → 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.
- package/dist/canonical-models.cjs +4 -3
- package/dist/canonical-models.d.cts +2 -3
- package/dist/canonical-models.d.ts +2 -3
- package/dist/canonical-models.js +4 -3
- package/dist/index.cjs +77 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +75 -6
- package/dist/provider-presets/index.cjs +59 -0
- package/dist/provider-presets/index.js +59 -0
- package/dist/thinking-config.cjs +218 -3
- package/dist/thinking-config.d.cts +32 -10
- package/dist/thinking-config.d.ts +32 -10
- package/dist/thinking-config.js +214 -3
- package/dist/usage-stats-types.d.cts +6 -0
- package/dist/usage-stats-types.d.ts +6 -0
- package/package.json +1 -1
package/dist/thinking-config.cjs
CHANGED
|
@@ -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
|
|
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
|
|
138
|
-
|
|
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
|
|
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
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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.
|
|
41
|
-
*
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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.
|
|
41
|
-
*
|
|
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
|
-
/**
|
|
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 };
|