klaude-code 2.2.0__py3-none-any.whl → 2.4.0__py3-none-any.whl

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.
Files changed (82) hide show
  1. klaude_code/app/runtime.py +2 -15
  2. klaude_code/cli/list_model.py +30 -13
  3. klaude_code/cli/main.py +26 -10
  4. klaude_code/config/assets/builtin_config.yaml +177 -310
  5. klaude_code/config/config.py +158 -21
  6. klaude_code/config/{select_model.py → model_matcher.py} +41 -16
  7. klaude_code/config/sub_agent_model_helper.py +217 -0
  8. klaude_code/config/thinking.py +2 -2
  9. klaude_code/const.py +1 -1
  10. klaude_code/core/agent_profile.py +43 -5
  11. klaude_code/core/executor.py +129 -47
  12. klaude_code/core/manager/llm_clients_builder.py +17 -11
  13. klaude_code/core/prompts/prompt-nano-banana.md +1 -1
  14. klaude_code/core/tool/file/diff_builder.py +25 -18
  15. klaude_code/core/tool/sub_agent_tool.py +2 -1
  16. klaude_code/llm/anthropic/client.py +12 -9
  17. klaude_code/llm/anthropic/input.py +54 -29
  18. klaude_code/llm/client.py +1 -1
  19. klaude_code/llm/codex/client.py +2 -2
  20. klaude_code/llm/google/client.py +7 -7
  21. klaude_code/llm/google/input.py +23 -2
  22. klaude_code/llm/input_common.py +2 -2
  23. klaude_code/llm/openai_compatible/client.py +3 -3
  24. klaude_code/llm/openai_compatible/input.py +22 -13
  25. klaude_code/llm/openai_compatible/stream.py +1 -1
  26. klaude_code/llm/openrouter/client.py +4 -4
  27. klaude_code/llm/openrouter/input.py +35 -25
  28. klaude_code/llm/responses/client.py +5 -5
  29. klaude_code/llm/responses/input.py +96 -57
  30. klaude_code/protocol/commands.py +1 -2
  31. klaude_code/protocol/events/__init__.py +7 -1
  32. klaude_code/protocol/events/chat.py +10 -0
  33. klaude_code/protocol/events/system.py +4 -0
  34. klaude_code/protocol/llm_param.py +1 -1
  35. klaude_code/protocol/model.py +0 -26
  36. klaude_code/protocol/op.py +17 -5
  37. klaude_code/protocol/op_handler.py +5 -0
  38. klaude_code/protocol/sub_agent/AGENTS.md +28 -0
  39. klaude_code/protocol/sub_agent/__init__.py +10 -14
  40. klaude_code/protocol/sub_agent/image_gen.py +2 -1
  41. klaude_code/session/codec.py +2 -6
  42. klaude_code/session/session.py +13 -3
  43. klaude_code/skill/assets/create-plan/SKILL.md +3 -5
  44. klaude_code/tui/command/__init__.py +3 -6
  45. klaude_code/tui/command/clear_cmd.py +0 -1
  46. klaude_code/tui/command/command_abc.py +6 -4
  47. klaude_code/tui/command/copy_cmd.py +10 -10
  48. klaude_code/tui/command/debug_cmd.py +11 -10
  49. klaude_code/tui/command/export_online_cmd.py +18 -23
  50. klaude_code/tui/command/fork_session_cmd.py +39 -43
  51. klaude_code/tui/command/model_cmd.py +10 -49
  52. klaude_code/tui/command/model_picker.py +142 -0
  53. klaude_code/tui/command/refresh_cmd.py +0 -1
  54. klaude_code/tui/command/registry.py +15 -21
  55. klaude_code/tui/command/resume_cmd.py +10 -16
  56. klaude_code/tui/command/status_cmd.py +8 -12
  57. klaude_code/tui/command/sub_agent_model_cmd.py +185 -0
  58. klaude_code/tui/command/terminal_setup_cmd.py +8 -11
  59. klaude_code/tui/command/thinking_cmd.py +4 -6
  60. klaude_code/tui/commands.py +5 -0
  61. klaude_code/tui/components/bash_syntax.py +1 -1
  62. klaude_code/tui/components/command_output.py +96 -0
  63. klaude_code/tui/components/common.py +1 -1
  64. klaude_code/tui/components/developer.py +3 -115
  65. klaude_code/tui/components/metadata.py +1 -63
  66. klaude_code/tui/components/rich/cjk_wrap.py +3 -2
  67. klaude_code/tui/components/rich/status.py +49 -3
  68. klaude_code/tui/components/rich/theme.py +2 -0
  69. klaude_code/tui/components/sub_agent.py +25 -46
  70. klaude_code/tui/components/welcome.py +99 -0
  71. klaude_code/tui/input/prompt_toolkit.py +19 -8
  72. klaude_code/tui/machine.py +5 -0
  73. klaude_code/tui/renderer.py +7 -8
  74. klaude_code/tui/runner.py +0 -6
  75. klaude_code/tui/terminal/selector.py +8 -6
  76. {klaude_code-2.2.0.dist-info → klaude_code-2.4.0.dist-info}/METADATA +21 -74
  77. {klaude_code-2.2.0.dist-info → klaude_code-2.4.0.dist-info}/RECORD +79 -76
  78. klaude_code/tui/command/help_cmd.py +0 -51
  79. klaude_code/tui/command/model_select.py +0 -84
  80. klaude_code/tui/command/release_notes_cmd.py +0 -85
  81. {klaude_code-2.2.0.dist-info → klaude_code-2.4.0.dist-info}/WHEEL +0 -0
  82. {klaude_code-2.2.0.dist-info → klaude_code-2.4.0.dist-info}/entry_points.txt +0 -0
