@lightharu/krouter 1.8.1 → 1.8.2

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.
@@ -9,7 +9,7 @@
9
9
  http-equiv="Content-Security-Policy"
10
10
  content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
11
11
  />
12
- <script type="module" crossorigin src="/assets/index-CdizCUPa.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-C23DvwqV.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-CM4-0adf.css">
14
14
  </head>
15
15
 
@@ -0,0 +1,213 @@
1
+ # Krouter API Proxy Guide
2
+
3
+ Krouter API Proxy exposes one OpenAI, Claude and Gemini compatible endpoint for AI clients. The backend selects a usable Kiro account, refreshes tokens, checks model capability, logs requests, and rotates accounts according to your strategy.
4
+
5
+ ![API Proxy flow](./images/api-proxy-overview.svg)
6
+
7
+ ## 1. Install And Open The Dashboard
8
+
9
+ Install or update Krouter:
10
+
11
+ ```bash
12
+ npm install -g @lightharu/krouter
13
+ ```
14
+
15
+ Open the CLI:
16
+
17
+ ```bash
18
+ krouter
19
+ ```
20
+
21
+ The CLI starts the backend, opens the local dashboard, and prints the access URL. Defaults:
22
+
23
+ ```text
24
+ Dashboard: http://127.0.0.1:4010
25
+ API Proxy: http://127.0.0.1:5580/v1
26
+ ```
27
+
28
+ On a VPS, prefer a dashboard tunnel instead of exposing raw HTTP:
29
+
30
+ ```bash
31
+ krouter tunnel start
32
+ ```
33
+
34
+ ## 2. Prepare Kiro Accounts
35
+
36
+ Open **Accounts** and import valid Kiro accounts. Then run **refresh/check** so the backend can load quota, subscription, tokens, and profile ARN data.
37
+
38
+ ARN notes:
39
+
40
+ - Enterprise/Power accounts can have a real account-specific ARN.
41
+ - GitHub/Google social accounts usually use the shared social ARN expected by Kiro.
42
+ - Builder ID accounts can use a compatibility placeholder ARN. If a model rejects that account, multi-account mode can fail over to another account.
43
+
44
+ ## 3. Start API Proxy
45
+
46
+ Open **API Proxy Service**.
47
+
48
+ ![API Proxy settings](./images/api-proxy-dashboard.svg)
49
+
50
+ Recommended settings:
51
+
52
+ | Setting | Recommended value |
53
+ | --- | --- |
54
+ | Host | `127.0.0.1` for local-only use |
55
+ | Port | `5580` |
56
+ | Auto Start | On if the service should restart automatically |
57
+ | Multi-Account | On |
58
+ | Strategy | `Smart` |
59
+ | Log Requests | On while testing, optional later |
60
+ | Max Retries | `3` or higher on unstable networks |
61
+ | Disable Tools | Off when agent/dev tasks need tool calls |
62
+
63
+ The **Smart** strategy scores accounts by remaining quota, recent errors, request count, latency, and token freshness. When an account hits quota, rate limit, or suspension errors, Krouter marks it and selects a better account.
64
+
65
+ ## 4. Create A Client API Key
66
+
67
+ In **API Proxy Service**, open **Configure Clients** or **Configure API Keys**, then create an `sk-...` key.
68
+
69
+ ![Create key and connect clients](./images/api-proxy-client-setup.svg)
70
+
71
+ Clients should send:
72
+
73
+ ```text
74
+ Authorization: Bearer sk-...
75
+ ```
76
+
77
+ Never expose the proxy publicly without API keys and access rules.
78
+
79
+ ## 5. Client Endpoints
80
+
81
+ ### OpenAI Compatible
82
+
83
+ ```text
84
+ Base URL: http://127.0.0.1:5580/v1
85
+ Chat: POST /v1/chat/completions
86
+ Models: GET /v1/models
87
+ ```
88
+
89
+ Example:
90
+
91
+ ```bash
92
+ curl http://127.0.0.1:5580/v1/chat/completions \
93
+ -H "Authorization: Bearer sk-..." \
94
+ -H "Content-Type: application/json" \
95
+ -d '{
96
+ "model": "claude-sonnet-4.5",
97
+ "messages": [{"role": "user", "content": "Reply pong"}],
98
+ "stream": false
99
+ }'
100
+ ```
101
+
102
+ ### Claude Compatible
103
+
104
+ ```text
105
+ Base URL: http://127.0.0.1:5580
106
+ Messages: POST /v1/messages
107
+ ```
108
+
109
+ Example:
110
+
111
+ ```bash
112
+ curl http://127.0.0.1:5580/v1/messages \
113
+ -H "Authorization: Bearer sk-..." \
114
+ -H "Content-Type: application/json" \
115
+ -d '{
116
+ "model": "claude-sonnet-4.5",
117
+ "max_tokens": 256,
118
+ "messages": [{"role": "user", "content": "Reply pong"}],
119
+ "stream": false
120
+ }'
121
+ ```
122
+
123
+ ### Gemini Compatible
124
+
125
+ ```text
126
+ Base URL: http://127.0.0.1:5580
127
+ Models: GET /v1beta/models
128
+ Generate: POST /v1beta/models/{model}:generateContent
129
+ ```
130
+
131
+ ## 6. Connect OpenClaw
132
+
133
+ Fast path:
134
+
135
+ ```bash
136
+ krouter openclaw import
137
+ ```
138
+
139
+ Or from the dashboard:
140
+
141
+ ```text
142
+ API Proxy Service -> Configure Clients -> select OpenClaw -> Import
143
+ ```
144
+
145
+ After import, select the `krouter` provider in OpenClaw and run `/models` to list the models exposed by Krouter.
146
+
147
+ ## 7. Connect Other AI Tools
148
+
149
+ Use this generic setup:
150
+
151
+ ```text
152
+ Provider: OpenAI Compatible
153
+ Base URL: http://127.0.0.1:5580/v1
154
+ API Key: sk-...
155
+ Model: claude-sonnet-4.5
156
+ ```
157
+
158
+ This works for OpenClaw, Codex-compatible clients, Continue, Cline, Cursor, OpenCode, or custom clients.
159
+
160
+ ## 8. Verify The Service
161
+
162
+ Backend health:
163
+
164
+ ```bash
165
+ curl http://127.0.0.1:4010/healthz
166
+ ```
167
+
168
+ Proxy health:
169
+
170
+ ```bash
171
+ curl http://127.0.0.1:5580/health
172
+ ```
173
+
174
+ Model list:
175
+
176
+ ```bash
177
+ curl http://127.0.0.1:5580/v1/models \
178
+ -H "Authorization: Bearer sk-..."
179
+ ```
180
+
181
+ If `/v1/models` returns `401`, the API key is missing or incorrect.
182
+
183
+ ## 9. Safe Operations Checklist
184
+
185
+ - Bind `127.0.0.1` for local use.
186
+ - On a VPS, use a dashboard tunnel and keep API proxy auth enabled.
187
+ - Enable Auto Start if the proxy should survive backend restarts.
188
+ - Use `Smart` as the default multi-account strategy.
189
+ - Watch request logs while testing a new model.
190
+ - Do not route model traffic through suspended accounts; let Krouter skip them or remove them from the pool.
191
+
192
+ ## 10. Troubleshooting
193
+
194
+ ### `401 Unauthorized`
195
+
196
+ The API key is missing or invalid. Check:
197
+
198
+ ```text
199
+ Authorization: Bearer sk-...
200
+ ```
201
+
202
+ ### `profileArn is required`
203
+
204
+ The selected account does not have a usable ARN for that endpoint/model. Run **Sync Accounts**, **Refresh Models**, or use **Smart** strategy so Krouter can select a better account.
205
+
206
+ ### `All models are temporarily rate-limited`
207
+
208
+ Many accounts are rate-limited or cooling down. Wait for cooldown, reduce request rate, or inspect request logs.
209
+
210
+ ### `All accounts quota exhausted`
211
+
212
+ All accounts in the selected scope are out of quota or cooling down. Check account quota, group scope, and API key bindings.
213
+
@@ -0,0 +1,9 @@
1
+ # Krouter API Proxy Guide
2
+
3
+ Choose a language:
4
+
5
+ - [Tiếng Việt](./API-Proxy-Guide.vi.md)
6
+ - [English](./API-Proxy-Guide.en.md)
7
+
8
+ ![Krouter API Proxy overview](./images/api-proxy-overview.svg)
9
+
@@ -0,0 +1,213 @@
1
+ # Hướng Dẫn Dịch Vụ API Proxy Của Krouter
2
+
3
+ Krouter API Proxy tạo một endpoint tương thích OpenAI, Claude và Gemini để các công cụ AI gọi vào một nơi duy nhất. Backend sẽ tự chọn tài khoản Kiro phù hợp, làm mới token khi cần, kiểm tra model, ghi log và xoay tài khoản theo cấu hình.
4
+
5
+ ![Luồng API Proxy](./images/api-proxy-overview.svg)
6
+
7
+ ## 1. Cài Đặt Và Mở Dashboard
8
+
9
+ Cài hoặc cập nhật Krouter:
10
+
11
+ ```bash
12
+ npm install -g @lightharu/krouter
13
+ ```
14
+
15
+ Mở CLI:
16
+
17
+ ```bash
18
+ krouter
19
+ ```
20
+
21
+ CLI sẽ khởi động backend, mở dashboard local và hiển thị địa chỉ truy cập. Mặc định:
22
+
23
+ ```text
24
+ Dashboard: http://127.0.0.1:4010
25
+ API Proxy: http://127.0.0.1:5580/v1
26
+ ```
27
+
28
+ Nếu chạy trên VPS, dùng tunnel dashboard thay vì mở HTTP public trực tiếp:
29
+
30
+ ```bash
31
+ krouter tunnel start
32
+ ```
33
+
34
+ ## 2. Chuẩn Bị Tài Khoản Kiro
35
+
36
+ Vào **Tài khoản** và nhập các tài khoản Kiro hợp lệ. Sau đó bấm **Làm mới / kiểm tra** để backend lấy quota, subscription, token và profile ARN.
37
+
38
+ Lưu ý về ARN:
39
+
40
+ - Tài khoản Enterprise/Power có thể có ARN thật riêng.
41
+ - Tài khoản GitHub/Google social thường dùng ARN social cố định.
42
+ - Tài khoản Builder ID có thể dùng placeholder ARN tương thích. Nếu model không nhận tài khoản đó, proxy sẽ chuyển sang tài khoản khác khi bật multi-account.
43
+
44
+ ## 3. Bật API Proxy
45
+
46
+ Vào **API Proxy Service**.
47
+
48
+ ![Màn hình cấu hình API Proxy](./images/api-proxy-dashboard.svg)
49
+
50
+ Thiết lập khuyến nghị:
51
+
52
+ | Mục | Giá trị khuyến nghị |
53
+ | --- | --- |
54
+ | Host | `127.0.0.1` nếu chỉ dùng local |
55
+ | Port | `5580` |
56
+ | Auto Start | Bật nếu muốn service tự chạy lại sau restart |
57
+ | Multi-Account | Bật |
58
+ | Strategy | `Smart` |
59
+ | Log Requests | Bật khi đang test, có thể tắt khi chạy ổn |
60
+ | Max Retries | `3` hoặc cao hơn nếu mạng không ổn |
61
+ | Disable Tools | Tắt nếu dùng agent/dev task cần tool calls |
62
+
63
+ Chiến lược **Smart** sẽ ưu tiên tài khoản còn quota, ít lỗi, ít request, latency tốt và token chưa gần hết hạn. Khi tài khoản lỗi quota/rate-limit/suspended, proxy đánh dấu trạng thái rồi tự chọn tài khoản khác.
64
+
65
+ ## 4. Tạo API Key Cho Client
66
+
67
+ Trong **API Proxy Service**, bấm **Configure Clients** hoặc **Configure API Keys**, tạo key dạng `sk-...`.
68
+
69
+ ![Tạo key và kết nối client](./images/api-proxy-client-setup.svg)
70
+
71
+ Client sẽ gọi bằng header:
72
+
73
+ ```text
74
+ Authorization: Bearer sk-...
75
+ ```
76
+
77
+ Không public API Proxy ra internet nếu chưa có API key và rule bảo mật.
78
+
79
+ ## 5. Endpoint Cho Các Client AI
80
+
81
+ ### OpenAI Compatible
82
+
83
+ ```text
84
+ Base URL: http://127.0.0.1:5580/v1
85
+ Chat: POST /v1/chat/completions
86
+ Models: GET /v1/models
87
+ ```
88
+
89
+ Ví dụ:
90
+
91
+ ```bash
92
+ curl http://127.0.0.1:5580/v1/chat/completions \
93
+ -H "Authorization: Bearer sk-..." \
94
+ -H "Content-Type: application/json" \
95
+ -d '{
96
+ "model": "claude-sonnet-4.5",
97
+ "messages": [{"role": "user", "content": "Reply pong"}],
98
+ "stream": false
99
+ }'
100
+ ```
101
+
102
+ ### Claude Compatible
103
+
104
+ ```text
105
+ Base URL: http://127.0.0.1:5580
106
+ Messages: POST /v1/messages
107
+ ```
108
+
109
+ Ví dụ:
110
+
111
+ ```bash
112
+ curl http://127.0.0.1:5580/v1/messages \
113
+ -H "Authorization: Bearer sk-..." \
114
+ -H "Content-Type: application/json" \
115
+ -d '{
116
+ "model": "claude-sonnet-4.5",
117
+ "max_tokens": 256,
118
+ "messages": [{"role": "user", "content": "Reply pong"}],
119
+ "stream": false
120
+ }'
121
+ ```
122
+
123
+ ### Gemini Compatible
124
+
125
+ ```text
126
+ Base URL: http://127.0.0.1:5580
127
+ Models: GET /v1beta/models
128
+ Generate: POST /v1beta/models/{model}:generateContent
129
+ ```
130
+
131
+ ## 6. Kết Nối OpenClaw
132
+
133
+ Cách nhanh nhất:
134
+
135
+ ```bash
136
+ krouter openclaw import
137
+ ```
138
+
139
+ Hoặc dùng dashboard:
140
+
141
+ ```text
142
+ API Proxy Service -> Configure Clients -> chọn OpenClaw -> Import
143
+ ```
144
+
145
+ Sau khi import, trong OpenClaw chọn provider `krouter`, rồi dùng `/models` để xem model Krouter đang xuất ra.
146
+
147
+ ## 7. Kết Nối Công Cụ Khác
148
+
149
+ Dùng cấu hình chung:
150
+
151
+ ```text
152
+ Provider: OpenAI Compatible
153
+ Base URL: http://127.0.0.1:5580/v1
154
+ API Key: sk-...
155
+ Model: claude-sonnet-4.5
156
+ ```
157
+
158
+ Phù hợp với các client như OpenClaw, Codex-compatible client, Continue, Cline, Cursor, OpenCode hoặc client tự viết.
159
+
160
+ ## 8. Kiểm Tra Hoạt Động
161
+
162
+ Kiểm tra backend:
163
+
164
+ ```bash
165
+ curl http://127.0.0.1:4010/healthz
166
+ ```
167
+
168
+ Kiểm tra proxy:
169
+
170
+ ```bash
171
+ curl http://127.0.0.1:5580/health
172
+ ```
173
+
174
+ Kiểm tra danh sách model:
175
+
176
+ ```bash
177
+ curl http://127.0.0.1:5580/v1/models \
178
+ -H "Authorization: Bearer sk-..."
179
+ ```
180
+
181
+ Nếu `/v1/models` trả `401`, API key chưa đúng hoặc chưa gửi header `Authorization`.
182
+
183
+ ## 9. Gợi Ý Vận Hành An Toàn
184
+
185
+ - Chỉ bind `127.0.0.1` khi dùng local.
186
+ - Nếu chạy VPS, dùng tunnel dashboard và giữ proxy API có key.
187
+ - Bật Auto Start để backend tự bật lại proxy sau restart.
188
+ - Dùng `Smart` cho multi-account mặc định.
189
+ - Theo dõi tab request logs khi test model mới.
190
+ - Không dùng tài khoản bị suspended cho request model; hãy để proxy tự bỏ qua hoặc gỡ khỏi pool.
191
+
192
+ ## 10. Lỗi Thường Gặp
193
+
194
+ ### `401 Unauthorized`
195
+
196
+ Thiếu API key hoặc key sai. Kiểm tra header:
197
+
198
+ ```text
199
+ Authorization: Bearer sk-...
200
+ ```
201
+
202
+ ### `profileArn is required`
203
+
204
+ Account chưa có ARN phù hợp cho endpoint/model đó. Bấm **Sync Accounts**, **Refresh Models**, hoặc dùng chiến lược **Smart** để proxy chọn account khác có capability tốt hơn.
205
+
206
+ ### `All models are temporarily rate-limited`
207
+
208
+ Nhiều account đang rate-limit/cooldown. Đợi cooldown, giảm tốc độ request hoặc kiểm tra request logs để xem account nào đang bị lỗi.
209
+
210
+ ### `All accounts quota exhausted`
211
+
212
+ Các tài khoản trong scope đã hết quota hoặc đang cooldown. Kiểm tra quota từng tài khoản, group scope và API key binding.
213
+
@@ -0,0 +1,85 @@
1
+ # Kiro 账户管理器 v1.2.5 更新日志
2
+
3
+ **发布日期**: 2025-12-09
4
+
5
+ ---
6
+
7
+ ## 🎨 主题系统升级
8
+
9
+ ### 主题颜色扩展
10
+ - 主题颜色从 **13 个增加到 21 个**,提供更丰富的个性化选择
11
+ - 按色系分组显示,便于用户快速定位喜欢的颜色:
12
+ - **蓝色系**: 天空蓝、靛蓝、清新青、晴空蓝、水鸭蓝
13
+ - **紫红系**: 优雅紫、紫罗兰、洋红、粉红、玫瑰红
14
+ - **暖色系**: 热情红、活力橙、琥珀金、明黄
15
+ - **绿色系**: 翠绿、草绿、青柠
16
+ - **中性色**: 石板灰、锌灰、暖灰、中性灰
17
+
18
+ ### 主题选择器优化
19
+ - 新增 **收缩/展开** 功能,收缩时显示当前选中颜色
20
+ - 点击即可展开完整的主题选择面板
21
+ - 减少页面占用空间,界面更整洁
22
+
23
+ ---
24
+
25
+ ## 📊 主页增强
26
+
27
+ ### 额度统计卡片
28
+ - 新增 **额度统计** 模块,实时汇总所有有效账号的用量数据
29
+ - 显示内容:
30
+ - 总额度
31
+ - 已使用
32
+ - 剩余额度
33
+ - 使用率百分比
34
+ - 可视化进度条,根据使用率变色:
35
+ - 🟢 绿色: < 50%
36
+ - 🟡 黄色: 50% - 80%
37
+ - 🔴 红色: > 80%
38
+
39
+ ---
40
+
41
+ ## 💾 导出功能升级
42
+
43
+ ### 多格式导出支持
44
+ - 新增导出格式选择弹窗,支持 4 种导出格式:
45
+ - **JSON**: 完整数据,可用于导入恢复
46
+ - **TXT**: 纯文本格式,便于阅读
47
+ - **CSV**: Excel 兼容格式,支持中文
48
+ - **剪贴板**: 直接复制到剪贴板
49
+
50
+ ### 导出选项
51
+ - JSON 格式可选择是否包含凭证信息(Token 等敏感数据)
52
+ - 支持多选账号导出,选中账号时只导出选中的
53
+ - 设置页面和账户管理页面共用相同的导出组件
54
+
55
+ ---
56
+
57
+ ## 🔧 机器码管理优化
58
+
59
+ ### 当前机器码卡片
60
+ - 新增 **最后修改时间** 显示,与原始机器码备份布局保持一致
61
+
62
+ ### 账户机器码管理弹窗
63
+ - 新增 **搜索功能**,支持按邮箱、昵称、机器码搜索
64
+ - 搜索无结果时显示友好提示
65
+
66
+ ---
67
+
68
+ ## 🐛 问题修复
69
+
70
+ - 修复部分主题颜色切换无效的问题
71
+ - 补全所有新增主题的 CSS 变量定义
72
+ - 修复 `applyTheme` 函数未包含新主题类名的问题
73
+
74
+ ---
75
+
76
+ ## 📝 技术改进
77
+
78
+ - 主题配置重构为分组结构,便于维护和扩展
79
+ - 导出功能组件化,提高代码复用性
80
+ - 优化额度统计使用 `useMemo` 提升性能
81
+
82
+ ---
83
+
84
+ **完整版本**: 1.2.5
85
+ **兼容性**: Windows / macOS / Linux
@@ -0,0 +1,59 @@
1
+ # Kiro 账户管理器 v1.2.7 更新说明
2
+
3
+ 发布日期:2024-12-09
4
+
5
+ ## 🎨 界面美化
6
+
7
+ ### 全局页面美化
8
+ - **统一页面头部设计**:所有页面采用渐变背景 + 模糊光效 + 主题色标题
9
+ - **统一卡片样式**:所有卡片添加悬停阴影效果和图标背景框
10
+ - **颜色主题化**:移除所有硬编码颜色,统一使用主题变量,确保深色/浅色模式和主题色切换时颜色一致
11
+
12
+ ### 新增自定义 UI 组件
13
+ - **Toggle 开关组件**:替换原生 checkbox,提供平滑动画和主题色支持
14
+ - **Select 下拉组件**:替换原生 select,支持选项描述、勾选标记和主题色高亮
15
+
16
+ ### 美化的页面
17
+ - **首页 (HomePage)**:头部渐变、统计卡片悬停效果、特色功能卡片主题化
18
+ - **账户管理 (AccountManager)**:头部渐变背景和图标
19
+ - **设置页面 (SettingsPage)**:头部渐变、所有卡片图标统一样式、检查间隔布局优化
20
+ - **Kiro 设置 (KiroSettingsPage)**:头部渐变、Toggle 开关、Select 下拉框、通知设置分组
21
+ - **关于页面 (AboutPage)**:头部渐变、所有卡片图标统一样式、功能列表颜色统一
22
+
23
+ ## 🔧 功能优化
24
+
25
+ ### OIDC 凭证批量导入
26
+ - **支持 GitHub 和 Google 账号**:批量导入时可通过 `provider` 字段指定账号类型
27
+ - **自动识别认证方式**:根据 provider 自动设置正确的 `authMethod` (IdC/social) 和 `idp`
28
+ - **更新帮助文本**:添加 GitHub/Google 示例和说明
29
+
30
+ ### 批量导入 JSON 格式示例
31
+ ```json
32
+ [
33
+ {
34
+ "refreshToken": "xxx",
35
+ "clientId": "xxx",
36
+ "clientSecret": "xxx",
37
+ "provider": "BuilderId"
38
+ },
39
+ {
40
+ "refreshToken": "yyy",
41
+ "provider": "Github"
42
+ },
43
+ {
44
+ "refreshToken": "zzz",
45
+ "provider": "Google"
46
+ }
47
+ ]
48
+ ```
49
+
50
+ ## 📁 新增文件
51
+
52
+ - `src/renderer/src/components/ui/Toggle.tsx` - 自定义开关组件
53
+ - `src/renderer/src/components/ui/Select.tsx` - 自定义下拉选择组件
54
+
55
+ ## 🐛 修复
56
+
57
+ - 修复设置页面检查间隔下拉框布局问题
58
+ - 修复 Kiro 设置页面上下下拉框宽度不一致问题
59
+ - 统一设置页面和 Kiro 设置页面的宽度设置
@@ -0,0 +1,56 @@
1
+ # Kiro 账户管理器 v1.3.7 更新说明
2
+
3
+ 发布日期:2025-01-18
4
+
5
+ ## 🎯 订阅管理功能优化
6
+
7
+ ### 订阅流程重构
8
+ - **统一订阅入口**:点击订阅标签统一先获取可用订阅列表,然后显示订阅计划页面
9
+ - **首次用户支持**:正确处理首次用户订阅流程,使用 `qSubscriptionType` 参数创建订阅令牌
10
+ - **管理账单按钮**:所有账户左下角都显示"管理账单"按钮,不管是否有订阅
11
+
12
+ ### 用户体验优化
13
+ - **链接自动复制**:选择订阅计划后,支付链接自动复制到剪贴板
14
+ - **复制成功提示**:显示绿色提示"链接已复制到剪贴板!",800ms 后自动关闭弹窗并打开链接
15
+ - **错误提示**:订阅相关操作失败时,在弹窗中显示红色错误提示信息
16
+
17
+ ## 🌐 API 反代服务改进
18
+
19
+ ### Claude Code 兼容性
20
+ - **新增端点**:`/anthropic/v1/messages` - Claude Code 兼容
21
+ - **新增端点**:`/v1/messages/count_tokens` - Token 计数
22
+ - **新增端点**:`/api/event_logging/batch` - 遥测支持
23
+
24
+ ### 配置与稳定性
25
+ - **配置持久化**:端口和 host 更改时自动保存配置
26
+ - **CORS 头增强**:添加 Claude Code 需要的更多请求头支持
27
+
28
+ ### API 兼容性
29
+ - **工具描述长度限制**:自动截断超过 10240 bytes 的工具描述
30
+ - **内容非空检查**:确保发送给 Kiro API 的消息内容非空
31
+
32
+ ## 🔧 技术修复
33
+
34
+ ### API 调用优化
35
+ - **修复 Header**:统一使用正确的 `x-amzn-codewhisperer-optout-preference: OPTIN` 请求头
36
+ - **修复订阅类型参数**:`CreateSubscriptionToken` API 使用 `qSubscriptionType`
37
+
38
+ ## 📝 代码变更
39
+
40
+ ### AccountCard.tsx
41
+ - 新增 `subscriptionError` 和 `subscriptionSuccess` 状态
42
+ - 重构订阅相关函数
43
+
44
+ ### ProxyPanel.tsx
45
+ - 端口、host 更改时自动保存配置
46
+ - 更新 API 端点说明列表
47
+
48
+ ### proxyServer.ts
49
+ - 添加新路由支持和 `handleCountTokens` 方法
50
+ - 增强 CORS 头配置
51
+
52
+ ### translator.ts
53
+ - 添加工具描述长度限制和内容非空检查
54
+
55
+ ### kiroApi.ts
56
+ - 修复请求头格式