@pikoloo/codex-proxy 1.0.6 → 1.0.7
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 +12 -5
- package/images/dashboard-screenshot.png +0 -0
- package/images/readme-cover.png +0 -0
- package/images/settings-screenshot.png +0 -0
- package/package.json +2 -1
- package/public/css/style.css +247 -0
- package/public/index.html +311 -15
- package/public/js/app.js +275 -14
- package/src/format-converter.js +5 -1
- package/src/index.js +1 -1
- package/src/model-mapper.js +145 -22
- package/src/routes/api-routes.js +21 -1
- package/src/routes/chat-route.js +76 -3
- package/src/routes/messages-route.js +175 -5
- package/src/routes/metrics-route.js +43 -0
- package/src/routes/settings-route.js +148 -2
- package/src/security.js +2 -1
- package/src/server-settings.js +40 -4
- package/src/server.js +27 -2
- package/src/usage-metrics.js +472 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Codex Claude Proxy
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
|
-
_Current
|
|
5
|
+
_Current README cover: a short, thumbgen-style composite generated from fresh local dashboard screenshots._
|
|
6
6
|
|
|
7
7
|
[](https://choosealicense.com/licenses/mit/)
|
|
8
8
|
[](https://nodejs.org/)
|
|
@@ -25,7 +25,7 @@ _Current dashboard preview: a real capture of the local Web UI with the macOS-st
|
|
|
25
25
|
- **Seamless Translation**: Translates Anthropic Messages API calls to ChatGPT Codex format.
|
|
26
26
|
- **Model Mapping**: maps Claude model aliases to current OpenAI models, with direct GPT model IDs passed through.
|
|
27
27
|
- **Personal Account Mode**: Uses the active ChatGPT account by default for local-only personal use, with account switching and auto-refresh.
|
|
28
|
-
- **Web Dashboard**: Built-in macOS-style UI (`http://localhost:8081`) for managing accounts, viewing logs, adjusting settings, and testing prompts.
|
|
28
|
+
- **Web Dashboard**: Built-in macOS-style UI (`http://localhost:8081`) for managing accounts, configuring Claude Code, viewing logs, adjusting settings, and testing prompts.
|
|
29
29
|
- **Streaming Support**: Full Server-Sent Events (SSE) support for real-time responses.
|
|
30
30
|
- **Native Tool Calling**: Supports Claude's tool use capabilities by translating them to Codex function calls.
|
|
31
31
|
|
|
@@ -118,7 +118,9 @@ For **headless/VM servers** without a browser:
|
|
|
118
118
|
5. Paste it back in the terminal
|
|
119
119
|
|
|
120
120
|
### 3. Configure Claude Code
|
|
121
|
-
|
|
121
|
+
In the dashboard, click **Configure Claude Code** to write the proxy settings into Claude Code. Enable **Configure on startup** if you want the proxy to keep Claude Code pointed at the local server whenever it starts.
|
|
122
|
+
|
|
123
|
+
You can also run this command:
|
|
122
124
|
```bash
|
|
123
125
|
curl -X POST http://localhost:8081/claude/config/proxy
|
|
124
126
|
```
|
|
@@ -154,11 +156,16 @@ The proxy automatically maps Claude model names to current OpenAI backend models
|
|
|
154
156
|
|
|
155
157
|
### Web Dashboard
|
|
156
158
|
|
|
157
|
-
The dashboard uses a clean desktop split-view layout with a compact toolbar, native-feeling glass surfaces, account management, live logs, settings, and prompt test panels. The
|
|
159
|
+
The dashboard uses a clean desktop split-view layout with a compact toolbar, native-feeling glass surfaces, account management, live logs, settings, Claude Code configuration, and prompt test panels. The screenshots below are captured from the actual local app.
|
|
160
|
+
|
|
161
|
+
| Dashboard | Settings |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
|  |  |
|
|
158
164
|
|
|
159
165
|
Visit `http://localhost:8081` to:
|
|
160
166
|
- **Manage Accounts**: Add, remove, or switch active ChatGPT accounts.
|
|
161
167
|
- **Personal Mode**: Requests use the active account only unless multi-account rotation is explicitly enabled by environment variable.
|
|
168
|
+
- **Configure Claude Code**: Use the dashboard button to set `ANTHROPIC_BASE_URL`, `ANTHROPIC_API_KEY`, and Claude model defaults, or enable the startup toggle to do it automatically.
|
|
162
169
|
- **View Logs**: See real-time request/response logs for debugging.
|
|
163
170
|
- **Test Models**: Run quick tests against the configured models.
|
|
164
171
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikoloo/codex-proxy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Local personal proxy for OpenAI Codex models with Claude API compatibility",
|
|
5
5
|
"author": "Suraj Mandal <surajmandalcell@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"test:ui": "node --test tests/ui.test.js"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"@duckdb/node-api": "^1.5.3-r.1",
|
|
51
52
|
"alpinejs": "3.15.12",
|
|
52
53
|
"cors": "^2.8.5",
|
|
53
54
|
"express": "^4.18.2"
|
package/public/css/style.css
CHANGED
|
@@ -251,6 +251,63 @@ select:focus {
|
|
|
251
251
|
border-color: var(--color-neon-purple);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
.model-mapping-list {
|
|
255
|
+
display: grid;
|
|
256
|
+
gap: 0.75rem;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.model-mapping-row {
|
|
260
|
+
display: grid;
|
|
261
|
+
grid-template-columns: minmax(0, 1fr) minmax(22rem, 32rem);
|
|
262
|
+
align-items: center;
|
|
263
|
+
gap: 1rem;
|
|
264
|
+
padding: 1rem;
|
|
265
|
+
border: 1px solid rgba(36, 41, 47, 0.16);
|
|
266
|
+
border-radius: 0.625rem;
|
|
267
|
+
background: rgba(255, 255, 255, 0.42);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.model-mapping-copy {
|
|
271
|
+
min-width: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.model-mapping-controls {
|
|
275
|
+
display: grid;
|
|
276
|
+
grid-template-columns: minmax(13rem, 1fr) minmax(9rem, 0.72fr);
|
|
277
|
+
gap: 0.75rem;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.model-mapping-field {
|
|
281
|
+
display: grid;
|
|
282
|
+
gap: 0.35rem;
|
|
283
|
+
min-width: 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.model-mapping-field > span {
|
|
287
|
+
color: var(--text-faint);
|
|
288
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
289
|
+
font-size: 0.68rem;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.model-mapping-select {
|
|
293
|
+
width: 100%;
|
|
294
|
+
min-height: 2.25rem;
|
|
295
|
+
background-color: rgba(255, 255, 255, 0.82);
|
|
296
|
+
color: var(--text-strong);
|
|
297
|
+
color-scheme: light;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
@media (max-width: 700px) {
|
|
301
|
+
.model-mapping-row {
|
|
302
|
+
grid-template-columns: 1fr;
|
|
303
|
+
gap: 0.75rem;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.model-mapping-controls {
|
|
307
|
+
grid-template-columns: 1fr;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
254
311
|
dialog {
|
|
255
312
|
background: transparent;
|
|
256
313
|
color: #e5e7eb;
|
|
@@ -1367,6 +1424,196 @@ table .bg-gray-700,
|
|
|
1367
1424
|
color: var(--success);
|
|
1368
1425
|
}
|
|
1369
1426
|
|
|
1427
|
+
.nav-count {
|
|
1428
|
+
min-width: 2rem;
|
|
1429
|
+
padding: 0.12rem 0.4rem;
|
|
1430
|
+
border-radius: 999px;
|
|
1431
|
+
background: rgba(255, 255, 255, 0.6);
|
|
1432
|
+
border: 1px solid var(--glass-line);
|
|
1433
|
+
color: var(--text-muted);
|
|
1434
|
+
font-size: 0.68rem;
|
|
1435
|
+
line-height: 1.1;
|
|
1436
|
+
text-align: center;
|
|
1437
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
.metrics-range-controls {
|
|
1441
|
+
display: inline-flex;
|
|
1442
|
+
align-items: center;
|
|
1443
|
+
gap: 0.35rem;
|
|
1444
|
+
padding: 0.25rem;
|
|
1445
|
+
border: 1px solid var(--glass-line);
|
|
1446
|
+
border-radius: 10px;
|
|
1447
|
+
background: rgba(255, 255, 255, 0.56);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
.metrics-range-button {
|
|
1451
|
+
min-width: 2.6rem;
|
|
1452
|
+
padding: 0.38rem 0.65rem;
|
|
1453
|
+
border-radius: 7px;
|
|
1454
|
+
color: var(--text-muted);
|
|
1455
|
+
font-size: 0.76rem;
|
|
1456
|
+
font-weight: 600;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
.metrics-range-button.active {
|
|
1460
|
+
color: var(--text-strong);
|
|
1461
|
+
background: rgba(255, 255, 255, 0.9);
|
|
1462
|
+
box-shadow: 0 1px 2px rgba(31, 35, 40, 0.08);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
.metrics-grid {
|
|
1466
|
+
display: grid;
|
|
1467
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1468
|
+
gap: 1.25rem;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
@media (min-width: 980px) {
|
|
1472
|
+
.metrics-grid {
|
|
1473
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
.metrics-panel {
|
|
1478
|
+
min-width: 0;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
.metrics-panel-header,
|
|
1482
|
+
.metrics-table-toolbar {
|
|
1483
|
+
display: flex;
|
|
1484
|
+
align-items: center;
|
|
1485
|
+
justify-content: space-between;
|
|
1486
|
+
gap: 1rem;
|
|
1487
|
+
margin-bottom: 1rem;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
.metrics-table-toolbar {
|
|
1491
|
+
margin: 0;
|
|
1492
|
+
padding: 1rem 1.25rem;
|
|
1493
|
+
border-bottom: 1px solid var(--glass-line);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
.metrics-panel-header h3,
|
|
1497
|
+
.metrics-table-toolbar h3 {
|
|
1498
|
+
color: var(--text-strong);
|
|
1499
|
+
font-size: 0.78rem;
|
|
1500
|
+
font-weight: 700;
|
|
1501
|
+
letter-spacing: 0.06em;
|
|
1502
|
+
text-transform: uppercase;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
.metrics-muted {
|
|
1506
|
+
color: var(--text-faint);
|
|
1507
|
+
font-size: 0.72rem;
|
|
1508
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
.metrics-timeline,
|
|
1512
|
+
.metrics-list {
|
|
1513
|
+
display: grid;
|
|
1514
|
+
gap: 0.65rem;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
.metrics-timeline-row,
|
|
1518
|
+
.metrics-breakdown-row {
|
|
1519
|
+
display: grid;
|
|
1520
|
+
grid-template-columns: minmax(8rem, 0.65fr) minmax(0, 1fr) auto;
|
|
1521
|
+
align-items: center;
|
|
1522
|
+
gap: 0.75rem;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.metrics-breakdown-row {
|
|
1526
|
+
grid-template-columns: minmax(8rem, 0.9fr) minmax(12rem, 1fr);
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
.metrics-breakdown-meter {
|
|
1530
|
+
display: grid;
|
|
1531
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
1532
|
+
align-items: center;
|
|
1533
|
+
gap: 0.75rem;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
.metrics-timeline-label,
|
|
1537
|
+
.metrics-breakdown-title,
|
|
1538
|
+
.metrics-value {
|
|
1539
|
+
min-width: 0;
|
|
1540
|
+
color: var(--text-body);
|
|
1541
|
+
font-size: 0.75rem;
|
|
1542
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
1543
|
+
overflow: hidden;
|
|
1544
|
+
text-overflow: ellipsis;
|
|
1545
|
+
white-space: nowrap;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
.metrics-value {
|
|
1549
|
+
color: var(--text-muted);
|
|
1550
|
+
text-align: right;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
.metrics-bar-track {
|
|
1554
|
+
height: 0.48rem;
|
|
1555
|
+
overflow: hidden;
|
|
1556
|
+
border-radius: 999px;
|
|
1557
|
+
background: rgba(36, 41, 47, 0.12);
|
|
1558
|
+
border: 1px solid var(--glass-line);
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
.metrics-bar-fill {
|
|
1562
|
+
height: 100%;
|
|
1563
|
+
min-width: 0.25rem;
|
|
1564
|
+
border-radius: inherit;
|
|
1565
|
+
background: linear-gradient(90deg, var(--accent), #22c55e);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
.metrics-storage-warning {
|
|
1569
|
+
display: flex;
|
|
1570
|
+
align-items: center;
|
|
1571
|
+
justify-content: space-between;
|
|
1572
|
+
gap: 1rem;
|
|
1573
|
+
padding: 1rem;
|
|
1574
|
+
border-radius: 10px;
|
|
1575
|
+
border: 1px solid rgba(239, 68, 68, 0.25);
|
|
1576
|
+
background: rgba(239, 68, 68, 0.1);
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
.metrics-empty {
|
|
1580
|
+
padding: 1.25rem;
|
|
1581
|
+
border: 1px dashed var(--glass-line);
|
|
1582
|
+
border-radius: 10px;
|
|
1583
|
+
color: var(--text-faint);
|
|
1584
|
+
text-align: center;
|
|
1585
|
+
font-size: 0.82rem;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.metrics-status {
|
|
1589
|
+
display: inline-flex;
|
|
1590
|
+
min-width: 3rem;
|
|
1591
|
+
justify-content: center;
|
|
1592
|
+
padding: 0.22rem 0.45rem;
|
|
1593
|
+
border-radius: 999px;
|
|
1594
|
+
font-size: 0.72rem;
|
|
1595
|
+
font-weight: 700;
|
|
1596
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
.metrics-status-success {
|
|
1600
|
+
color: #047857;
|
|
1601
|
+
background: rgba(16, 185, 129, 0.12);
|
|
1602
|
+
border: 1px solid rgba(16, 185, 129, 0.2);
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
.metrics-status-error {
|
|
1606
|
+
color: #b91c1c;
|
|
1607
|
+
background: rgba(239, 68, 68, 0.12);
|
|
1608
|
+
border: 1px solid rgba(239, 68, 68, 0.22);
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
.metrics-status-muted {
|
|
1612
|
+
color: var(--text-muted);
|
|
1613
|
+
background: rgba(36, 41, 47, 0.08);
|
|
1614
|
+
border: 1px solid var(--glass-line);
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1370
1617
|
.alert {
|
|
1371
1618
|
background-color: rgba(255, 255, 255, 0.86);
|
|
1372
1619
|
border-color: var(--glass-line);
|