@@ -1,369 +1,236 @@
1
+ ---
1
2
  # Built-in provider and model configurations
2
3
  # Users can start using klaude by simply setting environment variables
3
4
  # (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.) without manual configuration.
4
-
5
5
  provider_list:
6
6
  - provider_name: anthropic
7
7
  protocol: anthropic
8
8
  api_key: ${ANTHROPIC_API_KEY}
9
9
  model_list:
10
- - model_name: sonnet@ant
11
- model_params:
12
- model: claude-sonnet-4-5-20250929
13
- context_limit: 200000
14
- provider_routing:
15
- sort: throughput
16
- cost:
17
- input: 3.0
18
- output: 15.0
19
- cache_read: 0.3
20
- cache_write: 3.75
21
- - model_name: opus@ant
22
- model_params:
23
- model: claude-opus-4-5-20251101
24
- context_limit: 200000
25
- verbosity: high
26
- thinking:
27
- type: enabled
28
- budget_tokens: 2048
29
- cost:
30
- input: 5.0
31
- output: 25.0
32
- cache_read: 0.5
33
- cache_write: 6.25
34
-
10
+ - model_name: sonnet
11
+ model_id: claude-sonnet-4-5-20250929
12
+ context_limit: 200000
13
+ provider_routing:
14
+ sort: throughput
15
+ cost: {input: 3, output: 15, cache_read: 0.3, cache_write: 3.75}
16
+ - model_name: opus
17
+ model_id: claude-opus-4-5-20251101
18
+ context_limit: 200000
19
+ verbosity: high
20
+ thinking:
21
+ type: enabled
22
+ budget_tokens: 2048
23
+ cost: {input: 5, output: 25, cache_read: 0.5, cache_write: 6.25}
35
24
  - provider_name: openai
36
25
  protocol: responses
37
26
  api_key: ${OPENAI_API_KEY}
38
27
  model_list:
39
28
  - model_name: gpt-5.2
40
- model_params:
41
- model: gpt-5.2
42
- max_tokens: 128000
43
- context_limit: 400000
44
- verbosity: high
45
- thinking:
46
- reasoning_effort: high
47
- cost:
48
- input: 1.75
49
- output: 14.0
50
- cache_read: 0.17
51
-
29
+ model_id: gpt-5.2
30
+ max_tokens: 128000
31
+ context_limit: 400000
32
+ verbosity: high
33
+ thinking:
34
+ reasoning_effort: high
35
+ cost: {input: 1.75, output: 14, cache_read: 0.17}
52
36
  - provider_name: openrouter
