claude-codex-proxy 1.0.5-beta.2 β†’ 1.0.5-beta.21

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 (42) hide show
  1. package/README.md +0 -272
  2. package/bin/cli.js +37 -2
  3. package/package.json +1 -1
  4. package/public/css/style.css +210 -9
  5. package/public/index.html +32 -926
  6. package/public/js/app.js +168 -737
  7. package/public/login.html +32 -0
  8. package/public/views/accounts-modals.html +218 -0
  9. package/public/views/accounts.html +202 -0
  10. package/public/views/client-api-keys-modals.html +55 -0
  11. package/public/views/client-api-keys.html +69 -0
  12. package/public/views/dashboard.html +90 -0
  13. package/public/views/empty.html +0 -0
  14. package/public/views/logs.html +99 -0
  15. package/public/views/settings.html +123 -0
  16. package/src/account-manager.js +34 -3
  17. package/src/account-rotation/rate-limits.js +4 -26
  18. package/src/account-rotation/strategies/base-strategy.js +4 -0
  19. package/src/account-rotation/strategies/sticky-strategy.js +7 -0
  20. package/src/admin-path.js +33 -0
  21. package/src/claude-config.js +0 -18
  22. package/src/client-key-usage.js +141 -0
  23. package/src/deployment.js +49 -49
  24. package/src/direct-api.js +16 -13
  25. package/src/format-converter.js +77 -48
  26. package/src/index.js +13 -4
  27. package/src/middleware/auth.js +47 -12
  28. package/src/middleware/credentials.js +13 -3
  29. package/src/model-api.js +60 -0
  30. package/src/model-pricing.js +127 -0
  31. package/src/response-streamer.js +23 -7
  32. package/src/routes/accounts-route.js +106 -2
  33. package/src/routes/api-routes.js +61 -35
  34. package/src/routes/chat-route.js +25 -4
  35. package/src/routes/claude-config-route.js +22 -15
  36. package/src/routes/client-quota-route.js +25 -0
  37. package/src/routes/logs-route.js +21 -2
  38. package/src/routes/messages-route.js +45 -14
  39. package/src/routes/settings-route.js +36 -5
  40. package/src/server-settings.js +18 -2
  41. package/src/utils/logger.js +18 -0
  42. package/src/utils/proxy-logging.js +5 -0
package/README.md CHANGED
@@ -1,273 +1 @@
1
1
  # Claude Codex Proxy
