codeep 2.12.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/providers.d.ts +10 -0
- package/dist/config/providers.js +225 -2
- package/dist/utils/agentChat.js +5 -2
- package/dist/utils/tokenTracker.js +37 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -26,6 +26,10 @@ export interface ProviderConfig {
|
|
|
26
26
|
maxOutputTokens?: number;
|
|
27
27
|
useMaxCompletionTokens?: boolean;
|
|
28
28
|
requiresDefaultTemperature?: boolean;
|
|
29
|
+
/** Provider's OpenAI-compatible endpoint rejects `tools` together with
|
|
30
|
+
* `stream: true` (Alibaba/Qwen DashScope). When true, agent turns that send
|
|
31
|
+
* tools are issued non-streamed (we buffer the full response). */
|
|
32
|
+
noStreamWithTools?: boolean;
|
|
29
33
|
envKey?: string;
|
|
30
34
|
subscribeUrl?: string;
|
|
31
35
|
noApiKey?: boolean;
|
|
@@ -68,6 +72,12 @@ export declare function usesMaxCompletionTokens(providerId: string): boolean;
|
|
|
68
72
|
* (e.g. OpenAI GPT-5+ only accepts the default of 1).
|
|
69
73
|
*/
|
|
70
74
|
export declare function requiresDefaultTemperature(providerId: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if the provider's OpenAI-compatible endpoint rejects `tools`
|
|
77
|
+
* together with `stream: true` (Alibaba/Qwen) — callers must issue tool-bearing
|
|
78
|
+
* agent turns non-streamed.
|
|
79
|
+
*/
|
|
80
|
+
export declare function providerNoStreamWithTools(providerId: string): boolean;
|
|
71
81
|
export declare function modelRejectsSamplingParams(model: string): boolean;
|
|
72
82
|
/**
|
|
73
83
|
* Returns the effective max output tokens for a provider, capped by the provider's limit.
|
package/dist/config/providers.js
CHANGED
|
@@ -203,6 +203,196 @@ export const PROVIDERS = {
|
|
|
203
203
|
groupLabel: 'DeepSeek',
|
|
204
204
|
hint: 'Pay-per-use via DeepSeek API key (platform.deepseek.com).',
|
|
205
205
|
},
|
|
206
|
+
// ── Kimi (Moonshot AI) ────────────────────────────────────────────
|
|
207
|
+
// Subscription (Kimi Code) mirrors the Z.AI GLM-Coding-Plan shape: a
|
|
208
|
+
// dedicated coding base URL + a separate key, model id ALWAYS
|
|
209
|
+
// `kimi-for-coding` (a backend alias). OpenAI-compatible is the
|
|
210
|
+
// battle-tested path so we don't expose the Anthropic surface here.
|
|
211
|
+
'kimi': {
|
|
212
|
+
name: 'Kimi (Moonshot) — Coding Plan',
|
|
213
|
+
description: 'Kimi Code subscription',
|
|
214
|
+
protocols: {
|
|
215
|
+
openai: { baseUrl: 'https://api.kimi.com/coding/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
216
|
+
},
|
|
217
|
+
models: [
|
|
218
|
+
{ id: 'kimi-for-coding', name: 'Kimi Code', description: 'Subscription alias — auto-maps to the latest Kimi coding model (K2.7 Code)' },
|
|
219
|
+
],
|
|
220
|
+
defaultModel: 'kimi-for-coding',
|
|
221
|
+
defaultProtocol: 'openai',
|
|
222
|
+
maxOutputTokens: 32_768,
|
|
223
|
+
envKey: 'KIMI_CODE_API_KEY',
|
|
224
|
+
subscribeUrl: 'https://www.kimi.com/code',
|
|
225
|
+
groupLabel: 'Kimi — Subscription (Kimi Code)',
|
|
226
|
+
hint: 'Uses your Kimi Code subscription — no per-token charges. Key from kimi.com/code/console.',
|
|
227
|
+
},
|
|
228
|
+
'kimi-api': {
|
|
229
|
+
name: 'Kimi (Moonshot) API (pay-per-use)',
|
|
230
|
+
description: 'Moonshot AI Kimi models via API key',
|
|
231
|
+
protocols: {
|
|
232
|
+
openai: { baseUrl: 'https://api.moonshot.ai/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
233
|
+
},
|
|
234
|
+
models: [
|
|
235
|
+
{ id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', description: 'Flagship agentic coding model (256K context)' },
|
|
236
|
+
{ id: 'kimi-k2.7-code-highspeed', name: 'Kimi K2.7 Code (High-Speed)', description: 'Throughput-tuned K2.7 Code for latency-sensitive loops' },
|
|
237
|
+
{ id: 'kimi-k2.6', name: 'Kimi K2.6', description: 'Previous-gen multimodal reasoning model' },
|
|
238
|
+
{ id: 'kimi-k2.5', name: 'Kimi K2.5', description: 'Older general-purpose model (cheaper)' },
|
|
239
|
+
],
|
|
240
|
+
defaultModel: 'kimi-k2.7-code',
|
|
241
|
+
defaultProtocol: 'openai',
|
|
242
|
+
maxOutputTokens: 32_768,
|
|
243
|
+
envKey: 'MOONSHOT_API_KEY',
|
|
244
|
+
subscribeUrl: 'https://platform.kimi.ai/console/api-keys',
|
|
245
|
+
groupLabel: 'Kimi — API (pay-per-use)',
|
|
246
|
+
hint: 'Pay-per-use via Moonshot API key (platform.kimi.ai).',
|
|
247
|
+
},
|
|
248
|
+
'kimi-cn': {
|
|
249
|
+
name: 'Kimi China (Moonshot)',
|
|
250
|
+
description: 'Moonshot AI Kimi models (China)',
|
|
251
|
+
protocols: {
|
|
252
|
+
openai: { baseUrl: 'https://api.moonshot.cn/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
253
|
+
},
|
|
254
|
+
models: [
|
|
255
|
+
{ id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', description: 'Flagship agentic coding model (256K context)' },
|
|
256
|
+
{ id: 'kimi-k2.7-code-highspeed', name: 'Kimi K2.7 Code (High-Speed)', description: 'Throughput-tuned K2.7 Code' },
|
|
257
|
+
{ id: 'kimi-k2.6', name: 'Kimi K2.6', description: 'Previous-gen multimodal reasoning model' },
|
|
258
|
+
{ id: 'kimi-k2.5', name: 'Kimi K2.5', description: 'Older general-purpose model' },
|
|
259
|
+
],
|
|
260
|
+
defaultModel: 'kimi-k2.7-code',
|
|
261
|
+
defaultProtocol: 'openai',
|
|
262
|
+
maxOutputTokens: 32_768,
|
|
263
|
+
envKey: 'MOONSHOT_CN_API_KEY',
|
|
264
|
+
subscribeUrl: 'https://platform.moonshot.cn/console/api-keys',
|
|
265
|
+
groupLabel: 'Kimi China — API (pay-per-use)',
|
|
266
|
+
hint: 'Pay-per-use via Moonshot China API key (platform.moonshot.cn).',
|
|
267
|
+
},
|
|
268
|
+
// ── Grok (xAI) ────────────────────────────────────────────────────
|
|
269
|
+
// Pay-per-use today (console.x.ai key). The SuperGrok / X Premium+
|
|
270
|
+
// subscription is OAuth-based — added separately. Reasoning models
|
|
271
|
+
// require max_completion_tokens (like GPT-5), so useMaxCompletionTokens.
|
|
272
|
+
'grok': {
|
|
273
|
+
name: 'Grok (xAI)',
|
|
274
|
+
description: 'xAI Grok models',
|
|
275
|
+
protocols: {
|
|
276
|
+
openai: { baseUrl: 'https://api.x.ai/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
277
|
+
},
|
|
278
|
+
models: [
|
|
279
|
+
{ id: 'grok-build-0.1', name: 'Grok Build 0.1', description: 'Agentic coding model — fast, 256K context' },
|
|
280
|
+
{ id: 'grok-4.3', name: 'Grok 4.3', description: 'Flagship — highest quality, 1M context' },
|
|
281
|
+
{ id: 'grok-code-fast-1', name: 'Grok Code Fast 1', description: 'Low-cost speed-first coder (alias of Build 0.1)' },
|
|
282
|
+
{ id: 'grok-4-fast-reasoning', name: 'Grok 4 Fast (reasoning)', description: 'Cheap reasoning model, very large context' },
|
|
283
|
+
],
|
|
284
|
+
defaultModel: 'grok-build-0.1',
|
|
285
|
+
defaultProtocol: 'openai',
|
|
286
|
+
useMaxCompletionTokens: true, // reasoning models reject max_tokens
|
|
287
|
+
envKey: 'XAI_API_KEY',
|
|
288
|
+
subscribeUrl: 'https://console.x.ai',
|
|
289
|
+
groupLabel: 'xAI Grok',
|
|
290
|
+
hint: 'Pay-per-use via xAI API key (console.x.ai).',
|
|
291
|
+
},
|
|
292
|
+
// ── Qwen (Alibaba Model Studio / DashScope) ───────────────────────
|
|
293
|
+
// Coding Plan subscription = dedicated base URL + sk-sp- key (mirrors
|
|
294
|
+
// Z.AI). Qwen's OpenAI-compatible surface CANNOT combine tools with
|
|
295
|
+
// streaming, so all Qwen entries set noStreamWithTools.
|
|
296
|
+
'qwen': {
|
|
297
|
+
name: 'Qwen (Alibaba) — Coding Plan',
|
|
298
|
+
description: 'Qwen Coding Plan subscription',
|
|
299
|
+
protocols: {
|
|
300
|
+
openai: { baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
301
|
+
},
|
|
302
|
+
models: [
|
|
303
|
+
{ id: 'qwen3-coder-plus', name: 'Qwen3-Coder Plus', description: 'Flagship coding model — best quality' },
|
|
304
|
+
{ id: 'qwen3-coder-next', name: 'Qwen3-Coder Next', description: 'Balanced quality/speed/cost' },
|
|
305
|
+
{ id: 'qwen3-max', name: 'Qwen3-Max', description: 'Flagship general model (code + reasoning)' },
|
|
306
|
+
],
|
|
307
|
+
defaultModel: 'qwen3-coder-plus',
|
|
308
|
+
defaultProtocol: 'openai',
|
|
309
|
+
maxOutputTokens: 65_536,
|
|
310
|
+
noStreamWithTools: true,
|
|
311
|
+
envKey: 'BAILIAN_CODING_PLAN_API_KEY',
|
|
312
|
+
subscribeUrl: 'https://www.alibabacloud.com/help/en/model-studio/qwen-code-coding-plan',
|
|
313
|
+
groupLabel: 'Qwen — Subscription (Coding Plan)',
|
|
314
|
+
hint: 'Uses your Qwen Coding Plan — no per-token charges. sk-sp-… key from Model Studio. Interactive coding use only.',
|
|
315
|
+
},
|
|
316
|
+
'qwen-api': {
|
|
317
|
+
name: 'Qwen (Alibaba) API (pay-per-use)',
|
|
318
|
+
description: 'Alibaba Model Studio Qwen models via API key',
|
|
319
|
+
protocols: {
|
|
320
|
+
openai: { baseUrl: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
321
|
+
},
|
|
322
|
+
models: [
|
|
323
|
+
{ id: 'qwen3-coder-plus', name: 'Qwen3-Coder Plus', description: 'Flagship coding model (256K, up to 1M)' },
|
|
324
|
+
{ id: 'qwen3-coder-next', name: 'Qwen3-Coder Next', description: 'Balanced quality/speed/cost' },
|
|
325
|
+
{ id: 'qwen3-coder-flash', name: 'Qwen3-Coder Flash', description: 'Fast/cheap coder' },
|
|
326
|
+
{ id: 'qwen3-max', name: 'Qwen3-Max', description: 'Flagship general model' },
|
|
327
|
+
],
|
|
328
|
+
defaultModel: 'qwen3-coder-plus',
|
|
329
|
+
defaultProtocol: 'openai',
|
|
330
|
+
maxOutputTokens: 65_536,
|
|
331
|
+
noStreamWithTools: true,
|
|
332
|
+
envKey: 'DASHSCOPE_API_KEY',
|
|
333
|
+
subscribeUrl: 'https://modelstudio.console.alibabacloud.com/',
|
|
334
|
+
groupLabel: 'Qwen — API (pay-per-use)',
|
|
335
|
+
hint: 'Pay-per-use via Alibaba Model Studio key (DASHSCOPE_API_KEY).',
|
|
336
|
+
},
|
|
337
|
+
'qwen-cn': {
|
|
338
|
+
name: 'Qwen China — Coding Plan',
|
|
339
|
+
description: 'Qwen Coding Plan subscription (China)',
|
|
340
|
+
protocols: {
|
|
341
|
+
openai: { baseUrl: 'https://coding.dashscope.aliyuncs.com/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
342
|
+
},
|
|
343
|
+
models: [
|
|
344
|
+
{ id: 'qwen3-coder-plus', name: 'Qwen3-Coder Plus', description: 'Flagship coding model — best quality' },
|
|
345
|
+
{ id: 'qwen3-coder-next', name: 'Qwen3-Coder Next', description: 'Balanced quality/speed/cost' },
|
|
346
|
+
{ id: 'qwen3-max', name: 'Qwen3-Max', description: 'Flagship general model' },
|
|
347
|
+
],
|
|
348
|
+
defaultModel: 'qwen3-coder-plus',
|
|
349
|
+
defaultProtocol: 'openai',
|
|
350
|
+
maxOutputTokens: 65_536,
|
|
351
|
+
noStreamWithTools: true,
|
|
352
|
+
envKey: 'BAILIAN_CODING_PLAN_CN_API_KEY',
|
|
353
|
+
subscribeUrl: 'https://bailian.console.aliyun.com/',
|
|
354
|
+
groupLabel: 'Qwen China — Subscription (Coding Plan)',
|
|
355
|
+
hint: 'Uses your Qwen Coding Plan (China). sk-sp-… key from Bailian.',
|
|
356
|
+
},
|
|
357
|
+
'qwen-cn-api': {
|
|
358
|
+
name: 'Qwen China API (pay-per-use)',
|
|
359
|
+
description: 'Alibaba Model Studio Qwen models via API key (China)',
|
|
360
|
+
protocols: {
|
|
361
|
+
openai: { baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
362
|
+
},
|
|
363
|
+
models: [
|
|
364
|
+
{ id: 'qwen3-coder-plus', name: 'Qwen3-Coder Plus', description: 'Flagship coding model' },
|
|
365
|
+
{ id: 'qwen3-coder-next', name: 'Qwen3-Coder Next', description: 'Balanced quality/speed/cost' },
|
|
366
|
+
{ id: 'qwen3-coder-flash', name: 'Qwen3-Coder Flash', description: 'Fast/cheap coder' },
|
|
367
|
+
{ id: 'qwen3-max', name: 'Qwen3-Max', description: 'Flagship general model' },
|
|
368
|
+
],
|
|
369
|
+
defaultModel: 'qwen3-coder-plus',
|
|
370
|
+
defaultProtocol: 'openai',
|
|
371
|
+
maxOutputTokens: 65_536,
|
|
372
|
+
noStreamWithTools: true,
|
|
373
|
+
envKey: 'DASHSCOPE_CN_API_KEY',
|
|
374
|
+
subscribeUrl: 'https://bailian.console.aliyun.com/',
|
|
375
|
+
groupLabel: 'Qwen China — API (pay-per-use)',
|
|
376
|
+
hint: 'Pay-per-use via Alibaba Model Studio China key.',
|
|
377
|
+
},
|
|
378
|
+
'modelscope': {
|
|
379
|
+
name: 'ModelScope (free Qwen)',
|
|
380
|
+
description: 'Free Qwen3-Coder inference via ModelScope',
|
|
381
|
+
protocols: {
|
|
382
|
+
openai: { baseUrl: 'https://api-inference.modelscope.cn/v1', authHeader: 'Bearer', supportsNativeTools: true },
|
|
383
|
+
},
|
|
384
|
+
models: [
|
|
385
|
+
{ id: 'Qwen/Qwen3-Coder-480B-A35B-Instruct', name: 'Qwen3-Coder 480B', description: 'Open MoE coder — free tier (~2000 req/day)' },
|
|
386
|
+
],
|
|
387
|
+
defaultModel: 'Qwen/Qwen3-Coder-480B-A35B-Instruct',
|
|
388
|
+
defaultProtocol: 'openai',
|
|
389
|
+
maxOutputTokens: 65_536,
|
|
390
|
+
noStreamWithTools: true,
|
|
391
|
+
envKey: 'MODELSCOPE_API_KEY',
|
|
392
|
+
subscribeUrl: 'https://modelscope.cn/my/myaccesstoken',
|
|
393
|
+
groupLabel: 'ModelScope — Free (Qwen)',
|
|
394
|
+
hint: 'Free tier (~2000 req/day) via ModelScope token (modelscope.cn). Needs a bound Aliyun account.',
|
|
395
|
+
},
|
|
206
396
|
'openai': {
|
|
207
397
|
name: 'OpenAI',
|
|
208
398
|
description: 'GPT and o-series models',
|
|
@@ -361,14 +551,24 @@ const DISPLAY_ORDER = [
|
|
|
361
551
|
'openrouter', // 100+ models, one key — surfaced high on purpose for 2.0.0.
|
|
362
552
|
'z.ai',
|
|
363
553
|
'z.ai-api',
|
|
554
|
+
'kimi',
|
|
555
|
+
'kimi-api',
|
|
556
|
+
'qwen',
|
|
557
|
+
'qwen-api',
|
|
558
|
+
'grok',
|
|
364
559
|
'deepseek',
|
|
365
560
|
'google',
|
|
366
561
|
'minimax',
|
|
367
562
|
'minimax-api',
|
|
563
|
+
'modelscope',
|
|
368
564
|
'ollama',
|
|
369
565
|
'custom',
|
|
566
|
+
// Regional + parameter-variant entries trail.
|
|
370
567
|
'z.ai-cn',
|
|
371
568
|
'z.ai-cn-api',
|
|
569
|
+
'kimi-cn',
|
|
570
|
+
'qwen-cn',
|
|
571
|
+
'qwen-cn-api',
|
|
372
572
|
'minimax-cn',
|
|
373
573
|
];
|
|
374
574
|
export function getProviderList() {
|
|
@@ -441,14 +641,26 @@ export function usesMaxCompletionTokens(providerId) {
|
|
|
441
641
|
export function requiresDefaultTemperature(providerId) {
|
|
442
642
|
return PROVIDERS[providerId]?.requiresDefaultTemperature ?? false;
|
|
443
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Returns true if the provider's OpenAI-compatible endpoint rejects `tools`
|
|
646
|
+
* together with `stream: true` (Alibaba/Qwen) — callers must issue tool-bearing
|
|
647
|
+
* agent turns non-streamed.
|
|
648
|
+
*/
|
|
649
|
+
export function providerNoStreamWithTools(providerId) {
|
|
650
|
+
return PROVIDERS[providerId]?.noStreamWithTools ?? false;
|
|
651
|
+
}
|
|
444
652
|
/**
|
|
445
653
|
* Models that reject sampling parameters (temperature/top_p/top_k) with a 400.
|
|
446
654
|
* Anthropic removed them on Fable 5 and Opus 4.7+; older Claude models still
|
|
447
655
|
* accept them, so this must be a MODEL-level check, not a provider-level one
|
|
448
656
|
* (requiresDefaultTemperature can't express it). Omitting the field is always
|
|
449
|
-
* safe — the API treats omission as default.
|
|
657
|
+
* safe — the API treats omission as default. Kimi K2.x code/thinking models
|
|
658
|
+
* fix temperature internally and 400 on any custom value, so they're here too.
|
|
450
659
|
*/
|
|
451
|
-
const SAMPLING_PARAMS_REJECTED = [
|
|
660
|
+
const SAMPLING_PARAMS_REJECTED = [
|
|
661
|
+
'claude-fable-5', 'claude-opus-4-8', 'claude-opus-4-7',
|
|
662
|
+
'kimi-k2.7-code', 'kimi-for-coding',
|
|
663
|
+
];
|
|
452
664
|
export function modelRejectsSamplingParams(model) {
|
|
453
665
|
return SAMPLING_PARAMS_REJECTED.some(id => model === id || model.startsWith(`${id}-`));
|
|
454
666
|
}
|
|
@@ -508,6 +720,12 @@ export function modelSupportsReasoningEffort(providerId, model) {
|
|
|
508
720
|
// GLM-5.2 added graded High/Max effort. glm-5-turbo is a plain thinking
|
|
509
721
|
// toggle (no graded levels) so it stays out.
|
|
510
722
|
return idMatches(id, 'glm-5-2');
|
|
723
|
+
case 'grok':
|
|
724
|
+
// Grok reasoning models accept reasoning_effort (none/low/medium/high).
|
|
725
|
+
// Explicit *-non-reasoning variants don't think → excluded.
|
|
726
|
+
return id.startsWith('grok') && !id.includes('non-reasoning');
|
|
727
|
+
// Kimi (thinking on/off, not graded) and Qwen coders (non-thinking) have
|
|
728
|
+
// no graded knob → fall through to default false.
|
|
511
729
|
case 'openrouter':
|
|
512
730
|
// OpenRouter normalizes a unified `reasoning` field and silently ignores
|
|
513
731
|
// it for non-reasoning models, so the control is always safe to expose.
|
|
@@ -547,6 +765,9 @@ export function reasoningParamsFor(providerId, model, tier) {
|
|
|
547
765
|
case 'z.ai-cn-api':
|
|
548
766
|
// Graded thinking depth: high (default) or max. Lower tiers collapse to high.
|
|
549
767
|
return { reasoning_effort: tier === 'max' ? 'max' : 'high' };
|
|
768
|
+
case 'grok':
|
|
769
|
+
// none/low/medium/high — no "max"; map our Max → high (the ceiling).
|
|
770
|
+
return { reasoning_effort: tier === 'max' ? 'high' : tier };
|
|
550
771
|
case 'openrouter':
|
|
551
772
|
// Unified reasoning object; no "max" effort → cap at high.
|
|
552
773
|
return { reasoning: { effort: tier === 'max' ? 'high' : tier } };
|
|
@@ -580,6 +801,8 @@ export function availableReasoningTiers(providerId, model) {
|
|
|
580
801
|
case 'z.ai-cn':
|
|
581
802
|
case 'z.ai-cn-api':
|
|
582
803
|
return ['auto', 'high', 'max'];
|
|
804
|
+
case 'grok':
|
|
805
|
+
return ['auto', 'low', 'medium', 'high'];
|
|
583
806
|
case 'openrouter':
|
|
584
807
|
return ['auto', 'low', 'medium', 'high'];
|
|
585
808
|
default:
|
package/dist/utils/agentChat.js
CHANGED
|
@@ -18,7 +18,7 @@ import { config, getApiKey, resolveBaseUrl } from '../config/index.js';
|
|
|
18
18
|
import { loadProjectIntelligence, generateContextFromIntelligence } from './projectIntelligence.js';
|
|
19
19
|
import { formatCommandIndex } from './commandIndex.js';
|
|
20
20
|
import { syncProgress, generateProjectId } from './codeepCloud.js';
|
|
21
|
-
import { getProviderAuthHeader, supportsNativeTools, getEffectiveMaxTokens, usesMaxCompletionTokens, requiresDefaultTemperature, modelRejectsSamplingParams, isNoApiKeyProvider, reasoningParamsFor } from '../config/providers.js';
|
|
21
|
+
import { getProviderAuthHeader, supportsNativeTools, getEffectiveMaxTokens, usesMaxCompletionTokens, requiresDefaultTemperature, modelRejectsSamplingParams, isNoApiKeyProvider, reasoningParamsFor, providerNoStreamWithTools } from '../config/providers.js';
|
|
22
22
|
import { recordTokenUsage, extractOpenAIUsage, extractAnthropicUsage } from './tokenTracker.js';
|
|
23
23
|
import { parseOpenAIToolCalls, parseAnthropicToolCalls, parseToolCalls } from './toolParsing.js';
|
|
24
24
|
import { formatToolDefinitions, getOpenAITools, getAnthropicTools } from './tools.js';
|
|
@@ -367,7 +367,10 @@ additionalTools) {
|
|
|
367
367
|
try {
|
|
368
368
|
let endpoint;
|
|
369
369
|
let body;
|
|
370
|
-
|
|
370
|
+
// Qwen/DashScope reject `tools` + `stream:true` together; this path always
|
|
371
|
+
// sends tools, so force a non-streamed request there (the non-streaming
|
|
372
|
+
// branch below still emits the content via onChunk). Other providers stream.
|
|
373
|
+
const useStreaming = Boolean(onChunk) && !providerNoStreamWithTools(providerId);
|
|
371
374
|
// Provider-level guard (OpenAI GPT-5+) OR model-level guard — Anthropic's
|
|
372
375
|
// Fable 5 / Opus 4.7+ reject temperature with a 400; omission is safe.
|
|
373
376
|
const tempParam = (requiresDefaultTemperature(providerId) || modelRejectsSamplingParams(model)) ? {} : { temperature: config.get('temperature') };
|
|
@@ -26,6 +26,23 @@ const MODEL_CONTEXT_WINDOWS = {
|
|
|
26
26
|
'gemini-3-flash-preview': 1_000_000,
|
|
27
27
|
// MiniMax
|
|
28
28
|
'MiniMax-M3': 524_288,
|
|
29
|
+
// Kimi (Moonshot) — 256K across the K2.x line
|
|
30
|
+
'kimi-k2.7-code': 262_144,
|
|
31
|
+
'kimi-k2.7-code-highspeed': 262_144,
|
|
32
|
+
'kimi-k2.6': 262_144,
|
|
33
|
+
'kimi-k2.5': 262_144,
|
|
34
|
+
'kimi-for-coding': 262_144,
|
|
35
|
+
// Grok (xAI)
|
|
36
|
+
'grok-build-0.1': 256_000,
|
|
37
|
+
'grok-4.3': 1_000_000,
|
|
38
|
+
'grok-code-fast-1': 256_000,
|
|
39
|
+
'grok-4-fast-reasoning': 2_000_000,
|
|
40
|
+
// Qwen (Alibaba) — 256K native (1M with extrapolation)
|
|
41
|
+
'qwen3-coder-plus': 262_144,
|
|
42
|
+
'qwen3-coder-next': 262_144,
|
|
43
|
+
'qwen3-coder-flash': 262_144,
|
|
44
|
+
'qwen3-max': 262_144,
|
|
45
|
+
'Qwen/Qwen3-Coder-480B-A35B-Instruct': 262_144,
|
|
29
46
|
};
|
|
30
47
|
const DEFAULT_CONTEXT_WINDOW = 128_000;
|
|
31
48
|
/**
|
|
@@ -62,6 +79,26 @@ const MODEL_PRICING = {
|
|
|
62
79
|
'gemini-3-flash-preview': { inputPer1M: 0.50, outputPer1M: 3.00 },
|
|
63
80
|
// MiniMax
|
|
64
81
|
'MiniMax-M3': { inputPer1M: 0.60, outputPer1M: 2.40 },
|
|
82
|
+
// Kimi (Moonshot) — pay-per-use cache-miss rates; `kimi-for-coding` is the
|
|
83
|
+
// subscription alias (flat-fee in reality, priced notionally like K2.7 Code).
|
|
84
|
+
'kimi-k2.7-code': { inputPer1M: 0.60, outputPer1M: 2.50 },
|
|
85
|
+
'kimi-k2.7-code-highspeed': { inputPer1M: 0.60, outputPer1M: 2.50 },
|
|
86
|
+
'kimi-k2.6': { inputPer1M: 0.55, outputPer1M: 2.20 },
|
|
87
|
+
'kimi-k2.5': { inputPer1M: 0.40, outputPer1M: 1.90 },
|
|
88
|
+
'kimi-for-coding': { inputPer1M: 0.60, outputPer1M: 2.50 },
|
|
89
|
+
// Grok (xAI)
|
|
90
|
+
'grok-build-0.1': { inputPer1M: 1.00, outputPer1M: 2.00 },
|
|
91
|
+
'grok-4.3': { inputPer1M: 1.25, outputPer1M: 2.50 },
|
|
92
|
+
'grok-code-fast-1': { inputPer1M: 0.20, outputPer1M: 1.50 },
|
|
93
|
+
'grok-4-fast-reasoning': { inputPer1M: 0.20, outputPer1M: 0.50 },
|
|
94
|
+
// Qwen (Alibaba) — qwen3-coder-* 0–256K tier; the Coding Plan is flat-fee so
|
|
95
|
+
// this only affects the pay-per-use estimate.
|
|
96
|
+
'qwen3-coder-plus': { inputPer1M: 0.28, outputPer1M: 1.65 },
|
|
97
|
+
'qwen3-coder-next': { inputPer1M: 0.28, outputPer1M: 1.65 },
|
|
98
|
+
'qwen3-coder-flash': { inputPer1M: 0.10, outputPer1M: 0.50 },
|
|
99
|
+
'qwen3-max': { inputPer1M: 1.20, outputPer1M: 6.00 },
|
|
100
|
+
// ModelScope free tier — no per-token charge.
|
|
101
|
+
'Qwen/Qwen3-Coder-480B-A35B-Instruct': { inputPer1M: 0, outputPer1M: 0 },
|
|
65
102
|
};
|
|
66
103
|
export function getPricingTable() {
|
|
67
104
|
return Object.entries(MODEL_PRICING).map(([model, p]) => ({ model, ...p }));
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.13.0";
|
package/dist/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
|
|
2
2
|
// Baked from package.json at build time so the bun-compiled binary reports
|
|
3
3
|
// the right version (it has no package.json on disk to read at runtime).
|
|
4
|
-
export const VERSION = '2.
|
|
4
|
+
export const VERSION = '2.13.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|