53
37
  protocol: openrouter
54
38
  api_key: ${OPENROUTER_API_KEY}
55
39
  model_list:
56
- - model_name: gpt-5-mini
57
- model_params:
58
- model: openai/gpt-5-mini
59
- max_tokens: 128000
60
- context_limit: 400000
61
- thinking:
62
- reasoning_effort: high
63
- cost:
64
- input: 0.25
65
- output: 2.0
66
- cache_read: 0.03
67
40
  - model_name: gpt-5.1-codex-max
68
- model_params:
69
- model: openai/gpt-5.1-codex-max
70
- max_tokens: 128000
71
- context_limit: 400000
72
- thinking:
73
- reasoning_effort: medium
74
- cost:
75
- input: 1.25
76
- output: 10.0
77
- cache_read: 0.13
41
+ model_id: openai/gpt-5.1-codex-max
42
+ max_tokens: 128000
43
+ context_limit: 400000
44
+ thinking:
45
+ reasoning_effort: medium
46
+ cost: {input: 1.25, output: 10, cache_read: 0.13}
78
47
  - model_name: gpt-5.2
79
- model_params:
80
- model: openai/gpt-5.2
81
- max_tokens: 128000
82
- context_limit: 400000
83
- verbosity: high
84
- thinking:
85
- reasoning_effort: high
86
- cost:
87
- input: 1.75
88
- output: 14.0
89
- cache_read: 0.17
48
+ model_id: openai/gpt-5.2
49
+ max_tokens: 128000
50
+ context_limit: 400000
51
+ verbosity: high
52
+ thinking:
53
+ reasoning_effort: high
54
+ cost: {input: 1.75, output: 14, cache_read: 0.17}
90
55
  - model_name: gpt-5.2-medium
91
- model_params:
92
- model: openai/gpt-5.2
93
- max_tokens: 128000
94
- context_limit: 400000
95
- verbosity: high
96
- thinking:
97
- reasoning_effort: medium
98
- cost:
99
- input: 1.75
100
- output: 14.0
101
- cache_read: 0.17
56
+ model_id: openai/gpt-5.2
57
+ max_tokens: 128000
58
+ context_limit: 400000
59
+ verbosity: high
60
+ thinking:
61
+ reasoning_effort: medium
62
+ cost: {input: 1.75, output: 14, cache_read: 0.17}
102
63
  - model_name: gpt-5.2-low
103
- model_params:
104
- model: openai/gpt-5.2
105
- max_tokens: 128000
106
- context_limit: 400000
107
- verbosity: low
108
- thinking:
109
- reasoning_effort: low
110
- cost:
111
- input: 1.75
112
- output: 14.0
113
- cache_read: 0.17
64
+ model_id: openai/gpt-5.2
65
+ max_tokens: 128000
66
+ context_limit: 400000
67
+ verbosity: low
68
+ thinking:
69
+ reasoning_effort: low
70
+ cost: {input: 1.75, output: 14, cache_read: 0.17}
114
71
  - model_name: gpt-5.2-fast
115
- model_params:
116
- model: openai/gpt-5.2
117
- max_tokens: 128000
118
- context_limit: 400000
119
- verbosity: low
120
- thinking:
121
- reasoning_effort: none
122
- cost:
123
- input: 1.75
124
- output: 14.0
125
- cache_read: 0.17
72
+ model_id: openai/gpt-5.2
73
+ max_tokens: 128000
74
+ context_limit: 400000
75
+ verbosity: low
76
+ thinking:
77
+ reasoning_effort: none
78
+ cost: {input: 1.75, output: 14, cache_read: 0.17}
126
79
  - model_name: kimi
127
- model_params:
128
- model: moonshotai/kimi-k2-thinking
129
- context_limit: 262144
130
- provider_routing:
131
- only:
132
- - moonshotai/turbo
133
- cost:
134
- input: 0.6
135
- output: 2.5
136
- cache_read: 0.15
80
+ model_id: moonshotai/kimi-k2-thinking
81
+ context_limit: 262144
82
+ provider_routing:
83
+ only:
84
+ - moonshotai/turbo
85
+ cost: {input: 0.6, output: 2.5, cache_read: 0.15}
137
86
  - model_name: haiku
