codeep 2.16.0 → 2.17.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.
@@ -2,13 +2,14 @@
2
2
  * Token and cost tracking for API usage
3
3
  */
4
4
  import { AsyncLocalStorage } from 'node:async_hooks';
5
- // Context window sizes per model (in tokens).
6
- // Keep this table in lockstep with `providers.ts` — entries for models that
7
- // aren't in the provider catalogue only show up if a user types an id by hand
8
- // and produce phantom estimates against the wrong context size.
5
+ import { formatResourceImpactReport } from './resourceImpact.js';
6
+ // Context window sizes per model (in tokens). Primarily mirrors providers.ts;
7
+ // retired aliases remain only where restored historical sessions still need a
8
+ // meaningful context/cost display.
9
9
  const MODEL_CONTEXT_WINDOWS = {
10
10
  // Z.AI / ZhipuAI
11
- 'glm-5.2': 200_000,
11
+ 'glm-5.2': 1_000_000,
12
+ 'glm-5.1': 200_000,
12
13
  'glm-5-turbo': 202_752,
13
14
  // OpenAI
14
15
  'gpt-5.6-sol': 1_050_000,
@@ -28,31 +29,34 @@ const MODEL_CONTEXT_WINDOWS = {
28
29
  'deepseek-v4-flash': 1_000_000,
29
30
  // Google
30
31
  'gemini-3.1-pro-preview': 1_048_576,
31
- 'gemini-3.5-flash': 1_000_000,
32
- 'gemini-3.1-flash-lite': 1_048_576,
32
+ 'gemini-3.6-flash': 1_048_576,
33
+ 'gemini-3.5-flash': 1_048_576,
34
+ 'gemini-3.5-flash-lite': 1_048_576,
33
35
  'gemini-3-flash-preview': 1_000_000,
34
36
  // MiniMax
35
- 'MiniMax-M3': 524_288,
36
- // Kimi (Moonshot) — 1M on the K3 line, 256K across K2.x
37
- 'kimi-k3-code': 1_000_000,
38
- 'kimi-k3-code-highspeed': 1_000_000,
39
- 'kimi-k3-thinking': 1_000_000,
37
+ 'MiniMax-M3': 1_000_000,
38
+ // Kimi (Moonshot) — 1M on K3, 256K across K2.x
39
+ 'kimi-k3': 1_000_000,
40
40
  'kimi-k2.7-code': 262_144,
41
41
  'kimi-k2.7-code-highspeed': 262_144,
42
42
  'kimi-k2.6': 262_144,
43
- 'kimi-k2.5': 262_144,
44
43
  'kimi-for-coding': 262_144,
44
+ 'kimi-for-coding-highspeed': 262_144,
45
+ 'k3': 1_000_000,
46
+ 'k3-256k': 262_144,
45
47
  // Grok (xAI)
46
48
  'grok-4.5': 500_000,
47
49
  'grok-build-0.1': 256_000,
48
50
  'grok-4.3': 1_000_000,
49
51
  'grok-code-fast-1': 256_000,
50
52
  'grok-4-fast-reasoning': 2_000_000,
51
- // Qwen (Alibaba) — 256K native (1M with extrapolation)
52
- 'qwen3-coder-plus': 262_144,
53
- 'qwen3-coder-next': 262_144,
54
- 'qwen3-coder-flash': 262_144,
53
+ // Qwen (Alibaba) — current hosted generation
55
54
  'qwen3.7-max': 1_000_000,
55
+ 'qwen3.8-max-preview': 1_000_000,
56
+ 'qwen3.7-plus': 1_000_000,
57
+ 'qwen3.6-plus': 1_000_000,
58
+ 'qwen3.5-plus': 1_000_000,
59
+ 'qwen3.6-flash': 1_000_000,
56
60
  'Qwen/Qwen3-Coder-480B-A35B-Instruct': 262_144,
57
61
  };
58
62
  const DEFAULT_CONTEXT_WINDOW = 128_000;
@@ -63,20 +67,18 @@ export function getModelContextWindow(model) {
63
67
  return MODEL_CONTEXT_WINDOWS[model] ?? DEFAULT_CONTEXT_WINDOW;
64
68
  }
65
69
  // Pricing table — USD per 1M tokens. Same rule as MODEL_CONTEXT_WINDOWS:
66
- // only list model ids that exist in `providers.ts`, otherwise typing an id
67
- // by hand can produce phantom cost estimates against stale rates.
70
+ // Primarily mirrors `providers.ts`. A few retired aliases remain so restored
71
+ // historical sessions still show the rate that applied when they were created.
68
72
  const MODEL_PRICING = {
69
73
  // Z.AI / ZhipuAI
70
- // GLM-5.2 per-token pricing isn't published yet — mirror GLM-5.1 (same tier,
71
- // its successor) provisionally so /cost stays sane; update when z.ai posts it.
72
- // Note: on the GLM Coding Plan (the default `z.ai` provider) billing is a flat
73
- // subscription, so this only affects the pay-per-use estimate.
74
- 'glm-5.2': { inputPer1M: 1.00, outputPer1M: 3.20 },
74
+ // Coding Plan is flat-fee; these official rates apply to pay-per-use.
75
+ 'glm-5.2': { inputPer1M: 1.40, outputPer1M: 4.40 },
76
+ 'glm-5.1': { inputPer1M: 1.40, outputPer1M: 4.40 },
75
77
  'glm-5-turbo': { inputPer1M: 1.20, outputPer1M: 4.00 },
76
78
  // OpenAI
77
79
  'gpt-5.6-sol': { inputPer1M: 5.00, outputPer1M: 30.00 },
78
- 'gpt-5.6-terra': { inputPer1M: 2.50, outputPer1M: 15.00 },
79
- 'gpt-5.6-luna': { inputPer1M: 1.00, outputPer1M: 6.00 },
80
+ 'gpt-5.6-terra': { inputPer1M: 2.00, outputPer1M: 12.00 },
81
+ 'gpt-5.6-luna': { inputPer1M: 0.20, outputPer1M: 1.20 },
80
82
  'gpt-5.5': { inputPer1M: 5.00, outputPer1M: 30.00 },
81
83
  'gpt-5.4': { inputPer1M: 2.50, outputPer1M: 15.00 },
82
84
  'gpt-5.4-mini': { inputPer1M: 0.75, outputPer1M: 4.50 },
@@ -87,37 +89,43 @@ const MODEL_PRICING = {
87
89
  'claude-sonnet-5': { inputPer1M: 3.00, outputPer1M: 15.00 },
88
90
  'claude-haiku-4-5-20251001': { inputPer1M: 1.00, outputPer1M: 5.00 },
89
91
  // DeepSeek (cache-miss input pricing)
90
- 'deepseek-v4-pro': { inputPer1M: 1.74, outputPer1M: 3.48 },
92
+ 'deepseek-v4-pro': { inputPer1M: 0.435, outputPer1M: 0.87 },
91
93
  'deepseek-v4-flash': { inputPer1M: 0.14, outputPer1M: 0.28 },
92
94
  // Google
93
95
  'gemini-3.1-pro-preview': { inputPer1M: 2.00, outputPer1M: 12.00 },
96
+ 'gemini-3.6-flash': { inputPer1M: 1.50, outputPer1M: 7.50 },
94
97
  'gemini-3.5-flash': { inputPer1M: 1.50, outputPer1M: 9.00 },
95
- 'gemini-3.1-flash-lite': { inputPer1M: 0.25, outputPer1M: 1.50 },
98
+ 'gemini-3.5-flash-lite': { inputPer1M: 0.30, outputPer1M: 2.50 },
96
99
  'gemini-3-flash-preview': { inputPer1M: 0.50, outputPer1M: 3.00 },
97
100
  // MiniMax
98
101
  'MiniMax-M3': { inputPer1M: 0.60, outputPer1M: 2.40 },
99
102
  // Kimi (Moonshot) — pay-per-use cache-miss rates; `kimi-for-coding` is the
100
103
  // subscription alias (flat-fee in reality, priced notionally like K2.7 Code).
101
- 'kimi-k3-code': { inputPer1M: 0.60, outputPer1M: 2.50 },
102
- 'kimi-k3-code-highspeed': { inputPer1M: 0.60, outputPer1M: 2.50 },
103
- 'kimi-k3-thinking': { inputPer1M: 0.60, outputPer1M: 2.50 },
104
- 'kimi-k2.7-code': { inputPer1M: 0.60, outputPer1M: 2.50 },
105
- 'kimi-k2.7-code-highspeed': { inputPer1M: 0.60, outputPer1M: 2.50 },
106
- 'kimi-k2.6': { inputPer1M: 0.55, outputPer1M: 2.20 },
107
- 'kimi-k2.5': { inputPer1M: 0.40, outputPer1M: 1.90 },
108
- 'kimi-for-coding': { inputPer1M: 0.60, outputPer1M: 2.50 },
104
+ 'kimi-k3': { inputPer1M: 3.00, outputPer1M: 15.00 },
105
+ 'kimi-k2.7-code': { inputPer1M: 0.95, outputPer1M: 4.00 },
106
+ // Kimi doesn't publish a distinct high-speed price in its main table.
107
+ // Leave that variant unpriced rather than presenting an invented estimate.
108
+ 'kimi-k2.6': { inputPer1M: 0.95, outputPer1M: 4.00 },
109
+ 'kimi-for-coding': { inputPer1M: 0.95, outputPer1M: 4.00 },
110
+ 'kimi-for-coding-highspeed': { inputPer1M: 0.95, outputPer1M: 4.00 },
111
+ 'k3': { inputPer1M: 3.00, outputPer1M: 15.00 },
112
+ 'k3-256k': { inputPer1M: 3.00, outputPer1M: 15.00 },
109
113
  // Grok (xAI)
110
114
  'grok-4.5': { inputPer1M: 2.00, outputPer1M: 6.00 },
111
115
  'grok-build-0.1': { inputPer1M: 1.00, outputPer1M: 2.00 },
112
116
  'grok-4.3': { inputPer1M: 1.25, outputPer1M: 2.50 },
113
117
  'grok-code-fast-1': { inputPer1M: 0.20, outputPer1M: 1.50 },
114
118
  'grok-4-fast-reasoning': { inputPer1M: 0.20, outputPer1M: 0.50 },
115
- // Qwen (Alibaba) — qwen3-coder-* 0–256K tier; the Coding Plan is flat-fee so
116
- // this only affects the pay-per-use estimate.
117
- 'qwen3-coder-plus': { inputPer1M: 0.28, outputPer1M: 1.65 },
118
- 'qwen3-coder-next': { inputPer1M: 0.28, outputPer1M: 1.65 },
119
- 'qwen3-coder-flash': { inputPer1M: 0.10, outputPer1M: 0.50 },
119
+ // Qwen (Alibaba) — list prices for the first context tier. Coding Plan
120
+ // variants are flat-fee; these rates describe pay-per-use calls.
121
+ // `qwen3.8-max-preview` is Token-Plan-only (credit-metered, promotional
122
+ // preview rate); Alibaba publishes no pay-per-use per-token price for it.
123
+ // Leave it unpriced rather than borrowing the GA qwen3.8-max rate.
120
124
  'qwen3.7-max': { inputPer1M: 2.50, outputPer1M: 7.50 },
125
+ 'qwen3.7-plus': { inputPer1M: 0.40, outputPer1M: 1.60 },
126
+ 'qwen3.6-plus': { inputPer1M: 0.40, outputPer1M: 2.40 },
127
+ 'qwen3.5-plus': { inputPer1M: 0.40, outputPer1M: 2.40 },
128
+ 'qwen3.6-flash': { inputPer1M: 0.25, outputPer1M: 1.50 },
121
129
  // ModelScope free tier — no per-token charge.
122
130
  'Qwen/Qwen3-Coder-480B-A35B-Instruct': { inputPer1M: 0, outputPer1M: 0 },
123
131
  };
@@ -368,6 +376,7 @@ export function formatCostReport() {
368
376
  lines.push(`**Estimated savings vs no caching:** $${cache.estimatedSavingsUsd.toFixed(4)}`);
369
377
  }
370
378
  }
379
+ lines.push('', ...formatResourceImpactReport(stats.totalTokens));
371
380
  // Models with no pricing entry don't contribute to cost — flag so users
372
381
  // aren't surprised the total looks low.
373
382
  const untracked = breakdown.filter(b => b.estimatedCost === 0 && (b.promptTokens + b.completionTokens) > 0);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "2.16.0";
1
+ export declare const VERSION = "2.17.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.16.0';
4
+ export const VERSION = '2.17.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "2.16.0",
3
+ "version": "2.17.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",
@@ -15,6 +15,7 @@
15
15
  "test": "vitest run",
16
16
  "test:watch": "vitest",
17
17
  "test:coverage": "vitest run --coverage",
18
+ "version": "node scripts/gen-version.js && git add src/version.ts",
18
19
  "release": "node scripts/release.js"
19
20
  },
20
21
  "repository": {