claude-codex-proxy 1.0.3 → 1.0.5-beta.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/README.md +39 -6
- package/bin/cli.js +43 -0
- package/docs/API.md +22 -0
- package/package.json +3 -2
- package/public/index.html +130 -14
- package/public/js/app.js +162 -20
- package/src/account-manager.js +83 -29
- package/src/account-rotation/rate-limits.js +49 -0
- package/src/account-rotation/strategies/sticky-strategy.js +9 -22
- package/src/direct-api.js +30 -7
- package/src/index.js +7 -1
- package/src/middleware/auth.js +81 -0
- package/src/response-streamer.js +6 -1
- package/src/routes/api-routes.js +31 -7
- package/src/routes/chat-route.js +1 -1
- package/src/routes/claude-config-route.js +18 -1
- package/src/routes/messages-route.js +5 -12
- package/src/routes/models-route.js +1 -1
- package/src/routes/settings-route.js +99 -1
- package/src/server-settings.js +2 -3
- package/src/server.js +10 -5
package/README.md
CHANGED
|
@@ -90,7 +90,22 @@ Other versions may work, but these versions are recommended for better compatibi
|
|
|
90
90
|
```bash
|
|
91
91
|
npx claude-codex-proxy@latest start
|
|
92
92
|
```
|
|
93
|
-
The
|
|
93
|
+
The startup prompt asks you to choose **local deployment** or **public deployment**.
|
|
94
|
+
|
|
95
|
+
- Local deployment: no access key is required.
|
|
96
|
+
- Public deployment: enter the UI/admin access key to unlock the Web Dashboard and management APIs. After startup, create and manage Claude Code client API keys from **Settings → Claude Code Client API Keys**.
|
|
97
|
+
|
|
98
|
+
The server will start at `http://localhost:8081` by default. To use another port:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
PORT=8082 claude-codex-proxy start
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
PowerShell:
|
|
105
|
+
|
|
106
|
+
```powershell
|
|
107
|
+
$env:PORT=9000; npm start
|
|
108
|
+
```
|
|
94
109
|
|
|
95
110
|
### 2. Add Your Account
|
|
96
111
|
|
|
@@ -118,15 +133,29 @@ For **headless/VM servers** without a browser:
|
|
|
118
133
|
5. Paste it back in the terminal
|
|
119
134
|
|
|
120
135
|
### 3. Configure Claude Code
|
|
121
|
-
Run this command to
|
|
136
|
+
Run this command to configure your `claude` CLI to use the proxy:
|
|
122
137
|
```bash
|
|
123
138
|
curl -X POST http://localhost:8081/claude/config/proxy
|
|
124
139
|
```
|
|
125
140
|
|
|
141
|
+
In local deployment, this writes the local Claude Code configuration on the machine running the proxy.
|
|
142
|
+
|
|
143
|
+
In public deployment, this endpoint does **not** modify the server machine's Claude Code configuration. It only returns the client-side values to set:
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"env": {
|
|
147
|
+
"ANTHROPIC_BASE_URL": "http://your-server:8081",
|
|
148
|
+
"ANTHROPIC_API_KEY": "<client-api-key>"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Create a Claude Code client API key in **Settings → Claude Code Client API Keys**, then use it as `ANTHROPIC_API_KEY`.
|
|
154
|
+
|
|
126
155
|
*Alternatively, set the environment variables manually:*
|
|
127
156
|
```bash
|
|
128
157
|
export ANTHROPIC_BASE_URL=http://localhost:8081
|
|
129
|
-
export ANTHROPIC_API_KEY
|
|
158
|
+
export ANTHROPIC_API_KEY=<client-api-key>
|
|
130
159
|
```
|
|
131
160
|
|
|
132
161
|
To skip Claude Code's login/onboarding prompt, edit `~/.claude.json` and add:
|
|
@@ -184,6 +213,7 @@ You can enable it from the Web Dashboard under **Settings → Raw Proxy Payload
|
|
|
184
213
|
```bash
|
|
185
214
|
curl -X POST http://localhost:8081/settings/raw-proxy-logs \
|
|
186
215
|
-H "Content-Type: application/json" \
|
|
216
|
+
-H "Authorization: Bearer <ui-admin-key>" \
|
|
187
217
|
-d '{"enabled":true}'
|
|
188
218
|
```
|
|
189
219
|
|
|
@@ -192,21 +222,24 @@ Disable it again with:
|
|
|
192
222
|
```bash
|
|
193
223
|
curl -X POST http://localhost:8081/settings/raw-proxy-logs \
|
|
194
224
|
-H "Content-Type: application/json" \
|
|
225
|
+
-H "Authorization: Bearer <ui-admin-key>" \
|
|
195
226
|
-d '{"enabled":false}'
|
|
196
227
|
```
|
|
197
228
|
|
|
198
229
|
Check the current state:
|
|
199
230
|
|
|
200
231
|
```bash
|
|
201
|
-
curl http://localhost:8081/settings/raw-proxy-logs
|
|
232
|
+
curl http://localhost:8081/settings/raw-proxy-logs \
|
|
233
|
+
-H "Authorization: Bearer <ui-admin-key>"
|
|
202
234
|
```
|
|
203
235
|
|
|
204
236
|
Authentication headers and access tokens are not logged.
|
|
205
237
|
|
|
206
238
|
### API Endpoints
|
|
207
239
|
- `GET /health`: Check server status.
|
|
208
|
-
- `GET /accounts`: List configured accounts.
|
|
209
|
-
- `POST /v1/messages`: Anthropic-compatible chat completion endpoint.
|
|
240
|
+
- `GET /accounts`: List configured accounts. In public deployment, requires the UI/admin access key.
|
|
241
|
+
- `POST /v1/messages`: Anthropic-compatible chat completion endpoint. In public deployment, requires the Claude Code client API key.
|
|
242
|
+
- `POST /claude/config/proxy`: Returns Claude Code proxy configuration. In public deployment, this is public and dry-run only.
|
|
210
243
|
|
|
211
244
|
See [API Documentation](./docs/API.md) for full details.
|
|
212
245
|
|
package/bin/cli.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
import { readFileSync } from 'fs';
|
|
6
|
+
import readline from 'readline';
|
|
7
|
+
import { stdin as input, stdout as output } from 'process';
|
|
6
8
|
|
|
7
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
10
|
const __dirname = dirname(__filename);
|
|
@@ -68,6 +70,46 @@ function showVersion() {
|
|
|
68
70
|
console.log(packageJson.version);
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
function ask(question) {
|
|
74
|
+
const rl = readline.createInterface({ input, output });
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
rl.question(question, (answer) => {
|
|
77
|
+
rl.close();
|
|
78
|
+
resolve(answer.trim());
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function askDeploymentMode() {
|
|
84
|
+
console.log('\nSelect deployment mode:');
|
|
85
|
+
console.log(' 1) Local deployment (no access key required)');
|
|
86
|
+
console.log(' 2) Public deployment (access key required)');
|
|
87
|
+
|
|
88
|
+
while (true) {
|
|
89
|
+
const answer = await ask('Choose mode [1/2]: ');
|
|
90
|
+
if (answer === '1' || /^local$/i.test(answer)) return 'local';
|
|
91
|
+
if (answer === '2' || /^public$/i.test(answer)) return 'public';
|
|
92
|
+
console.log('Please enter 1 for local deployment or 2 for public deployment.');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function askRequiredKey(label) {
|
|
97
|
+
while (true) {
|
|
98
|
+
const apiKey = await ask(`${label}: `);
|
|
99
|
+
if (apiKey) return apiKey;
|
|
100
|
+
console.log('Access key cannot be empty in public deployment mode.');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function configureStartMode() {
|
|
105
|
+
const mode = await askDeploymentMode();
|
|
106
|
+
process.env.PROXY_DEPLOYMENT_MODE = mode;
|
|
107
|
+
|
|
108
|
+
if (mode === 'public') {
|
|
109
|
+
process.env.PROXY_ADMIN_KEY = await askRequiredKey('Enter UI/admin access key');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
71
113
|
async function main() {
|
|
72
114
|
if (args.includes('--help') || args.includes('-h')) {
|
|
73
115
|
showHelp();
|
|
@@ -82,6 +124,7 @@ async function main() {
|
|
|
82
124
|
switch (command) {
|
|
83
125
|
case 'start':
|
|
84
126
|
case undefined:
|
|
127
|
+
await configureStartMode();
|
|
85
128
|
await import('../src/index.js');
|
|
86
129
|
break;
|
|
87
130
|
|
package/docs/API.md
CHANGED
|
@@ -103,6 +103,28 @@ Content-Type: application/json
|
|
|
103
103
|
GET /auth/callback?code=...&state=...
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## Client API Key Management
|
|
107
|
+
|
|
108
|
+
In public deployment mode, these endpoints require the UI/admin access key (`Authorization: Bearer <admin-key>`). Key values are returned only from creation responses.
|
|
109
|
+
|
|
110
|
+
| Endpoint | Method | Description |
|
|
111
|
+
|----------|--------|-------------|
|
|
112
|
+
| `/settings/client-api-keys` | GET | List key metadata without key values |
|
|
113
|
+
| `/settings/client-api-keys` | POST | Create a client API key |
|
|
114
|
+
| `/settings/client-api-keys/:id` | PUT | Update name or remark |
|
|
115
|
+
| `/settings/client-api-keys/:id` | DELETE | Revoke and delete the key |
|
|
116
|
+
|
|
117
|
+
### Create a Client API Key
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
curl -X POST http://localhost:8081/settings/client-api-keys \
|
|
121
|
+
-H "Content-Type: application/json" \
|
|
122
|
+
-H "Authorization: Bearer <admin-key>" \
|
|
123
|
+
-d '{"name":"work-laptop","remark":"primary Claude Code client"}'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Use the `clientApiKey.key` from this one-time response as `ANTHROPIC_API_KEY` for Claude Code.
|
|
127
|
+
|
|
106
128
|
## Claude CLI Configuration
|
|
107
129
|
|
|
108
130
|
| Endpoint | Method | Description |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-codex-proxy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5-beta.0",
|
|
4
4
|
"description": "Multi-account proxy server for OpenAI Codex CLI with Claude API compatibility",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/zzy-life/claude-codex-proxy#readme",
|
|
31
31
|
"scripts": {
|
|
32
|
-
"start": "node
|
|
32
|
+
"start": "node bin/cli.js start",
|
|
33
33
|
"portfolio:dev": "npm --prefix apps/portfolio run dev",
|
|
34
34
|
"portfolio:build": "npm --prefix apps/portfolio run build",
|
|
35
35
|
"portfolio:preview": "npm --prefix apps/portfolio run preview",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"test:cors": "node --test tests/cors_security.test.js",
|
|
48
48
|
"test:ui": "node --test tests/ui.test.js",
|
|
49
49
|
"pack:check": "npm pack --dry-run",
|
|
50
|
+
"release:beta": "npm run test:unit && npm run pack:check && npm publish --tag beta",
|
|
50
51
|
"release:npm": "npm run test:unit && npm pack --dry-run && npm publish"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
package/public/index.html
CHANGED
|
@@ -55,7 +55,26 @@
|
|
|
55
55
|
</template>
|
|
56
56
|
</div>
|
|
57
57
|
|
|
58
|
-
<div
|
|
58
|
+
<div x-show="authChecked && !isAuthenticated" class="min-h-screen flex items-center justify-center px-4">
|
|
59
|
+
<div class="w-full max-w-md bg-space-900/70 border border-space-border rounded-2xl p-6 shadow-2xl backdrop-blur-md">
|
|
60
|
+
<div class="flex items-center gap-3 mb-6">
|
|
61
|
+
<div class="w-10 h-10 rounded bg-gradient-to-br from-neon-purple to-blue-600 flex items-center justify-center text-white font-bold">CX</div>
|
|
62
|
+
<div>
|
|
63
|
+
<h1 class="text-xl font-bold text-white">Access Required</h1>
|
|
64
|
+
<p class="text-sm text-gray-500">Enter the server access key to open the management UI.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<form @submit.prevent="login" class="space-y-4">
|
|
68
|
+
<label class="form-control w-full">
|
|
69
|
+
<span class="label-text text-gray-400 mb-1">Access Key</span>
|
|
70
|
+
<input type="password" x-model="loginApiKey" class="input input-bordered w-full bg-space-950 border-space-border text-white" placeholder="Enter access key" autocomplete="current-password">
|
|
71
|
+
</label>
|
|
72
|
+
<button type="submit" class="btn w-full bg-neon-purple hover:bg-purple-600 border-0 text-white">Unlock UI</button>
|
|
73
|
+
</form>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div x-show="isAuthenticated" class="h-14 border-b border-space-border flex items-center px-4 lg:px-6 justify-between bg-space-900/50 backdrop-blur-md z-50 relative">
|
|
59
78
|
<div class="flex items-center gap-3">
|
|
60
79
|
<button @click="sidebarOpen = !sidebarOpen" class="text-gray-400 hover:text-white focus:outline-none p-1 transition-colors lg:hidden">
|
|
61
80
|
<svg class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
@@ -100,10 +119,13 @@
|
|
|
100
119
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
|
101
120
|
</svg>
|
|
102
121
|
</button>
|
|
122
|
+
|
|
123
|
+
<button x-show="authRequired" type="button" class="btn btn-ghost btn-xs text-gray-400 hover:text-white hover:bg-white/5"
|
|
124
|
+
@click="logout()" title="Clear saved access key">Logout</button>
|
|
103
125
|
</div>
|
|
104
126
|
</div>
|
|
105
127
|
|
|
106
|
-
<div class="flex h-[calc(100vh-56px)] relative">
|
|
128
|
+
<div x-show="isAuthenticated" class="flex h-[calc(100vh-56px)] relative">
|
|
107
129
|
<div x-show="sidebarOpen" x-transition:enter="transition-opacity ease-linear duration-300"
|
|
108
130
|
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
|
109
131
|
x-transition:leave="transition-opacity ease-linear duration-300"
|
|
@@ -144,6 +166,13 @@
|
|
|
144
166
|
</svg>
|
|
145
167
|
<span>Logs</span>
|
|
146
168
|
</button>
|
|
169
|
+
<button class="nav-item flex items-center gap-3 px-6 py-3 text-sm font-medium text-gray-400 hover:text-white hover:bg-white/5"
|
|
170
|
+
:class="{'active': activeTab === 'client-api-keys'}" @click="setActiveTab('client-api-keys')">
|
|
171
|
+
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
172
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2V9a2 2 0 00-2-2h-1V5a5 5 0 00-10 0v2H6a2 2 0 00-2 2v10a2 2 0 002 2z" />
|
|
173
|
+
</svg>
|
|
174
|
+
<span>Client API Keys</span>
|
|
175
|
+
</button>
|
|
147
176
|
<button class="nav-item flex items-center gap-3 px-6 py-3 text-sm font-medium text-gray-400 hover:text-white hover:bg-white/5"
|
|
148
177
|
:class="{'active': activeTab === 'settings'}" @click="setActiveTab('settings')">
|
|
149
178
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
@@ -256,7 +285,7 @@
|
|
|
256
285
|
</div>
|
|
257
286
|
<div class="bg-space-800/50 border border-space-border/30 rounded-lg p-4 font-mono text-sm text-gray-300">
|
|
258
287
|
<div class="text-gray-500 mb-2"># Set environment variables</div>
|
|
259
|
-
<div class="text-neon-cyan"
|
|
288
|
+
<div class="text-neon-cyan" x-text="`export ANTHROPIC_BASE_URL=${serverUrl}`"></div>
|
|
260
289
|
<div class="text-neon-cyan">export ANTHROPIC_API_KEY=any-key</div>
|
|
261
290
|
<div class="text-gray-500 mt-2 mb-2"># Run Claude</div>
|
|
262
291
|
<div class="text-neon-green">claude</div>
|
|
@@ -265,7 +294,7 @@
|
|
|
265
294
|
<div class="mt-4 flex justify-end">
|
|
266
295
|
<button class="btn btn-sm bg-neon-purple hover:bg-purple-600 border-none text-white font-sans"
|
|
267
296
|
@click="setClaudeCodeProxyTestConfig()">
|
|
268
|
-
Update Claude Code settings.json (
|
|
297
|
+
Update Claude Code settings.json (current server + key=test)
|
|
269
298
|
</button>
|
|
270
299
|
</div>
|
|
271
300
|
</div>
|
|
@@ -326,7 +355,7 @@
|
|
|
326
355
|
<tbody>
|
|
327
356
|
<template x-if="filteredAccounts.length === 0 && accounts.length === 0">
|
|
328
357
|
<tr>
|
|
329
|
-
<td colspan="6" class="py-16 text-center">
|
|
358
|
+
<td colspan="6" class="py-16 text-center flex justify-center">
|
|
330
359
|
<div class="flex flex-col items-center gap-4 max-w-lg mx-auto">
|
|
331
360
|
<svg class="w-20 h-20 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
332
361
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
|
|
@@ -383,8 +412,9 @@
|
|
|
383
412
|
:class="acc.tokenExpired ? 'text-red-400' : 'text-neon-green'"
|
|
384
413
|
x-text="acc.tokenExpired ? 'Expired' : 'Valid'"></span>
|
|
385
414
|
<button class="btn btn-xs btn-ghost p-2 rounded hover:bg-white/10 text-gray-500 hover:text-white transition-colors"
|
|
386
|
-
@click="refreshToken(acc.email)"
|
|
387
|
-
|
|
415
|
+
@click="refreshToken(acc.email)"
|
|
416
|
+
:disabled="refreshingTokenEmails.includes(acc.email)" title="Refresh token">
|
|
417
|
+
<svg class="w-4 h-4" :class="{'animate-spin': refreshingTokenEmails.includes(acc.email)}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
388
418
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
|
389
419
|
</svg>
|
|
390
420
|
</button>
|
|
@@ -547,6 +577,53 @@
|
|
|
547
577
|
</div>
|
|
548
578
|
</div>
|
|
549
579
|
|
|
580
|
+
<div x-show="activeTab === 'client-api-keys'" x-transition class="view-container">
|
|
581
|
+
<div class="flex flex-wrap items-center justify-between gap-4 mb-6">
|
|
582
|
+
<div class="flex flex-wrap items-center gap-4">
|
|
583
|
+
<h1 class="text-2xl font-bold text-white tracking-tight">Claude Code Client API Keys</h1>
|
|
584
|
+
<div class="flex items-center h-6 px-3 rounded-full bg-space-800/80 border border-space-border/50 shadow-sm backdrop-blur-sm">
|
|
585
|
+
<span class="text-[10px] font-mono text-gray-400 uppercase tracking-wider">Client access management</span>
|
|
586
|
+
</div>
|
|
587
|
+
</div>
|
|
588
|
+
</div>
|
|
589
|
+
|
|
590
|
+
<div class="view-card !p-0 overflow-x-auto">
|
|
591
|
+
<div class="flex items-center justify-between gap-4 px-6 py-4 border-b border-space-border/50">
|
|
592
|
+
<h2 class="text-sm font-semibold text-gray-200">Client API Keys</h2>
|
|
593
|
+
<button class="btn btn-sm bg-neon-purple hover:bg-purple-600 border-none text-white" @click="revealedClientApiKey = ''; showCreateClientApiKeyModal = true">
|
|
594
|
+
New API Key
|
|
595
|
+
</button>
|
|
596
|
+
</div>
|
|
597
|
+
<template x-if="clientApiKeysLoading">
|
|
598
|
+
<div class="text-xs text-gray-500 font-mono py-8 text-center">Loading client API keys...</div>
|
|
599
|
+
</template>
|
|
600
|
+
<table class="w-full min-w-[760px]" x-show="!clientApiKeysLoading && clientApiKeys.length">
|
|
601
|
+
<thead>
|
|
602
|
+
<tr class="bg-space-900/50 border-b border-space-border/50">
|
|
603
|
+
<th class="py-3 pl-6 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider">Client Name</th>
|
|
604
|
+
<th class="py-3 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider">Remark</th>
|
|
605
|
+
<th class="py-3 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider">Created</th>
|
|
606
|
+
<th class="py-3 pr-6 text-right text-[10px] font-bold text-gray-500 uppercase tracking-wider">Operations</th>
|
|
607
|
+
</tr>
|
|
608
|
+
</thead>
|
|
609
|
+
<tbody>
|
|
610
|
+
<template x-for="clientApiKey in clientApiKeys" :key="clientApiKey.id">
|
|
611
|
+
<tr class="border-b border-space-border/30 last:border-0 hover:bg-white/5 transition-colors">
|
|
612
|
+
<td class="py-3 pl-6"><input type="text" x-model="clientApiKey.name" placeholder="Unnamed" class="input input-sm w-48 bg-space-800 border-space-border text-white"></td>
|
|
613
|
+
<td class="py-3"><input type="text" x-model="clientApiKey.remark" placeholder="No remark" class="input input-sm w-48 bg-space-800 border-space-border text-white"></td>
|
|
614
|
+
<td class="py-3 text-xs font-mono text-gray-500 whitespace-nowrap" x-text="new Date(clientApiKey.createdAt).toLocaleString()"></td>
|
|
615
|
+
<td class="py-3 pr-6"><div class="flex justify-end gap-2 whitespace-nowrap">
|
|
616
|
+
<button class="btn btn-xs btn-outline text-gray-300" @click="updateClientApiKey(clientApiKey)" :disabled="clientApiKeySaving">Save</button>
|
|
617
|
+
<button class="btn btn-xs btn-outline text-red-400" @click="deleteClientApiKey(clientApiKey)" :disabled="clientApiKeySaving">Delete</button>
|
|
618
|
+
</div></td>
|
|
619
|
+
</tr>
|
|
620
|
+
</template>
|
|
621
|
+
</tbody>
|
|
622
|
+
</table>
|
|
623
|
+
<div x-show="!clientApiKeysLoading && !clientApiKeys.length" class="text-sm text-gray-500 font-mono py-16 text-center">No client API keys. Create one to connect Claude Code clients.</div>
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
|
|
550
627
|
<div x-show="activeTab === 'settings'" x-transition class="view-container">
|
|
551
628
|
<div class="flex items-center justify-between gap-4 mb-6">
|
|
552
629
|
<div class="flex flex-wrap items-center gap-4">
|
|
@@ -567,7 +644,7 @@
|
|
|
567
644
|
<div class="space-y-3">
|
|
568
645
|
<div class="flex items-center justify-between py-2 border-b border-space-border/30">
|
|
569
646
|
<span class="text-sm text-gray-400">Server URL</span>
|
|
570
|
-
<span class="font-mono text-sm text-white"
|
|
647
|
+
<span class="font-mono text-sm text-white" x-text="serverUrl"></span>
|
|
571
648
|
</div>
|
|
572
649
|
<div class="flex items-center justify-between py-2 border-b border-space-border/30">
|
|
573
650
|
<span class="text-sm text-gray-400">Config Path</span>
|
|
@@ -620,19 +697,19 @@
|
|
|
620
697
|
<div class="grid gap-3">
|
|
621
698
|
<div class="grid grid-cols-1 md:grid-cols-[160px_1fr] gap-2 md:items-center">
|
|
622
699
|
<div>
|
|
623
|
-
<div class="text-sm text-gray-300">Claude
|
|
624
|
-
<div class="text-xs text-gray-500 font-mono">
|
|
700
|
+
<div class="text-sm text-gray-300">Claude Opus</div>
|
|
701
|
+
<div class="text-xs text-gray-500 font-mono">opus</div>
|
|
625
702
|
</div>
|
|
626
|
-
<input type="text" x-model="modelMappings.
|
|
703
|
+
<input type="text" x-model="modelMappings.opus" placeholder="gpt-5.5"
|
|
627
704
|
class="input bg-space-800 border-space-border text-white font-mono text-sm">
|
|
628
705
|
</div>
|
|
629
706
|
|
|
630
707
|
<div class="grid grid-cols-1 md:grid-cols-[160px_1fr] gap-2 md:items-center">
|
|
631
708
|
<div>
|
|
632
|
-
<div class="text-sm text-gray-300">Claude
|
|
633
|
-
<div class="text-xs text-gray-500 font-mono">
|
|
709
|
+
<div class="text-sm text-gray-300">Claude Sonnet</div>
|
|
710
|
+
<div class="text-xs text-gray-500 font-mono">sonnet</div>
|
|
634
711
|
</div>
|
|
635
|
-
<input type="text" x-model="modelMappings.
|
|
712
|
+
<input type="text" x-model="modelMappings.sonnet" placeholder="gpt-5.5"
|
|
636
713
|
class="input bg-space-800 border-space-border text-white font-mono text-sm">
|
|
637
714
|
</div>
|
|
638
715
|
|
|
@@ -673,6 +750,45 @@
|
|
|
673
750
|
</div>
|
|
674
751
|
</div>
|
|
675
752
|
|
|
753
|
+
<div x-show="showCreateClientApiKeyModal" x-transition class="fixed inset-0 z-50 flex items-center justify-center p-4" style="display: none;" @keydown.escape.window="showCreateClientApiKeyModal = false">
|
|
754
|
+
<div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="showCreateClientApiKeyModal = false"></div>
|
|
755
|
+
<div class="relative bg-space-900 border border-space-border rounded-xl shadow-2xl max-w-md w-full p-6">
|
|
756
|
+
<h3 class="font-bold text-lg text-white mb-2">New Client API Key</h3>
|
|
757
|
+
<p class="text-sm text-gray-400 mb-5">The key is shown once after creation. Copy it before closing the result.</p>
|
|
758
|
+
<div class="space-y-4">
|
|
759
|
+
<label class="block">
|
|
760
|
+
<span class="block text-xs text-gray-400 mb-2">Name</span>
|
|
761
|
+
<input type="text" x-model="clientApiKeyName" placeholder="e.g. Development workstation"
|
|
762
|
+
class="input w-full bg-space-800 border-space-border text-white font-mono text-sm" @keydown.enter="createClientApiKey()">
|
|
763
|
+
</label>
|
|
764
|
+
<label class="block">
|
|
765
|
+
<span class="block text-xs text-gray-400 mb-2">Remark</span>
|
|
766
|
+
<input type="text" x-model="clientApiKeyRemark" placeholder="Optional note"
|
|
767
|
+
class="input w-full bg-space-800 border-space-border text-white font-mono text-sm" @keydown.enter="createClientApiKey()">
|
|
768
|
+
</label>
|
|
769
|
+
</div>
|
|
770
|
+
<div class="mt-6 flex justify-end gap-2">
|
|
771
|
+
<button class="btn btn-outline btn-sm text-gray-400" @click="showCreateClientApiKeyModal = false" :disabled="clientApiKeySaving">Cancel</button>
|
|
772
|
+
<button class="btn btn-sm bg-neon-purple hover:bg-purple-600 border-none text-white" @click="createClientApiKey()" :disabled="clientApiKeySaving">
|
|
773
|
+
<span x-text="clientApiKeySaving ? 'Creating...' : 'Create Key'"></span>
|
|
774
|
+
</button>
|
|
775
|
+
</div>
|
|
776
|
+
</div>
|
|
777
|
+
</div>
|
|
778
|
+
|
|
779
|
+
<div x-show="revealedClientApiKey" x-transition class="fixed inset-0 z-50 flex items-center justify-center p-4" style="display: none;" @keydown.escape.window="revealedClientApiKey = ''">
|
|
780
|
+
<div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="revealedClientApiKey = ''"></div>
|
|
781
|
+
<div class="relative bg-space-900 border border-yellow-400/40 rounded-xl shadow-2xl max-w-xl w-full p-6">
|
|
782
|
+
<h3 class="font-bold text-lg text-yellow-300 mb-2">Client API Key Created</h3>
|
|
783
|
+
<p class="text-sm text-gray-400 mb-5">Copy this key now. It cannot be retrieved later.</p>
|
|
784
|
+
<code class="block break-all rounded-lg border border-space-border bg-space-800 p-3 text-sm text-white font-mono" x-text="revealedClientApiKey"></code>
|
|
785
|
+
<div class="mt-6 flex justify-end gap-2">
|
|
786
|
+
<button class="btn btn-outline btn-sm text-gray-300" @click="navigator.clipboard.writeText(revealedClientApiKey); showToast('Client API key copied', 'success')">Copy</button>
|
|
787
|
+
<button class="btn btn-sm bg-neon-purple hover:bg-purple-600 border-none text-white" @click="revealedClientApiKey = ''">Done</button>
|
|
788
|
+
</div>
|
|
789
|
+
</div>
|
|
790
|
+
</div>
|
|
791
|
+
|
|
676
792
|
<div x-show="showAddModal" x-transition class="fixed inset-0 z-50 flex items-center justify-center p-4" style="display: none;">
|
|
677
793
|
<div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="showAddModal = false"></div>
|
|
678
794
|
<div class="relative bg-space-900 border border-space-border rounded-xl shadow-2xl max-w-md w-full p-6">
|