138
- model_params:
139
- model: anthropic/claude-haiku-4.5
140
- context_limit: 200000
141
- cost:
142
- input: 1.0
143
- output: 5.0
144
- cache_read: 0.1
145
- cache_write: 1.25
87
+ model_id: anthropic/claude-haiku-4.5
88
+ context_limit: 200000
89
+ cost: {input: 1, output: 5, cache_read: 0.1, cache_write: 1.25}
146
90
  - model_name: sonnet
147
- model_params:
148
- model: anthropic/claude-4.5-sonnet
149
- context_limit: 200000
150
- provider_routing:
151
- sort: throughput
152
- cost:
153
- input: 3.0
154
- output: 15.0
155
- cache_read: 0.3
156
- cache_write: 3.75
91
+ model_id: anthropic/claude-4.5-sonnet
92
+ context_limit: 200000
93
+ provider_routing:
94
+ sort: throughput
95
+ cost: {input: 3, output: 15, cache_read: 0.3, cache_write: 3.75}
157
96
  - model_name: opus
158
- model_params:
159
- model: anthropic/claude-4.5-opus
160
- context_limit: 200000
161
- verbosity: high
162
- thinking:
163
- type: enabled
164
- budget_tokens: 2048
165
- cost:
166
- input: 5.0
167
- output: 25.0
168
- cache_read: 0.5
169
- cache_write: 6.25
97
+ model_id: anthropic/claude-4.5-opus
98
+ context_limit: 200000
99
+ verbosity: high
100
+ thinking:
101
+ type: enabled
102
+ budget_tokens: 2048
103
+ cost: {input: 5, output: 25, cache_read: 0.5, cache_write: 6.25}
170
104
  - model_name: gemini-pro
171
- model_params:
172
- model: google/gemini-3-pro-preview
173
- context_limit: 1048576
174
- thinking:
175
- reasoning_effort: high
176
- cost:
177
- input: 2.0
178
- output: 12.0
179
- cache_read: 0.2
105
+ model_id: google/gemini-3-pro-preview
106
+ context_limit: 1048576
107
+ thinking:
108
+ reasoning_effort: high
109
+ cost: {input: 2, output: 12, cache_read: 0.2}
180
110
  - model_name: gemini-flash
181
- model_params:
182
- model: google/gemini-3-flash-preview
183
- context_limit: 1048576
184
- thinking:
185
- reasoning_effort: medium
186
- cost:
187
- input: 0.5
188
- output: 3.0
189
- cache_read: 0.05
190
- - model_name: nano-banana-pro@or
191
- model_params:
192
- model: google/gemini-3-pro-image-preview
193
- context_limit: 1048576
194
- modalities:
195
- - image
196
- - text
197
- cost:
198
- input: 2
199
- output: 12
200
- cache_read: 0.2
201
- image: 120
111
+ model_id: google/gemini-3-flash-preview
112
+ context_limit: 1048576
113
+ thinking:
114
+ reasoning_effort: medium
115
+ cost: {input: 0.5, output: 3, cache_read: 0.05}
116
+ - model_name: nano-banana-pro
117
+ model_id: google/gemini-3-pro-image-preview
118
+ context_limit: 66000
119
+ modalities:
120
+ - image
121
+ - text
122
+ cost: {input: 2, output: 12, cache_read: 0.2, image: 120}
123
+ - model_name: nano-banana
124
+ model_id: google/gemini-2.5-flash-image
125
+ context_limit: 33000
126
+ modalities:
127
+ - image
128
+ - text
129
+ cost: {input: 0.3, output: 2.5, cache_read: 0.03, image: 30}
202
130
  - model_name: grok
203
- model_params:
204
- model: x-ai/grok-4.1-fast
205
- context_limit: 2000000
206
- thinking:
207
- type: enabled
208
- budget_tokens: 2048
209
- cost:
210
- input: 0.2
211
- output: 0.5
212
- cache_read: 0.05
131
+ model_id: x-ai/grok-4.1-fast
132
+ context_limit: 2000000
133
+ thinking:
134
+ type: enabled
135
+ budget_tokens: 2048
136
+ cost: {input: 0.2, output: 0.5, cache_read: 0.05}
213
137
  - model_name: minimax
