claude-codex-proxy 1.0.5-beta.1 → 1.0.5-beta.10

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.
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="codex" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Sign in · Claude Codex Proxy</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
8
+ <link rel="stylesheet" href="/css/style.css">
9
+ </head>
10
+ <body class="bg-space-950 text-gray-300 font-sans antialiased min-h-screen" x-data="app" x-init="init()">
11
+ <main x-cloak x-show="authChecked" class="min-h-screen flex items-center justify-center px-4">
12
+ <div class="w-full max-w-md bg-space-900/70 border border-space-border rounded-2xl p-6 shadow-2xl backdrop-blur-md">
13
+ <div class="flex items-center gap-3 mb-6">
14
+ <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>
15
+ <div>
16
+ <h1 class="text-xl font-bold text-white">Access Required</h1>
17
+ <p class="text-sm text-gray-500">Enter the server access key to open the management UI.</p>
18
+ </div>
19
+ </div>
20
+ <form @submit.prevent="login" class="space-y-4">
21
+ <label class="form-control w-full">
22
+ <span class="label-text text-gray-400 mb-1">Access Key</span>
23
+ <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" autofocus>
24
+ </label>
25
+ <p x-show="loginError" x-text="loginError" class="text-sm text-red-400"></p>
26
+ <button type="submit" class="btn w-full bg-neon-purple hover:bg-purple-600 border-0 text-white">Unlock UI</button>
27
+ </form>
28
+ </div>
29
+ </main>
30
+ <script src="/js/app.js"></script>
31
+ </body>
32
+ </html>
@@ -0,0 +1,159 @@
1
+ <div x-show="showAddModal" x-transition class="fixed inset-0 z-50 flex items-center justify-center p-4" style="display: none;">
2
+ <div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="showAddModal = false"></div>
3
+ <div class="relative bg-space-900 border border-space-border rounded-xl shadow-2xl max-w-md w-full p-6">
4
+ <h3 class="font-bold text-lg text-white mb-4">Add New Account</h3>
5
+
6
+ <template x-if="!oauthManualMode">
7
+ <div>
8
+ <p class="text-sm text-gray-400 mb-6">Connect a ChatGPT account to use with the proxy. The account will be used for API calls.</p>
9
+
10
+ <div class="flex flex-col gap-3">
11
+ <button class="btn bg-neon-purple hover:bg-purple-600 border-none text-white btn-sm gap-3 h-11"
12
+ @click="startOAuth()">
13
+ <svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
14
+ <path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"></path>
15
+ <path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"></path>
16
+ <path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"></path>
17
+ <path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"></path>
18
+ </svg>
19
+ <span>Connect via OAuth</span>
20
+ </button>
21
+
22
+ <div class="text-center">
23
+ <span class="text-xs text-gray-500">or</span>
24
+ </div>
25
+
26
+ <button class="btn btn-outline btn-sm text-gray-400 hover:text-white gap-2"
27
+ @click="startManualOAuth()">
28
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
29
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
30
+ </svg>
31
+ <span>Manual Authorization (Headless)</span>
32
+ </button>
33
+
34
+ <div class="text-center">
35
+ <span class="text-xs text-gray-500">or</span>
36
+ </div>
37
+
38
+ <button class="btn btn-outline btn-sm text-gray-400 hover:text-white gap-2"
39
+ @click="importFromCodex()">
40
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
41
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
42
+ </svg>
43
+ <span>Import from Codex App</span>
44
+ </button>
45
+ </div>
46
+
47
+ <div class="mt-6 flex justify-end">
48
+ <button class="btn btn-outline btn-sm text-gray-400" @click="showAddModal = false">Cancel</button>
49
+ </div>
50
+ </div>
51
+ </template>
52
+
53
+ <template x-if="oauthManualMode">
54
+ <div>
55
+ <p class="text-sm text-gray-400 mb-4">For headless servers without a browser:</p>
56
+
57
+ <div class="bg-space-800/50 border border-space-border/30 rounded-lg p-3 mb-4">
58
+ <p class="text-xs text-gray-500 mb-2">1. Open this URL on another device:</p>
59
+ <div class="flex items-center gap-2">
60
+ <input type="text" readonly :value="oauthManualUrl"
61
+ class="input flex-1 bg-space-700 border-space-border text-xs font-mono text-gray-300">
62
+ <button class="btn btn-xs btn-ghost text-gray-400" @click="copyToClipboard(oauthManualUrl)">
63
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
64
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
65
+ </svg>
66
+ </button>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="mb-4">
71
+ <p class="text-xs text-gray-500 mb-2">2. After authorizing, paste the callback URL or code:</p>
72
+ <input type="text" x-model="oauthManualCode"
73
+ placeholder="http://localhost:1455/auth/callback?code=... or just the code"
74
+ class="input w-full bg-space-800 border-space-border text-white font-mono text-sm">
75
+ </div>
76
+
77
+ <div class="flex justify-end gap-2">
78
+ <button class="btn btn-outline btn-sm text-gray-400" @click="oauthManualMode = false">Back</button>
79
+ <button class="btn bg-neon-purple hover:bg-purple-600 border-none text-white btn-sm"
80
+ @click="submitManualOAuth()" :disabled="!oauthManualCode">
81
+ Add Account
82
+ </button>
83
+ </div>
84
+ </div>
85
+ </template>
86
+ </div>
87
+ </div>
88
+
89
+ <div x-show="showDeleteModal" x-transition class="fixed inset-0 z-50 flex items-center justify-center p-4" style="display: none;">
90
+ <div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="showDeleteModal = false"></div>
91
+ <div class="relative bg-space-900 border-2 border-red-500/50 rounded-xl shadow-2xl max-w-md w-full p-6">
92
+ <h3 class="font-bold text-lg text-red-400 flex items-center gap-2 mb-4">
93
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
94
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
95
+ </svg>
96
+ <span>Delete Account</span>
97
+ </h3>
98
+ <p class="text-gray-300 mb-4">Are you sure you want to delete <strong class="text-white font-mono" x-text="deleteTarget"></strong>?</p>
99
+ <div class="bg-red-500/10 border border-red-500/30 rounded p-3 mb-4">
100
+ <p class="text-sm text-red-300">This action cannot be undone. All configuration will be permanently deleted.</p>
101
+ </div>
102
+ <div class="flex justify-end gap-2">
103
+ <button class="btn btn-outline btn-sm text-gray-400" @click="showDeleteModal = false">Cancel</button>
104
+ <button class="btn bg-red-500 hover:bg-red-600 border-none text-white btn-sm" @click="executeDelete()">
105
+ Delete
106
+ </button>
107
+ </div>
108
+ </div>
109
+ </div>
110
+
111
+ <div x-show="showQuotaModalView" x-transition class="fixed inset-0 z-50 flex items-center justify-center p-4" style="display: none;">
112
+ <div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="showQuotaModalView = false"></div>
113
+ <div class="relative bg-space-900 border border-space-border rounded-xl shadow-2xl max-w-lg w-full p-6">
114
+ <h3 class="font-bold text-lg text-white mb-2 flex items-center gap-2">
115
+ <svg class="w-6 h-6 text-neon-cyan" fill="none" stroke="currentColor" viewBox="0 0 24 24">
116
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
117
+ </svg>
118
+ <span>Quota Distribution</span>
119
+ </h3>
120
+ <p class="text-sm text-gray-500 font-mono mb-4" x-text="selectedAccount?.email"></p>
121
+
122
+ <div class="space-y-3 max-h-[60vh] overflow-y-auto" x-show="getRemainingPercentage(selectedAccount) !== null">
123
+ <div class="p-3 bg-space-800/50 border border-space-border/30 rounded-lg">
124
+ <div class="flex justify-between items-center mb-2">
125
+ <span class="text-sm font-semibold text-gray-200">Usage</span>
126
+ <template x-if="!isQuotaExhausted(selectedAccount)">
127
+ <span class="text-xs font-mono"
128
+ :class="quotaTextClass(selectedAccount)"
129
+ x-text="quotaLabel(selectedAccount) + ' remaining'"></span>
130
+ </template>
131
+ <template x-if="isQuotaExhausted(selectedAccount)">
132
+ <span class="text-[10px] font-bold uppercase text-red-400 bg-red-500/10 px-2 py-0.5 rounded border border-red-500/30">QUOTA EXHAUSTED</span>
133
+ </template>
134
+ </div>
135
+ <div class="w-full bg-gray-700 rounded-full h-3 overflow-hidden">
136
+ <div class="h-full rounded-full transition-all"
137
+ :class="quotaBarClass(selectedAccount)"
138
+ :style="`width: ${getRemainingPercentage(selectedAccount)}%`"></div>
139
+ </div>
140
+ <div class="mt-3 pt-3 border-t border-space-border/30 space-y-1">
141
+ <div class="flex items-center justify-between text-xs">
142
+ <span class="text-gray-500">Reset window</span>
143
+ <span class="font-mono text-gray-300" x-text="quotaResetSummary(selectedAccount) || '-'"></span>
144
+ </div>
145
+ <template x-if="quotaResetAtLabel(selectedAccount)">
146
+ <div class="flex items-center justify-between text-xs">
147
+ <span class="text-gray-500">Resets at</span>
148
+ <span class="font-mono text-gray-300" x-text="quotaResetAtLabel(selectedAccount)"></span>
149
+ </div>
150
+ </template>
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <div class="mt-6 flex justify-end">
156
+ <button class="btn btn-outline btn-sm text-gray-400" @click="showQuotaModalView = false">Close</button>
157
+ </div>
158
+ </div>
159
+ </div>
@@ -0,0 +1,183 @@
1
+ <div x-show="activeTab === 'accounts'" x-transition class="view-container">
2
+ <div class="flex items-center justify-between gap-4 mb-6">
3
+ <div class="flex flex-wrap items-center gap-4">
4
+ <h1 class="text-2xl font-bold text-white tracking-tight">Account Management</h1>
5
+ <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">
6
+ <span class="text-[10px] font-mono text-gray-400 uppercase tracking-wider">Manage ChatGPT accounts</span>
7
+ </div>
8
+ </div>
9
+
10
+ <div class="flex flex-wrap items-center justify-end gap-2 sm:flex-nowrap">
11
+ <div class="relative" x-show="accounts.length > 0">
12
+ <input type="text" x-model="searchQuery" placeholder="Search accounts..."
13
+ class="input-search-sm w-48 pl-9 h-8" @keydown.escape="searchQuery = ''">
14
+ <svg class="w-4 h-4 absolute left-3 top-2 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
15
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
16
+ </svg>
17
+ </div>
18
+
19
+ <button class="btn btn-xs btn-outline border-space-border text-gray-400 hover:text-white transition-all gap-2 h-8"
20
+ @click="refreshAllTokens()" x-show="accounts.length > 0">
21
+ <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
22
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"></path>
23
+ </svg>
24
+ <span>Refresh All</span>
25
+ </button>
26
+
27
+ <div class="flex items-center h-6 px-2 rounded bg-space-800/80 border border-space-border/50 sm:ml-1">
28
+ <span class="text-[11px] font-mono text-gray-400" x-text="accounts.length + ' accounts'"></span>
29
+ </div>
30
+
31
+ <button class="btn bg-neon-purple hover:bg-purple-600 border-none text-white btn-xs gap-2 shadow-lg shadow-neon-purple/20 h-8"
32
+ @click="showAddModal = true">
33
+ <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
34
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
35
+ </svg>
36
+ <span>Add Account</span>
37
+ </button>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="view-card !p-0 overflow-x-auto">
42
+ <table class="w-full min-w-[860px]">
43
+ <thead x-show="filteredAccounts.length > 0">
44
+ <tr class="bg-space-900/50 border-b border-space-border/50">
45
+ <th class="py-3 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider w-20">Status</th>
46
+ <th class="py-3 text-center text-[10px] font-bold text-gray-500 uppercase tracking-wider flex-1 min-w-[200px]">Account (Email)</th>
47
+ <th class="py-3 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider w-20">Plan</th>
48
+ <th class="py-3 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider w-32">Token</th>
49
+ <th class="py-3 text-left text-[10px] font-bold text-gray-500 uppercase tracking-wider w-24">Quota</th>
50
+ <th class="py-3 pr-6 text-right text-[10px] font-bold text-gray-500 uppercase tracking-wider w-40">Operations</th>
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ <template x-if="filteredAccounts.length === 0 && accounts.length === 0">
55
+ <tr>
56
+ <td colspan="6" class="py-16 text-center flex justify-center">
57
+ <div class="flex flex-col items-center gap-4 max-w-lg mx-auto">
58
+ <svg class="w-20 h-20 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">
59
+ <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" />
60
+ </svg>
61
+ <h3 class="text-xl font-semibold text-gray-400">No Accounts Yet</h3>
62
+ <p class="text-sm text-gray-600 max-w-md leading-relaxed">Get started by adding a ChatGPT account via OAuth, or import from the Codex app.</p>
63
+ <div class="flex items-center gap-4 mt-2">
64
+ <button class="btn bg-neon-purple hover:bg-purple-600 border-none text-white btn-sm gap-2 shadow-lg shadow-neon-purple/20"
65
+ @click="showAddModal = true">
66
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
67
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
68
+ </svg>
69
+ <span>Add Your First Account</span>
70
+ </button>
71
+ <span class="text-xs text-gray-600">or</span>
72
+ <button class="btn btn-outline btn-sm text-gray-400" @click="importFromCodex()">
73
+ Import from Codex
74
+ </button>
75
+ </div>
76
+ </div>
77
+ </td>
78
+ </tr>
79
+ </template>
80
+
81
+ <template x-for="acc in filteredAccounts" :key="acc.email">
82
+ <tr class="border-b border-space-border/30 last:border-0 hover:bg-white/5 transition-colors group">
83
+ <td class="py-4 pl-6">
84
+ <div class="flex items-center gap-2">
85
+ <div class="w-2 h-2 rounded-full flex-shrink-0"
86
+ :class="acc.isActive ? 'bg-neon-green shadow-[0_0_8px_rgba(34,197,94,0.6)] animate-pulse' : 'bg-gray-500'">
87
+ </div>
88
+ <span class="text-xs font-mono font-semibold"
89
+ :class="acc.isActive ? 'text-neon-green' : 'text-gray-500'"
90
+ x-text="acc.isActive ? 'ACTIVE' : 'IDLE'">
91
+ </span>
92
+ </div>
93
+ </td>
94
+ <td class="py-4 text-center">
95
+ <span class="font-mono text-sm text-gray-300 truncate max-w-[320px] inline-block group-hover:text-white transition-colors"
96
+ x-text="acc.email"></span>
97
+ </td>
98
+ <td class="py-4">
99
+ <span class="text-[10px] font-bold uppercase px-2 py-1 rounded"
100
+ :class="{
101
+ 'bg-yellow-500/10 text-yellow-400 border border-yellow-500/30': acc.planType === 'plus',
102
+ 'bg-blue-500/10 text-blue-400 border border-blue-500/30': acc.planType === 'pro',
103
+ 'bg-gray-500/10 text-gray-400 border border-gray-500/30': acc.planType === 'free'
104
+ }"
105
+ x-text="(acc.planType || 'free').toUpperCase()"></span>
106
+ </td>
107
+ <td class="py-4">
108
+ <div class="flex items-center gap-2">
109
+ <span class="text-xs font-mono"
110
+ :class="acc.tokenExpired ? 'text-red-400' : 'text-neon-green'"
111
+ x-text="acc.tokenExpired ? 'Expired' : 'Valid'"></span>
112
+ <button class="btn btn-xs btn-ghost p-2 rounded hover:bg-white/10 text-gray-500 hover:text-white transition-colors"
113
+ @click="refreshToken(acc.email)"
114
+ :disabled="refreshingTokenEmails.includes(acc.email)" title="Refresh token">
115
+ <svg class="w-4 h-4" :class="{'animate-spin': refreshingTokenEmails.includes(acc.email)}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
116
+ <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" />
117
+ </svg>
118
+ </button>
119
+ </div>
120
+ </td>
121
+ <td class="py-4 cursor-pointer" @click="showQuotaModal(acc)">
122
+ <template x-if="getRemainingPercentage(acc) !== null">
123
+ <div class="flex flex-col gap-1">
124
+ <div class="flex items-center gap-2">
125
+ <div class="w-16 bg-gray-700 rounded-full h-2 overflow-hidden">
126
+ <div class="h-full rounded-full transition-all"
127
+ :class="quotaBarClass(acc)"
128
+ :style="`width: ${getRemainingPercentage(acc)}%`">
129
+ </div>
130
+ </div>
131
+ <template x-if="isQuotaExhausted(acc)">
132
+ <span class="text-[10px] font-bold uppercase text-red-400 bg-red-500/10 px-1.5 py-0.5 rounded border border-red-500/30">USED</span>
133
+ </template>
134
+ <template x-if="!isQuotaExhausted(acc)">
135
+ <span class="text-xs font-mono"
136
+ :class="quotaTextClass(acc)"
137
+ x-text="quotaLabel(acc)"></span>
138
+ </template>
139
+ </div>
140
+ <template x-if="quotaResetSummary(acc)">
141
+ <span class="text-[10px] font-mono text-gray-500" x-text="quotaResetSummary(acc)"></span>
142
+ </template>
143
+ </div>
144
+ </template>
145
+ <template x-if="getRemainingPercentage(acc) === null">
146
+ <span class="text-xs text-gray-600">-</span>
147
+ </template>
148
+ </td>
149
+ <td class="py-4 pr-6">
150
+ <div class="flex justify-end gap-2">
151
+ <button x-show="!acc.isActive"
152
+ class="cursor-pointer px-3 py-1 text-[10px] font-bold font-mono uppercase tracking-wider rounded bg-neon-purple/10 text-neon-purple hover:bg-neon-purple/20 border border-neon-purple/30 hover:border-neon-purple/50 transition-all"
153
+ @click="switchAccount(acc.email)">
154
+ SWITCH
155
+ </button>
156
+ <button class="btn btn-xs btn-ghost p-2 rounded hover:bg-red-500/10 text-gray-500 hover:text-red-400 transition-colors"
157
+ @click="confirmDelete(acc.email)" title="Delete account">
158
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
159
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
160
+ </svg>
161
+ </button>
162
+ </div>
163
+ </td>
164
+ </tr>
165
+ </template>
166
+
167
+ <template x-if="accounts.length > 0 && filteredAccounts.length === 0">
168
+ <tr>
169
+ <td colspan="6" class="py-12 text-center">
170
+ <div class="flex flex-col items-center gap-3">
171
+ <svg class="w-12 h-12 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">
172
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
173
+ </svg>
174
+ <p class="text-sm text-gray-600">No accounts match your search</p>
175
+ <button class="text-xs text-neon-cyan hover:underline" @click="searchQuery = ''">Clear Search</button>
176
+ </div>
177
+ </td>
178
+ </tr>
179
+ </template>
180
+ </tbody>
181
+ </table>
182
+ </div>
183
+ </div>
@@ -0,0 +1,55 @@
1
+ <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">
2
+ <div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="showCreateClientApiKeyModal = false"></div>
3
+ <div class="relative bg-space-900 border border-space-border rounded-xl shadow-2xl max-w-md w-full p-6">
4
+ <h3 class="font-bold text-lg text-white mb-2">New Client API Key</h3>
5
+ <p class="text-sm text-gray-400 mb-5">The key is shown once after creation. Copy it before closing the result.</p>
6
+ <div class="space-y-4">
7
+ <label class="block">
8
+ <span class="block text-xs text-gray-400 mb-2">Name</span>
9
+ <input type="text" x-model="clientApiKeyName" placeholder="e.g. Development workstation"
10
+ class="input w-full bg-space-800 border-space-border text-white font-mono text-sm" @keydown.enter="createClientApiKey()">
11
+ </label>
12
+ <label class="block">
13
+ <span class="block text-xs text-gray-400 mb-2">Remark</span>
14
+ <input type="text" x-model="clientApiKeyRemark" placeholder="Optional note"
15
+ class="input w-full bg-space-800 border-space-border text-white font-mono text-sm" @keydown.enter="createClientApiKey()">
16
+ </label>
17
+ <label class="block">
18
+ <span class="block text-xs text-gray-400 mb-2">Weekly limit (USD)</span>
19
+ <input type="number" min="0" step="0.01" x-model="clientApiKeyWeeklyLimitUsd"
20
+ class="input w-full bg-space-800 border-space-border text-white font-mono text-sm" @keydown.enter="createClientApiKey()">
21
+ </label>
22
+ </div>
23
+ <div class="mt-6 flex justify-end gap-2">
24
+ <button class="btn btn-outline btn-sm text-gray-400" @click="showCreateClientApiKeyModal = false" :disabled="clientApiKeySaving">Cancel</button>
25
+ <button class="btn btn-sm bg-neon-purple hover:bg-purple-600 border-none text-white" @click="createClientApiKey()" :disabled="clientApiKeySaving">
26
+ <span x-text="clientApiKeySaving ? 'Creating...' : 'Create Key'"></span>
27
+ </button>
28
+ </div>
29
+ </div>
30
+ </div>
31
+
32
+ <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 = ''">
33
+ <div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="revealedClientApiKey = ''"></div>
34
+ <div class="relative bg-space-900 border border-yellow-400/40 rounded-xl shadow-2xl max-w-xl w-full p-6">
35
+ <h3 class="font-bold text-lg text-yellow-300 mb-2">Client API Key Created</h3>
36
+ <p class="text-sm text-gray-400 mb-5">Copy this key now. It cannot be retrieved later.</p>
37
+ <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>
38
+ <template x-if="clientProxyConfig">
39
+ <div class="mt-5 space-y-3">
40
+ <p class="text-xs font-semibold uppercase tracking-wider text-gray-400">Claude Code configuration</p>
41
+ <div class="rounded-lg border border-space-border bg-space-800 p-3 font-mono text-xs text-gray-300 space-y-2">
42
+ <div><span class="text-gray-500">ANTHROPIC_BASE_URL=</span><span class="break-all" x-text="clientProxyConfig.env.ANTHROPIC_BASE_URL"></span></div>
43
+ <div><span class="text-gray-500">ANTHROPIC_AUTH_TOKEN=</span><span class="break-all" x-text="revealedClientApiKey"></span></div>
44
+ <div><span class="text-gray-500">ANTHROPIC_API_KEY=</span><span class="break-all" x-text="revealedClientApiKey"></span></div>
45
+ </div>
46
+ <p class="text-xs text-gray-500" x-text="clientProxyConfig.message"></p>
47
+ <button class="btn btn-outline btn-sm text-gray-300" @click="copyClientProxyCommands()">Copy PowerShell Commands</button>
48
+ </div>
49
+ </template>
50
+ <div class="mt-6 flex justify-end gap-2">
51
+ <button class="btn btn-outline btn-sm text-gray-300" @click="copyClientApiKey()">Copy Key</button>
52
+ <button class="btn btn-sm bg-neon-purple hover:bg-purple-600 border-none text-white" @click="revealedClientApiKey = ''; clientProxyConfig = null">Done</button>
53
+ </div>
54
+ </div>
55
+ </div>
@@ -0,0 +1,69 @@
1
+ <div x-show="activeTab === 'client-api-keys'" x-transition class="view-container">
2
+ <div class="flex flex-wrap items-center justify-between gap-4 mb-6">
3
+ <div class="flex flex-wrap items-center gap-4">
4
+ <h1 class="text-2xl font-bold text-white tracking-tight">Claude Code Client API Keys</h1>
5
+ <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">
6
+ <span class="text-[10px] font-mono text-gray-400 uppercase tracking-wider">Client access management</span>
7
+ </div>
8
+ </div>
9
+ </div>
10
+
11
+ <div class="client-keys-panel">
12
+ <div class="client-keys-toolbar">
13
+ <div>
14
+ <h2>Access keys</h2>
15
+ <p>Edit a key, then save its changes.</p>
16
+ </div>
17
+ <div class="client-keys-toolbar-actions">
18
+ <div x-show="clientApiKeys.length" class="client-keys-reset">
19
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M12 8v4l2.5 2.5M21 12a9 9 0 11-2.64-6.36M21 4v5h-5"/></svg>
20
+ <div><span>Next weekly reset</span><strong x-text="clientApiKeys[0]?.quota?.nextPeriodStart ? new Date(clientApiKeys[0].quota.nextPeriodStart).toLocaleString() : '-'"></strong></div>
21
+ </div>
22
+ <button class="client-keys-new" @click="revealedClientApiKey = ''; clientProxyConfig = null; showCreateClientApiKeyModal = true">
23
+ <span>+</span> New API Key
24
+ </button>
25
+ </div>
26
+ </div>
27
+
28
+ <template x-if="clientApiKeysLoading">
29
+ <div class="client-keys-empty">Loading client API keys...</div>
30
+ </template>
31
+
32
+ <div class="client-keys-list" x-show="!clientApiKeysLoading && clientApiKeys.length">
33
+ <template x-for="clientApiKey in clientApiKeys" :key="clientApiKey.id">
34
+ <article class="client-key-card">
35
+ <div class="client-key-identity">
36
+ <div class="client-key-icon">
37
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M15 7a5 5 0 11-9.6 2H3v4h3v3h3v-3h2.4A5 5 0 0115 7z"/></svg>
38
+ </div>
39
+ <div class="client-key-fields">
40
+ <label><span>Client name</span><input type="text" x-model="clientApiKey.name" placeholder="Unnamed"></label>
41
+ <label><span>Remark</span><input type="text" x-model="clientApiKey.remark" placeholder="No remark"></label>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="client-key-quota">
46
+ <div class="client-key-quota-heading">
47
+ <span>Weekly usage</span>
48
+ <strong><span x-text="`$${(clientApiKey.quota?.consumedUsd ?? 0).toFixed(2)}`"></span><small x-text="` / $${Number(clientApiKey.weeklyLimitUsd || 0).toFixed(2)}`"></small></strong>
49
+ </div>
50
+ <div class="client-key-progress"><i :style="`width: ${Math.min(100, Math.max(0, ((clientApiKey.quota?.consumedUsd ?? 0) / Math.max(Number(clientApiKey.weeklyLimitUsd) || 0, 0.000001)) * 100))}%`"></i></div>
51
+ <div class="client-key-quota-foot"><span x-text="`$${(clientApiKey.quota?.remainingUsd ?? (Number(clientApiKey.weeklyLimitUsd) || 0)).toFixed(2)} remaining`"></span><span x-text="`${Math.min(100, Math.max(0, ((clientApiKey.quota?.consumedUsd ?? 0) / Math.max(Number(clientApiKey.weeklyLimitUsd) || 0, 0.000001)) * 100)).toFixed(1)}% used`"></span></div>
52
+ </div>
53
+
54
+ <label class="client-key-limit"><span>Weekly limit</span><div><b>$</b><input type="number" min="0" step="0.01" x-model="clientApiKey.weeklyLimitUsd"></div></label>
55
+
56
+ <div class="client-key-meta"><span>Created</span><strong x-text="new Date(clientApiKey.createdAt).toLocaleDateString()"></strong><small x-text="new Date(clientApiKey.createdAt).toLocaleTimeString()"></small></div>
57
+
58
+ <div class="client-key-actions">
59
+ <button class="client-key-save" @click="updateClientApiKey(clientApiKey)" :disabled="clientApiKeySaving">Save changes</button>
60
+ <button class="client-key-delete" @click="deleteClientApiKey(clientApiKey)" :disabled="clientApiKeySaving" aria-label="Delete API key" title="Delete">
61
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M4 7h16M9 7V4h6v3m-8 0 1 13h8l1-13M10 11v5m4-5v5"/></svg>
62
+ </button>
63
+ </div>
64
+ </article>
65
+ </template>
66
+ </div>
67
+ <div x-show="!clientApiKeysLoading && !clientApiKeys.length" class="client-keys-empty">No client API keys. Create one to connect Claude Code clients.</div>
68
+ </div>
69
+ </div>
@@ -0,0 +1,90 @@
1
+ <div x-show="activeTab === 'dashboard'" x-transition class="view-container">
2
+ <div class="flex items-center justify-between gap-4 mb-6">
3
+ <div class="flex flex-wrap items-center gap-4">
4
+ <h1 class="text-2xl font-bold text-white tracking-tight">Dashboard</h1>
5
+ <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">
6
+ <span class="text-[10px] font-mono text-gray-400 uppercase tracking-wider">CHATGPT PROXY SYSTEM</span>
7
+ </div>
8
+ </div>
9
+ <div class="flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-space-900/60 border border-space-border/40 whitespace-nowrap flex-shrink-0">
10
+ <div class="relative flex items-center justify-center">
11
+ <span class="absolute w-1.5 h-1.5 bg-neon-green rounded-full animate-ping opacity-75"></span>
12
+ <span class="relative w-1.5 h-1.5 bg-neon-green rounded-full"></span>
13
+ </div>
14
+ <span class="text-[10px] font-mono text-gray-500 uppercase tracking-wider">Live</span>
15
+ <span class="text-gray-700">•</span>
16
+ <span class="text-[10px] font-mono text-gray-400 tabular-nums" x-text="currentTime"></span>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="grid grid-cols-2 sm:grid-cols-4 gap-2 lg:gap-3 mb-6">
21
+ <div class="stat bg-space-900/40 border border-space-border/30 rounded-xl p-3 lg:p-4 hover:border-cyan-500/30 hover:bg-cyan-500/5 transition-all duration-300 group relative cursor-pointer min-w-0">
22
+ <div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-cyan-400/70 transition-colors">
23
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 sm:w-5 sm:h-5 stroke-current">
24
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" 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 0z"></path>
25
+ </svg>
26
+ </div>
27
+ <div class="stat-value text-white font-mono text-2xl lg:text-3xl font-bold mb-1 truncate" x-text="stats.total"></div>
28
+ <div class="stat-title text-gray-500 font-mono text-[10px] uppercase tracking-wider truncate">Total Accounts</div>
29
+ <div class="stat-desc text-cyan-400/60 text-[10px] truncate">Linked accounts</div>
30
+ </div>
31
+
32
+ <div class="stat bg-space-900/40 border border-space-border/30 rounded-xl p-3 lg:p-4 hover:border-green-500/30 hover:bg-green-500/5 transition-all duration-300 group relative cursor-pointer min-w-0">
33
+ <div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-green-400/70 transition-colors">
34
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 sm:w-5 sm:h-5 stroke-current">
35
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
36
+ </svg>
37
+ </div>
38
+ <div class="stat-value text-white font-mono text-2xl lg:text-3xl font-bold mb-1 truncate" x-text="stats.active"></div>
39
+ <div class="stat-title text-gray-500 font-mono text-[10px] uppercase tracking-wider truncate">Active</div>
40
+ <div class="stat-desc text-green-400/60 text-[10px] truncate">Operational</div>
41
+ </div>
42
+
43
+ <div class="stat bg-space-900/40 border border-space-border/30 rounded-xl p-3 lg:p-4 hover:border-yellow-500/30 hover:bg-yellow-500/5 transition-all duration-300 group relative cursor-pointer min-w-0">
44
+ <div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-yellow-400/70 transition-colors">
45
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 sm:w-5 sm:h-5 stroke-current">
46
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
47
+ </svg>
48
+ </div>
49
+ <div class="stat-value text-white font-mono text-2xl lg:text-3xl font-bold mb-1 truncate" x-text="stats.expired"></div>
50
+ <div class="stat-title text-gray-500 font-mono text-[10px] uppercase tracking-wider truncate">Token Expired</div>
51
+ <div class="stat-desc text-yellow-400/60 text-[10px] truncate">Needs refresh</div>
52
+ </div>
53
+
54
+ <div class="stat bg-space-900/40 border border-space-border/30 rounded-xl p-3 lg:p-4 hover:border-purple-500/30 hover:bg-purple-500/5 transition-all duration-300 group relative cursor-pointer min-w-0">
55
+ <div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-purple-400/70 transition-colors">
56
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 sm:w-5 sm:h-5 stroke-current">
57
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"></path>
58
+ </svg>
59
+ </div>
60
+ <div class="stat-value text-white font-mono text-2xl lg:text-3xl font-bold mb-1 truncate" x-text="stats.planType"></div>
61
+ <div class="stat-title text-gray-500 font-mono text-[10px] uppercase tracking-wider truncate">Active Plan</div>
62
+ <div class="stat-desc text-purple-400/60 text-[10px] truncate">Current tier</div>
63
+ </div>
64
+ </div>
65
+
66
+ <div class="view-card">
67
+ <div class="flex items-center gap-2.5 mb-4">
68
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 text-neon-purple">
69
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
70
+ </svg>
71
+ <h3 class="text-xs font-mono text-gray-400 uppercase tracking-widest">Quick Test</h3>
72
+ </div>
73
+ <div class="flex gap-3">
74
+ <input type="text" x-model="testPrompt" placeholder="Enter a test prompt..."
75
+ class="input flex-1 bg-space-800 border-space-border text-white font-mono text-sm">
76
+ <button class="btn bg-neon-purple hover:bg-purple-600 border-none text-white btn-sm gap-2"
77
+ @click="testChat()" :disabled="testing">
78
+ <svg class="w-4 h-4" :class="{'animate-spin': testing}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
79
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"></path>
80
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
81
+ </svg>
82
+ <span>Test</span>
83
+ </button>
84
+ </div>
85
+ <div x-show="testResponse" class="mt-4 p-3 rounded-lg bg-space-800/50 border border-space-border/30">
86
+ <pre class="text-xs font-mono text-gray-300 whitespace-pre-wrap" x-text="testResponse"></pre>
87
+ </div>
88
+ </div>
89
+
90
+ </div>
File without changes