2
-
3
- ![Architecture banner](./images/f757093f-507b-4453-994e-f8275f8b07a9.png)
4
-
5
- [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
6
- [![Node.js Version](https://img.shields.io/badge/Node.js-18%2B-blue.svg)](https://nodejs.org/)
7
- [![GitHub stars](https://img.shields.io/github/stars/zzy-life/claude-codex-proxy?style=social)](https://github.com/zzy-life/claude-codex-proxy)
8
-
9
- > **Use Claude Code CLI with the power of ChatGPT Codex models.**
10
- > A local proxy that translates Anthropic API requests into ChatGPT Codex calls, enabling you to use the `claude` CLI tool with your ChatGPT Free/Plus/Pro subscription.
11
-
12
- > This project is forked from the original Claude/Codex proxy project and maintained with additional changes for this distribution.
13
-
14
- ---
15
-
16
- ## πŸš€ Features
17
-
18
- - **Seamless Translation**: Translates Anthropic Messages API calls to ChatGPT Codex format.
19
- - **Model Mapping**: automatically maps `claude-sonnet` and `claude-opus` to their Codex equivalents.
20
- - **Multi-Account Support**: Manage multiple ChatGPT accounts with easy switching and auto-refresh.
21
- - **Web Dashboard**: Built-in UI (`http://localhost:8081`) for managing accounts, viewing logs, and testing prompts.
22
- - **Raw Proxy Payload Logs**: Optional debug logging for Claude Code requests, upstream Codex payloads, completed responses, and upstream errors.
23
- - **Streaming Support**: Full Server-Sent Events (SSE) support for real-time responses.
24
- - **Native Tool Calling**: Supports Claude's tool use capabilities by translating them to Codex function calls.
25
-
26
- ---
27
-
28
- ## οΏ½ Security & Privacy
29
-
30
- **Is this a malicious proxy? No.**
31
-
32
- - **Local Execution**: This server runs entirely on your local machine (`localhost`).
33
- - **Direct Communication**: It connects *directly* to OpenAI/ChatGPT endpoints. No data is sent to any third-party server.
34
- - **Open Source**: The full source code is available here for you to audit.
35
- - **No Data Collection**: We do not track your prompts, keys, or personal data.
36
-
37
- ---
38
-
39
- ## βš™οΈ How it works
40
-
41
- This tool acts as a "translation layer" between the Claude CLI and ChatGPT's Codex backend.
42
-
43
- 1. **Intercept**: Claude Code CLI sends a request to `localhost:8081` (thinking it's Anthropic's API).
44
- 2. **Translate**: The proxy converts the Anthropic-format JSON into the specific payload format required by ChatGPT's internal Codex API.
45
- 3. **Forward**: The request is sent securely to ChatGPT using your own authenticated session.
46
- 4. **Stream**: The response from ChatGPT is converted back into Anthropic's Server-Sent Events (SSE) format and streamed to your terminal.
47
-
48
- ```
49
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
50
- β”‚ Claude Code │────▢│ This Proxy Server │────▢│ ChatGPT Codex Backend API β”‚
51
- β”‚ (Anthropic API) β”‚ β”‚ (Anthropic ⇄ OpenAI)β”‚ β”‚ (codex/responses) β”‚
52
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
53
- ```
54
-
55
- ---
56
-
57
- ## οΏ½πŸ“¦ Installation
58
-
59
- You don't need to install anything if you just want to run it:
60
-
61
- ```bash
62
- # Run directly with npx
63
- npx claude-codex-proxy@latest start
64
- ```
65
-
66
- Or install globally to use the CLI commands anywhere:
67
-
68
- ```bash
69
- npm install -g claude-codex-proxy
70
- claude-codex-proxy start
71
- ```
72
-
73
- ---
74
-
75
- ## βœ… Recommended Claude Code Version
76
-
77
- Recommended Claude Code CLI versions:
78
-
79
- - `2.1.79`
80
- - `2.1.88`
81
-
82
- Other versions may work, but these versions are recommended for better compatibility with this proxy.
83
-
84
- ---
85
-
86
- ## 🚦 Quick Start
87
-
88
- ### 1. Start the Proxy
89
-
90
- ```bash
91
- npx claude-codex-proxy@latest start
92
- ```
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
- ```
109
-
110
- ### 2. Add Your Account
111
-
112
- #### **Option A: Web Dashboard (Local Desktop)**
113
-
114
- 1. Open the dashboard at **[http://localhost:8081](http://localhost:8081)**
115
- 2. Go to the **Accounts** tab
116
- 3. Click **Add Account** and login with your ChatGPT account
117
-
118
- #### **Option B: CLI (Desktop or Headless/VM)**
119
-
120
- ```bash
121
- # Desktop (opens browser)
122
- claude-codex-proxy accounts add
123
-
124
- # Headless/VM server (manual code input)
125
- claude-codex-proxy accounts add --no-browser
126
- ```
127
-
128
- For **headless/VM servers** without a browser:
129
- 1. Run the command with `--no-browser`
130
- 2. It will print a URL - copy and open it on a device with a browser
131
- 3. Complete login on that device
132
- 4. After redirect, copy the callback URL (or just the code)
133
- 5. Paste it back in the terminal
134
-
135
- ### 3. Configure Claude Code
136
- Run this command to configure your `claude` CLI to use the proxy:
137
- ```bash
138
- curl -X POST http://localhost:8081/claude/config/proxy
139
- ```
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
-
155
- *Alternatively, set the environment variables manually:*
156
- ```bash
157
- export ANTHROPIC_BASE_URL=http://localhost:8081
158
- export ANTHROPIC_API_KEY=<client-api-key>
159
- ```
160
-
161
- To skip Claude Code's login/onboarding prompt, edit `~/.claude.json` and add:
162
- ```json
163
- {
164
- "hasCompletedOnboarding": true
165
- }
166
- ```
167
-
168
- 4. **Run Claude**:
169
- ```bash
170
- claude
171
- ```
172
-
173
- ---
174
-
175
- ## 🧠 Model Mapping
176
-
177
- The proxy resolves model names dynamically, so Claude Code can request Claude-style names while the proxy routes them to Codex models through your ChatGPT account.
178
-
179
- Default mapping:
180
-
181
- | Requested Model | Upstream Model | Auth Required | Description |
182
- | :--- | :--- | :---: | :--- |
183
- | `claude-*sonnet*` | `gpt-5.5` | βœ… | Uses the configured Sonnet-family Codex model. |
184
- | `claude-*opus*` | `gpt-5.5` | βœ… | Uses the configured Opus-family Codex model. |
185
- | `claude-*haiku*` | `gpt-5.4-mini` | βœ… | Uses the configured Haiku-family Codex model by default. |
186
- | `gpt-*` | unchanged | βœ… | Direct Codex model IDs pass through without remapping. |
187
- | unknown model | `gpt-5.5` | βœ… | Falls back to the configured default Codex model. |
188
-
189
- You can customize mappings from the Web Dashboard, go to the model settings, and choose the Codex model used for each Claude family.
190
-
191
- ---
192
-
193
- ## πŸ› οΈ Configuration & API
194
-
195
- ### Web Dashboard
196
- Visit `http://localhost:8081` to:
197
- - **Manage Accounts**: Add, remove, or switch active ChatGPT accounts.
198
- - **View Logs**: See real-time request/response logs for debugging.
199
- - **Test Models**: Run quick tests against the configured models.
200
- - **Configure Raw Proxy Payload Logs**: Enable detailed debugging logs from the Settings tab when you need to inspect raw Claude Code requests and upstream Codex payloads.
201
-
202
- ### Raw Proxy Payload Logs
203
- Raw payload logging is disabled by default because it may include prompts, tool results, file contents, and upstream response bodies. When enabled, the Logs tab captures:
204
-
205
- - `[Claude Request]`: the original Anthropic-compatible request body received from Claude Code.
206
- - `[Client Request]`: the original OpenAI Chat Completions-compatible request body, when using `/v1/chat/completions`.
207
- - `[OpenAI Request]`: the converted payload sent to the ChatGPT Codex Responses API.
208
- - `[OpenAI Response Completed]`: the completed upstream response object.
209
- - `[OpenAI Error]`: non-2xx upstream status and error body.
210
-
211
- You can enable it from the Web Dashboard under **Settings β†’ Raw Proxy Payload Logs**, or via API:
212
-
213
- ```bash
214
- curl -X POST http://localhost:8081/settings/raw-proxy-logs \
215
- -H "Content-Type: application/json" \
216
- -H "Authorization: Bearer <ui-admin-key>" \
217
- -d '{"enabled":true}'
218
- ```
219
-
220
- Disable it again with:
221
-
222
- ```bash
223
- curl -X POST http://localhost:8081/settings/raw-proxy-logs \
224
- -H "Content-Type: application/json" \
225
- -H "Authorization: Bearer <ui-admin-key>" \
226
- -d '{"enabled":false}'
227
- ```
228
-
229
- Check the current state:
230
-
231
- ```bash
232
- curl http://localhost:8081/settings/raw-proxy-logs \
233
- -H "Authorization: Bearer <ui-admin-key>"
234
- ```
235
-
236
- Authentication headers and access tokens are not logged.
237
-
238
- ### API Endpoints
239
- - `GET /health`: Check server status.
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.
243
-
244
- See [API Documentation](./docs/API.md) for full details.
245
-
246
- ---
247
-
248
- ## 🀝 Contributing
249
-
250
- Contributions are welcome! Please feel free to submit a Pull Request.
251
-
252
- 1. Fork the repository
253
- 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
254
- 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
255
- 4. Push to the branch (`git push origin feature/AmazingFeature`)
256
- 5. Open a Pull Request
257
-
258
- ---
259
-
260
- ## πŸ“„ License
261
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
262
-
263
- ## ⚠️ Disclaimer
264
- This project is an independent open-source tool and is not affiliated with, endorsed by, or sponsored by Anthropic or OpenAI. "Claude" is a trademark of Anthropic PBC. "ChatGPT" and "Codex" are trademarks of OpenAI. Use responsibly and in accordance with applicable Terms of Service.
265
-
266
- ---
267
-
268
- <div align="center">
269
- <p>If you find this project useful, please give it a star! ⭐️</p>
270
- <a href="https://github.com/zzy-life/claude-codex-proxy">
271
- <img src="https://img.shields.io/github/stars/zzy-life/claude-codex-proxy?style=social" alt="Star on GitHub">
272
- </a>
273
- </div>
package/bin/cli.js CHANGED
@@ -38,13 +38,21 @@ COMMANDS:
38
38
  OPTIONS:
39
39
  --help, -h Show this help message
40
40
  --version, -v Show version number
41
+ --mode <local|public> Deployment mode for the start command
42
+ --admin-key <key> UI/admin access key for public deployment
43
+ --admin-path <path> Management UI path prefix (default: /admin)
41
44
 
42
45
  ENVIRONMENT:
43
46
  PORT Server port (default: 8081)
47
+ PROXY_DEPLOYMENT_MODE Deployment mode (local or public)
48
+ PROXY_ADMIN_KEY UI/admin access key for public deployment
49
+ PROXY_ADMIN_PATH Management UI path prefix (default: /admin)
44
50
 
45
51
  EXAMPLES:
46
52
  claude-codex-proxy start
47
53
  PORT=3000 claude-codex-proxy start
54
+ claude-codex-proxy start --mode public --admin-key "your-admin-key" --admin-path /console-7f3a9d2c
55
+ PROXY_DEPLOYMENT_MODE=public PROXY_ADMIN_KEY="your-admin-key" PROXY_ADMIN_PATH=/console-7f3a9d2c claude-codex-proxy start
48
56
  claude-codex-proxy accounts add
49
57
  claude-codex-proxy accounts add --no-browser
50
58
  claude-codex-proxy accounts list
@@ -101,12 +109,39 @@ async function askRequiredKey(label) {
101
109
  }
102
110
  }
103
111
 
112
+ /**
113
+ * Reads an option value from either `--option value` or `--option=value`.
114
+ * @param {string} option
115
+ * @returns {string|undefined}
116
+ */
117
+ function getOptionValue(option) {
118
+ const optionIndex = args.indexOf(option);
119
+ if (optionIndex !== -1) {
120
+ return args[optionIndex + 1];
121
+ }
122
+
123
+ const prefixedOption = `${option}=`;
124
+ const matchedOption = args.find((arg) => arg.startsWith(prefixedOption));
125
+ return matchedOption?.slice(prefixedOption.length);
126
+ }
127
+
104
128
  async function configureStartMode() {
105
- const mode = await askDeploymentMode();
129
+ const adminPath = getOptionValue('--admin-path');
130
+ if (adminPath !== undefined) {
131
+ process.env.PROXY_ADMIN_PATH = adminPath;
132
+ }
133
+
134
+ const requestedMode = getOptionValue('--mode') || process.env.PROXY_DEPLOYMENT_MODE;
135
+ if (requestedMode && !['local', 'public'].includes(requestedMode)) {
136
+ throw new Error('Deployment mode must be "local" or "public".');
137
+ }
138
+
139
+ const mode = requestedMode || await askDeploymentMode();
106
140
  process.env.PROXY_DEPLOYMENT_MODE = mode;
107
141
 
108
142
  if (mode === 'public') {
109
- process.env.PROXY_ADMIN_KEY = await askRequiredKey('Enter UI/admin access key');
143
+ const adminKey = getOptionValue('--admin-key') || process.env.PROXY_ADMIN_KEY;
144
+ process.env.PROXY_ADMIN_KEY = adminKey || await askRequiredKey('Enter UI/admin access key');
110
145
  }
111
146
  }
112
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-codex-proxy",
3
- "version": "1.0.5-beta.2",
3
+ "version": "1.0.5-beta.21",
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",
@@ -67,23 +67,97 @@ body::before {
67
67
 
68
68
  .shadow-neon-purple { --tw-shadow-color: rgba(168, 85, 247, 0.4); box-shadow: 0 0 15px var(--tw-shadow-color); }
69
69
 
70
- .nav-item {
71
- background: transparent;
72
- color: #9ca3af;
73
- border-right: 2px solid transparent;
70
+ .sidebar-content {
71
+ padding: 1.25rem 0.75rem;
74
72
  }
75
73
 
76
- .nav-item.active {
77
- background: rgba(168, 85, 247, 0.1);
74
+ .sidebar-brand {
75
+ display: flex;
76
+ align-items: center;
77
+ gap: 0.75rem;
78
+ margin: 0 0.5rem 1.75rem;
79
+ padding: 0.5rem;
80
+ }
81
+
82
+ .sidebar-brand-mark {
83
+ display: grid;
84
+ width: 2.25rem;
85
+ height: 2.25rem;
86
+ place-items: center;
87
+ border: 1px solid rgba(192, 132, 252, 0.4);
88
+ border-radius: 0.65rem;
89
+ background: linear-gradient(135deg, rgba(168, 85, 247, 0.95), rgba(37, 99, 235, 0.9));
90
+ box-shadow: 0 0 18px rgba(168, 85, 247, 0.28);
78
91
  color: white;
79
- border-right: 2px solid var(--color-neon-purple);
92
+ font-size: 0.7rem;
93
+ font-weight: 700;
94
+ letter-spacing: 0.08em;
95
+ }
96
+
97
+ .sidebar-brand-title { color: #f5f3ff; font-size: 0.875rem; font-weight: 600; }
98
+ .sidebar-brand-subtitle { margin-top: 0.125rem; color: #6b7280; font-family: 'JetBrains Mono', monospace; font-size: 0.625rem; }
99
+
100
+ .sidebar-section-title {
101
+ margin: 1.25rem 0.75rem 0.5rem;
102
+ color: #64748b;
103
+ font-family: 'JetBrains Mono', monospace;
104
+ font-size: 0.625rem;
105
+ font-weight: 600;
106
+ letter-spacing: 0.12em;
107
+ text-transform: uppercase;
108
+ }
109
+
110
+ .sidebar-section-title:first-of-type { margin-top: 0; }
111
+ .sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
112
+
113
+ .nav-item {
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 0.75rem;
117
+ min-height: 2.75rem;
118
+ padding: 0.625rem 0.75rem;
119
+ border: 1px solid transparent;
120
+ border-radius: 0.5rem;
121
+ color: #94a3b8;
122
+ font-size: 0.8125rem;
123
+ font-weight: 500;
124
+ text-decoration: none;
125
+ transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
80
126
  }
81
127
 
128
+ .nav-item svg { width: 1.125rem; height: 1.125rem; flex: 0 0 auto; color: #64748b; }
129
+
82
130
  .nav-item:hover {
83
- background: rgba(255, 255, 255, 0.05);
84
- color: white;
131
+ background: rgba(255, 255, 255, 0.045);
132
+ color: #f8fafc;
133
+ transform: translateX(2px);
85
134
  }
86
135
 
136
+ .nav-item:hover svg { color: #c4b5fd; }
137
+
138
+ .nav-item.active {
139
+ border-color: rgba(168, 85, 247, 0.2);
140
+ background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.055));
141
+ box-shadow: inset 3px 0 0 var(--color-neon-purple);
142
+ color: #fff;
143
+ }
144
+
145
+ .nav-item.active svg { color: #c084fc; }
146
+
147
+ .sidebar-footer {
148
+ display: flex;
149
+ align-items: center;
150
+ gap: 0.5rem;
151
+ margin: auto 0.75rem 0.25rem;
152
+ padding-top: 1rem;
153
+ border-top: 1px solid rgba(42, 42, 62, 0.72);
154
+ color: #64748b;
155
+ font-family: 'JetBrains Mono', monospace;
156
+ font-size: 0.625rem;
157
+ }
158
+
159
+ .sidebar-status-dot { width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: var(--color-neon-green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.65); }
160
+
87
161
  .view-container {
88
162
  padding: 1.5rem;
89
163
  max-width: 1400px;
@@ -322,6 +396,133 @@ table .btn-outline:hover {
322
396
  color: white;
323
397
  }
324
398
 
399
+ .client-keys-panel {
400
+ overflow: hidden;
401
+ border: 1px solid rgba(42, 42, 62, 0.72);
402
+ border-radius: 0.875rem;
403
+ background: rgba(12, 12, 20, 0.72);
404
+ box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
405
+ }
406
+
407
+ .client-keys-toolbar {
408
+ display: flex;
409
+ align-items: center;
410
+ justify-content: space-between;
411
+ gap: 1.5rem;
412
+ padding: 1.25rem 1.5rem;
413
+ border-bottom: 1px solid rgba(42, 42, 62, 0.55);
414
+ }
415
+
416
+ .client-keys-toolbar h2 { color: #f8fafc; font-size: 0.9375rem; font-weight: 600; }
417
+ .client-keys-toolbar p { margin-top: 0.25rem; color: #64748b; font-size: 0.75rem; }
418
+ .client-keys-toolbar-actions { display: flex; align-items: center; gap: 1rem; }
419
+
420
+ .client-keys-reset { display: flex; align-items: center; gap: 0.625rem; color: #64748b; }
421
+ .client-keys-reset svg { width: 1rem; height: 1rem; color: #8b5cf6; }
422
+ .client-keys-reset div { display: flex; flex-direction: column; gap: 0.125rem; }
423
+ .client-keys-reset span { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
424
+ .client-keys-reset strong { color: #a1a1aa; font-family: 'JetBrains Mono', monospace; font-size: 0.6875rem; font-weight: 500; }
425
+
426
+ .client-keys-new {
427
+ display: inline-flex;
428
+ align-items: center;
429
+ gap: 0.5rem;
430
+ padding: 0.55rem 0.9rem;
431
+ border: 1px solid rgba(168, 85, 247, 0.65);
432
+ border-radius: 0.5rem;
433
+ background: linear-gradient(135deg, #9333ea, #7c3aed);
434
+ box-shadow: 0 8px 20px rgba(126, 34, 206, 0.22);
435
+ color: #fff;
436
+ font-size: 0.75rem;
437
+ font-weight: 600;
438
+ cursor: pointer;
439
+ }
440
+ .client-keys-new:hover { background: linear-gradient(135deg, #a855f7, #8b5cf6); }
441
+ .client-keys-new span { font-size: 1rem; font-weight: 400; line-height: 1; }
442
+
443
+ .client-keys-list { padding: 0.75rem; }
444
+ .client-key-card {
445
+ display: grid;
446
+ grid-template-columns: minmax(270px, 1.45fr) minmax(230px, 1.15fr) 130px 110px auto;
447
+ align-items: center;
448
+ gap: 1.5rem;
449
+ padding: 1.1rem 1rem;
450
+ border: 1px solid transparent;
451
+ border-radius: 0.7rem;
452
+ transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
453
+ }
454
+ .client-key-card + .client-key-card { margin-top: 0.375rem; }
455
+ .client-key-card:hover {
456
+ border-color: rgba(42, 42, 62, 0.72);
457
+ background: rgba(26, 26, 40, 0.48);
458
+ box-shadow: inset 3px 0 0 rgba(168, 85, 247, 0.72);
459
+ }
460
+
461
+ .client-key-identity { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
462
+ .client-key-icon { display: grid; width: 2.4rem; height: 2.4rem; flex: 0 0 auto; place-items: center; border: 1px solid rgba(168, 85, 247, 0.2); border-radius: 0.65rem; background: rgba(168, 85, 247, 0.08); color: #c084fc; }
463
+ .client-key-icon svg { width: 1.15rem; height: 1.15rem; }
464
+ .client-key-fields { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(100px, 0.85fr); gap: 0.625rem; min-width: 0; }
465
+ .client-key-fields label, .client-key-limit { display: block; min-width: 0; }
466
+ .client-key-fields label > span, .client-key-limit > span, .client-key-meta > span, .client-key-quota-heading > span { display: block; margin-bottom: 0.35rem; color: #64748b; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
467
+ .client-key-fields input, .client-key-limit input {
468
+ width: 100%;
469
+ height: 2.15rem;
470
+ border: 1px solid rgba(42, 42, 62, 0.75);
471
+ border-radius: 0.45rem;
472
+ outline: none;
473
+ background: rgba(15, 15, 26, 0.62);
474
+ color: #e5e7eb;
475
+ font-size: 0.75rem;
476
+ transition: border-color 150ms ease, background-color 150ms ease;
477
+ }
478
+ .client-key-fields input { padding: 0 0.7rem; }
479
+ .client-key-fields input:focus, .client-key-limit input:focus { border-color: rgba(168, 85, 247, 0.72); background: rgba(26, 26, 40, 0.9); }
480
+
481
+ .client-key-quota-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
482
+ .client-key-quota-heading strong { color: #f8fafc; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
483
+ .client-key-quota-heading small { color: #64748b; font-size: 0.6875rem; font-weight: 400; }
484
+ .client-key-progress { overflow: hidden; height: 0.35rem; border-radius: 999px; background: rgba(42, 42, 62, 0.72); }
485
+ .client-key-progress i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6, #22d3ee); box-shadow: 0 0 10px rgba(34, 211, 238, 0.25); }
486
+ .client-key-quota-foot { display: flex; justify-content: space-between; margin-top: 0.4rem; color: #64748b; font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; }
487
+
488
+ .client-key-limit > div { display: flex; height: 2.15rem; border: 1px solid rgba(42, 42, 62, 0.75); border-radius: 0.45rem; background: rgba(15, 15, 26, 0.62); }
489
+ .client-key-limit b { display: grid; width: 1.9rem; place-items: center; border-right: 1px solid rgba(42, 42, 62, 0.75); color: #64748b; font-size: 0.75rem; font-weight: 500; }
490
+ .client-key-limit input { height: auto; padding: 0 0.55rem; border: 0; background: transparent; font-family: 'JetBrains Mono', monospace; }
491
+
492
+ .client-key-meta strong, .client-key-meta small { display: block; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
493
+ .client-key-meta strong { color: #a1a1aa; font-size: 0.6875rem; font-weight: 500; }
494
+ .client-key-meta small { margin-top: 0.2rem; color: #52525b; font-size: 0.625rem; }
495
+ .client-key-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; }
496
+ .client-key-save, .client-key-delete { height: 2.15rem; border-radius: 0.45rem; cursor: pointer; transition: all 150ms ease; }
497
+ .client-key-save { padding: 0 0.75rem; border: 1px solid rgba(168, 85, 247, 0.35); background: rgba(168, 85, 247, 0.1); color: #d8b4fe; font-size: 0.6875rem; font-weight: 600; white-space: nowrap; }
498
+ .client-key-save:hover { border-color: rgba(168, 85, 247, 0.65); background: rgba(168, 85, 247, 0.2); color: #fff; }
499
+ .client-key-delete { display: grid; width: 2.15rem; place-items: center; border: 1px solid transparent; background: transparent; color: #52525b; }
500
+ .client-key-delete svg { width: 1rem; height: 1rem; }
501
+ .client-key-delete:hover { border-color: rgba(239, 68, 68, 0.2); background: rgba(239, 68, 68, 0.08); color: #f87171; }
502
+ .client-key-save:disabled, .client-key-delete:disabled { opacity: 0.45; cursor: not-allowed; }
503
+ .client-keys-empty { padding: 4rem 1.5rem; color: #64748b; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; text-align: center; }
504
+
505
+ @media (max-width: 1100px) {
506
+ .client-key-card { grid-template-columns: minmax(260px, 1.3fr) minmax(220px, 1fr) 120px auto; }
507
+ .client-key-meta { display: none; }
508
+ }
509
+
510
+ @media (max-width: 800px) {
511
+ .client-keys-toolbar { align-items: flex-start; }
512
+ .client-keys-toolbar-actions { align-items: flex-end; flex-direction: column-reverse; }
513
+ .client-key-card { grid-template-columns: 1fr; gap: 1rem; }
514
+ .client-key-fields { width: 100%; }
515
+ .client-key-actions { justify-content: flex-start; }
516
+ .client-key-save { flex: 1; }
517
+ }
518
+
519
+ @media (max-width: 560px) {
520
+ .client-keys-toolbar { flex-direction: column; }
521
+ .client-keys-toolbar-actions { width: 100%; align-items: stretch; }
522
+ .client-keys-new { justify-content: center; }
523
+ .client-key-fields { grid-template-columns: 1fr; }
524
+ }
525
+
325
526
  .animate-spin {
326
527
  animation: spin 1s linear infinite;
327
528
  }