214
- model_params:
215
- model: minimax/minimax-m2.1
216
- context_limit: 204800
217
- cost:
218
- input: 0.3
219
- output: 1.2
220
- cache_read: 0.03
138
+ model_id: minimax/minimax-m2.1
139
+ context_limit: 204800
140
+ cost: {input: 0.3, output: 1.2, cache_read: 0.03}
221
141
  - model_name: glm
222
- model_params:
223
- model: z-ai/glm-4.7
224
- context_limit: 200000
225
- provider_routing:
226
- only:
227
- - z-ai
228
- cost:
229
- input: 0.44
230
- output: 1.74
231
- cache_read: 0.04
232
-
142
+ model_id: z-ai/glm-4.7
143
+ context_limit: 200000
144
+ provider_routing:
145
+ only:
146
+ - z-ai
147
+ cost: {input: 0.44, output: 1.74, cache_read: 0.04}
148
+ - model_name: seedream
149
+ model_id: bytedance-seed/seedream-4.5
150
+ context_limit: 4000
151
+ cost: {input: 0, output: 9.581, image: 9.581}
152
+ modalities:
153
+ - image
154
+ - text
233
155
  - provider_name: google
234
156
  protocol: google
235
157
  api_key: ${GOOGLE_API_KEY}
236
158
  model_list:
237
- - model_name: gemini-pro@google
238
- model_params:
239
- model: gemini-3-pro-preview
240
- context_limit: 1048576
241
- cost:
242
- input: 2.0
243
- output: 12.0
244
- cache_read: 0.2
245
- - model_name: gemini-flash@google
246
- model_params:
247
- model: gemini-3-flash-preview
248
- context_limit: 1048576
249
- cost:
250
- input: 0.5
251
- output: 3.0
252
- cache_read: 0.05
253
- - model_name: nano-banana-pro@google
254
- model_params:
255
- model: gemini-3-pro-image-preview
256
- context_limit: 1048576
257
- modalities:
258
- - image
259
- - text
260
- cost:
261
- input: 2
262
- output: 12
263
- cache_read: 0.2
264
- image: 120
265
-
159
+ - model_name: gemini-pro
160
+ model_id: gemini-3-pro-preview
161
+ context_limit: 1048576
162
+ cost: {input: 2, output: 12, cache_read: 0.2}
163
+ - model_name: gemini-flash
164
+ model_id: gemini-3-flash-preview
165
+ context_limit: 1048576
166
+ cost: {input: 0.5, output: 3, cache_read: 0.05}
167
+ - model_name: nano-banana-pro
168
+ model_id: gemini-3-pro-image-preview
169
+ context_limit: 66000
170
+ modalities:
171
+ - image
172
+ - text
173
+ cost: {input: 2, output: 12, cache_read: 0.2, image: 120}
266
174
  - provider_name: bedrock
267
175
  protocol: bedrock
268
176
  aws_access_key: ${AWS_ACCESS_KEY_ID}
269
177
  aws_secret_key: ${AWS_SECRET_ACCESS_KEY}
270
178
  aws_region: ${AWS_REGION}
271
179
  model_list:
272
- - model_name: sonnet@bedrock
273
- model_params:
274
- model: us.anthropic.claude-sonnet-4-5-20250929-v1:0
275
- context_limit: 200000
276
- cost:
277
- input: 3.0
278
- output: 15.0
279
- cache_read: 0.3
280
- cache_write: 3.75
281
-
180
+ - model_name: sonnet
181
+ model_id: us.anthropic.claude-sonnet-4-5-20250929-v1:0
182
+ context_limit: 200000
183
+ cost: {input: 3, output: 15, cache_read: 0.3, cache_write: 3.75}
282
184
  - provider_name: deepseek
283
185
  protocol: anthropic
284
186
  api_key: ${DEEPSEEK_API_KEY}
285
187
  base_url: https://api.deepseek.com/anthropic
286
188
  model_list:
287
189
  - model_name: deepseek
288
- model_params:
289
- model: deepseek-reasoner
290
- context_limit: 128000
291
- thinking:
292
- type: enabled
293
- budget_tokens: 2048
294
- cost:
295
- input: 2
296
- output: 3
297
- cache_read: 0.2
298
- currency: CNY
299
-
190
+ model_id: deepseek-reasoner
191
+ context_limit: 128000
192
+ thinking:
193
+ type: enabled
194
+ budget_tokens: 2048
195
+ cost: {input: 2, output: 3, cache_read: 0.2, currency: CNY}
300
196
  - provider_name: moonshot
301
197
  protocol: anthropic
302
198
  api_key: ${MOONSHOT_API_KEY}
303
199
  base_url: https://api.moonshot.cn/anthropic
304
200
  model_list:
305
- - model_name: kimi@moonshot
306
- model_params:
307
- model: kimi-k2-thinking
308
- context_limit: 262144
309
- thinking:
310
- type: enabled
311
- budget_tokens: 8192
312
- cost:
313
- input: 4.0
314
- output: 16.0
315
- cache_read: 1.0
316
- currency: CNY
317
-
201
+ - model_name: kimi
202
+ model_id: kimi-k2-thinking
203
+ context_limit: 262144
204
+ thinking:
205
+ type: enabled
206
+ budget_tokens: 8192
207
+ cost: {input: 4, output: 16, cache_read: 1, currency: CNY}
318
208
  - provider_name: claude-max
319
209
  protocol: claude_oauth
320
210
  model_list:
321
- - model_name: sonnet@claude-max
322
- model_params:
323
- model: claude-sonnet-4-5-20250929
324
- context_limit: 200000
325
- cost:
326
- input: 3.0
327
- output: 15.0
328
- cache_read: 0.3
329
- cache_write: 3.75
330
- - model_name: opus@claude-max
331
- model_params:
332
- model: claude-opus-4-5-20251101
333
- context_limit: 200000
334
- verbosity: high
335
- thinking:
336
- type: enabled
337
- budget_tokens: 2048
338
- cost:
339
- input: 5.0
340
- output: 25.0
341
- cache_read: 0.5
342
- cache_write: 6.25
343
- - model_name: haiku@claude-max
344
- model_params:
345
- model: claude-haiku-4-5-20251001
346
- context_limit: 200000
347
- cost:
348
- input: 1.0
349
- output: 5.0
350
- cache_read: 0.1
351
- cache_write: 1.25
352
-
211
+ - model_name: sonnet
212
+ model_id: claude-sonnet-4-5-20250929
213
+ context_limit: 200000
214
+ cost: {input: 3, output: 15, cache_read: 0.3, cache_write: 3.75}
215
+ - model_name: opus
216
+ model_id: claude-opus-4-5-20251101
217
+ context_limit: 200000
218
+ verbosity: high
219
+ thinking:
220
+ type: enabled
221
+ budget_tokens: 2048
222
+ cost: {input: 5, output: 25, cache_read: 0.5, cache_write: 6.25}
223
+ - model_name: haiku
224
+ model_id: claude-haiku-4-5-20251001
225
+ context_limit: 200000
226
+ cost: {input: 1, output: 5, cache_read: 0.1, cache_write: 1.25}
353
227
  - provider_name: codex
354
228
  protocol: codex_oauth
355
229
  model_list:
356
230
  - model_name: gpt-5.2-codex
357
- model_params:
358
- model: gpt-5.2-codex
359
- thinking:
360
- reasoning_effort: medium
361
- context_limit: 400000
362
- max_tokens: 128000
363
- cost:
364
- input: 1.75
365
- output: 14.0
366
- cache_read: 0.17
367
-
368
- sub_agent_models:
369
- ImageGen: nano-banana-pro@or
231
+ model_id: gpt-5.2-codex
232
+ thinking:
233
+ reasoning_effort: medium
234
+ context_limit: 400000
235
+ max_tokens: 128000
236
+ cost: {input: 1.75, output: 14, cache_read: 0.17}