claude-codex-proxy 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -5
- package/bin/cli.js +10 -10
- package/docs/ACCOUNTS.md +3 -3
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/OAUTH.md +7 -7
- package/package.json +7 -5
- package/public/index.html +3 -3
- package/public/js/app.js +4 -3
- package/src/account-manager.js +1 -1
- package/src/cli/accounts.js +9 -9
- package/src/index.js +13 -3
- package/src/routes/api-routes.js +4 -1
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
# Codex
|
|
1
|
+
# Claude Codex Proxy
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
[](https://choosealicense.com/licenses/mit/)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
|
-
[](https://github.com/zzy-life/claude-codex-proxy)
|
|
8
8
|
|
|
9
9
|
> **Use Claude Code CLI with the power of ChatGPT Codex models.**
|
|
10
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
11
|
|
|
12
|
+
> This project is forked from the original Claude/Codex proxy project and maintained with additional changes for this distribution.
|
|
13
|
+
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
## 🚀 Features
|
|
@@ -70,6 +72,17 @@ claude-codex-proxy start
|
|
|
70
72
|
|
|
71
73
|
---
|
|
72
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
|
+
|
|
73
86
|
## 🚦 Quick Start
|
|
74
87
|
|
|
75
88
|
### 1. Start the Proxy
|
|
@@ -221,7 +234,7 @@ This project is an independent open-source tool and is not affiliated with, endo
|
|
|
221
234
|
|
|
222
235
|
<div align="center">
|
|
223
236
|
<p>If you find this project useful, please give it a star! ⭐️</p>
|
|
224
|
-
<a href="https://github.com/zzy-life/codex-
|
|
225
|
-
<img src="https://img.shields.io/github/stars/zzy-life/codex-
|
|
237
|
+
<a href="https://github.com/zzy-life/claude-codex-proxy">
|
|
238
|
+
<img src="https://img.shields.io/github/stars/zzy-life/claude-codex-proxy?style=social" alt="Star on GitHub">
|
|
226
239
|
</a>
|
|
227
|
-
</div>
|
|
240
|
+
</div>
|
package/bin/cli.js
CHANGED
|
@@ -16,12 +16,12 @@ const command = args[0];
|
|
|
16
16
|
|
|
17
17
|
function showHelp() {
|
|
18
18
|
console.log(`
|
|
19
|
-
codex-
|
|
19
|
+
claude-codex-proxy v${packageJson.version}
|
|
20
20
|
|
|
21
21
|
Proxy server for using ChatGPT Codex models with Claude Code CLI.
|
|
22
22
|
|
|
23
23
|
USAGE:
|
|
24
|
-
codex-
|
|
24
|
+
claude-codex-proxy <command> [options]
|
|
25
25
|
|
|
26
26
|
COMMANDS:
|
|
27
27
|
start Start the proxy server (default port: 8081)
|
|
@@ -41,15 +41,15 @@ ENVIRONMENT:
|
|
|
41
41
|
PORT Server port (default: 8081)
|
|
42
42
|
|
|
43
43
|
EXAMPLES:
|
|
44
|
-
codex-
|
|
45
|
-
PORT=3000 codex-
|
|
46
|
-
codex-
|
|
47
|
-
codex-
|
|
48
|
-
codex-
|
|
49
|
-
codex-
|
|
44
|
+
claude-codex-proxy start
|
|
45
|
+
PORT=3000 claude-codex-proxy start
|
|
46
|
+
claude-codex-proxy accounts add
|
|
47
|
+
claude-codex-proxy accounts add --no-browser
|
|
48
|
+
claude-codex-proxy accounts list
|
|
49
|
+
claude-codex-proxy accounts verify
|
|
50
50
|
|
|
51
51
|
HEADLESS/VM USAGE:
|
|
52
|
-
1. Run: codex-
|
|
52
|
+
1. Run: claude-codex-proxy accounts add --no-browser
|
|
53
53
|
2. Copy the URL shown and open in browser on another device
|
|
54
54
|
3. After login, paste the callback URL back in terminal
|
|
55
55
|
|
|
@@ -102,7 +102,7 @@ async function main() {
|
|
|
102
102
|
|
|
103
103
|
default:
|
|
104
104
|
console.error(`Unknown command: ${command}`);
|
|
105
|
-
console.error('Run "codex-
|
|
105
|
+
console.error('Run "claude-codex-proxy --help" for usage information.');
|
|
106
106
|
process.exit(1);
|
|
107
107
|
}
|
|
108
108
|
}
|
package/docs/ACCOUNTS.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### Main Registry
|
|
6
6
|
|
|
7
|
-
**Location:** `~/.codex-
|
|
7
|
+
**Location:** `~/.claude-codex-proxy/accounts.json`
|
|
8
8
|
|
|
9
9
|
```json
|
|
10
10
|
{
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
### Per-Account Tokens
|
|
35
35
|
|
|
36
|
-
**Location:** `~/.codex-
|
|
36
|
+
**Location:** `~/.claude-codex-proxy/accounts/<email>/auth.json`
|
|
37
37
|
|
|
38
38
|
```json
|
|
39
39
|
{
|
|
@@ -196,7 +196,7 @@ On server startup:
|
|
|
196
196
|
|
|
197
197
|
## Security
|
|
198
198
|
|
|
199
|
-
- Tokens stored locally in `~/.codex-
|
|
199
|
+
- Tokens stored locally in `~/.claude-codex-proxy/`
|
|
200
200
|
- Directory permissions: user read/write only
|
|
201
201
|
- Never logged or exposed in API responses
|
|
202
202
|
- Per-account isolation via separate directories
|
package/docs/ARCHITECTURE.md
CHANGED
package/docs/OAUTH.md
CHANGED
|
@@ -6,12 +6,12 @@ This proxy uses **OAuth 2.0 with PKCE** for secure authentication with ChatGPT.
|
|
|
6
6
|
|
|
7
7
|
### Desktop (Browser)
|
|
8
8
|
```bash
|
|
9
|
-
codex-
|
|
9
|
+
claude-codex-proxy accounts add
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
### Headless/VM (No Browser)
|
|
13
13
|
```bash
|
|
14
|
-
codex-
|
|
14
|
+
claude-codex-proxy accounts add --no-browser
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Headless/VM Workflow
|
|
@@ -20,7 +20,7 @@ When running on a server without a browser (VM, Docker, SSH):
|
|
|
20
20
|
|
|
21
21
|
1. Run the command with `--no-browser`:
|
|
22
22
|
```bash
|
|
23
|
-
codex-
|
|
23
|
+
claude-codex-proxy accounts add --no-browser
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
2. It prints a URL like:
|
|
@@ -59,16 +59,16 @@ When running on a server without a browser (VM, Docker, SSH):
|
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
# List accounts
|
|
62
|
-
codex-
|
|
62
|
+
claude-codex-proxy accounts list
|
|
63
63
|
|
|
64
64
|
# Add account (browser)
|
|
65
|
-
codex-
|
|
65
|
+
claude-codex-proxy accounts add
|
|
66
66
|
|
|
67
67
|
# Add account (headless)
|
|
68
|
-
codex-
|
|
68
|
+
claude-codex-proxy accounts add --no-browser
|
|
69
69
|
|
|
70
70
|
# Clear all accounts
|
|
71
|
-
codex-
|
|
71
|
+
claude-codex-proxy accounts clear
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## Troubleshooting
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-codex-proxy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/zzy-life/codex-
|
|
25
|
+
"url": "git+https://github.com/zzy-life/claude-codex-proxy.git"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/zzy-life/codex-
|
|
28
|
+
"url": "https://github.com/zzy-life/claude-codex-proxy/issues"
|
|
29
29
|
},
|
|
30
|
-
"homepage": "https://github.com/zzy-life/codex-
|
|
30
|
+
"homepage": "https://github.com/zzy-life/claude-codex-proxy#readme",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"start": "node src/index.js",
|
|
33
33
|
"portfolio:dev": "npm --prefix apps/portfolio run dev",
|
|
@@ -45,7 +45,9 @@
|
|
|
45
45
|
"test:api": "node --test tests/api.test.js",
|
|
46
46
|
"test:routing": "node --test tests/routing.test.js",
|
|
47
47
|
"test:cors": "node --test tests/cors_security.test.js",
|
|
48
|
-
"test:ui": "node --test tests/ui.test.js"
|
|
48
|
+
"test:ui": "node --test tests/ui.test.js",
|
|
49
|
+
"pack:check": "npm pack --dry-run",
|
|
50
|
+
"release:npm": "npm run test:unit && npm pack --dry-run && npm publish"
|
|
49
51
|
},
|
|
50
52
|
"dependencies": {
|
|
51
53
|
"express": "^4.18.2",
|
package/public/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Codex
|
|
7
|
+
<title>Claude Codex Proxy</title>
|
|
8
8
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🚀</text></svg>">
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
|
|
10
10
|
<link rel="stylesheet" href="/css/style.css">
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
<div class="flex flex-col gap-0.5">
|
|
72
72
|
<div class="flex items-center gap-1.5">
|
|
73
73
|
<span class="text-[10px] text-gray-500 font-mono tracking-wider">CLAUDE PROXY SYSTEM</span>
|
|
74
|
-
<span class="text-[10px] text-gray-500 font-mono tracking-wider" x-text="'v' + version"></span>
|
|
74
|
+
<span class="text-[10px] text-gray-500 font-mono tracking-wider" x-text="version ? 'v' + version : ''"></span>
|
|
75
75
|
</div>
|
|
76
|
-
<a href="https://github.com/
|
|
76
|
+
<a href="https://github.com/zzy-life/claude-codex-proxy" target="_blank" class="text-[10px] text-neon-purple hover:text-purple-400 hover:underline transition-colors flex items-center gap-1">
|
|
77
77
|
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
|
|
78
78
|
<span>Star on GitHub</span>
|
|
79
79
|
</a>
|
package/public/js/app.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
document.addEventListener('alpine:init', () => {
|
|
2
2
|
Alpine.data('app', () => ({
|
|
3
|
-
version: '
|
|
3
|
+
version: '',
|
|
4
4
|
connectionStatus: 'connecting',
|
|
5
5
|
activeTab: 'dashboard',
|
|
6
6
|
sidebarOpen: window.innerWidth >= 1024,
|
|
@@ -39,7 +39,7 @@ document.addEventListener('alpine:init', () => {
|
|
|
39
39
|
testResponse: '',
|
|
40
40
|
testing: false,
|
|
41
41
|
|
|
42
|
-
configPath: '~/.codex-
|
|
42
|
+
configPath: '~/.claude-codex-proxy/accounts.json',
|
|
43
43
|
|
|
44
44
|
logs: [],
|
|
45
45
|
logSearchQuery: '',
|
|
@@ -110,8 +110,9 @@ document.addEventListener('alpine:init', () => {
|
|
|
110
110
|
},
|
|
111
111
|
|
|
112
112
|
async checkHealth() {
|
|
113
|
-
const { ok } = await this.api('/health');
|
|
113
|
+
const { ok, data } = await this.api('/health');
|
|
114
114
|
this.connectionStatus = ok ? 'connected' : 'disconnected';
|
|
115
|
+
if (ok && data?.version) this.version = data.version;
|
|
115
116
|
},
|
|
116
117
|
|
|
117
118
|
async refreshAccounts() {
|
package/src/account-manager.js
CHANGED
|
@@ -9,7 +9,7 @@ import { homedir } from 'os';
|
|
|
9
9
|
import { refreshAccessToken, extractAccountInfo } from './oauth.js';
|
|
10
10
|
import { getAccountQuota as fetchQuota } from './model-api.js';
|
|
11
11
|
|
|
12
|
-
const CONFIG_DIR = join(homedir(), '.codex-
|
|
12
|
+
const CONFIG_DIR = join(homedir(), '.claude-codex-proxy');
|
|
13
13
|
const ACCOUNTS_FILE = join(CONFIG_DIR, 'accounts.json');
|
|
14
14
|
const ACCOUNTS_DIR = join(CONFIG_DIR, 'accounts');
|
|
15
15
|
|
package/src/cli/accounts.js
CHANGED
|
@@ -10,7 +10,7 @@ import { homedir } from 'os';
|
|
|
10
10
|
import { join } from 'path';
|
|
11
11
|
import crypto from 'crypto';
|
|
12
12
|
|
|
13
|
-
const CONFIG_DIR = join(homedir(), '.codex-
|
|
13
|
+
const CONFIG_DIR = join(homedir(), '.claude-codex-proxy');
|
|
14
14
|
const ACCOUNTS_FILE = join(CONFIG_DIR, 'accounts.json');
|
|
15
15
|
const DEFAULT_PORT = 8081;
|
|
16
16
|
|
|
@@ -526,18 +526,18 @@ async function main() {
|
|
|
526
526
|
case 'help':
|
|
527
527
|
default:
|
|
528
528
|
console.log('\nUsage:');
|
|
529
|
-
console.log(' codex-
|
|
530
|
-
console.log(' codex-
|
|
531
|
-
console.log(' codex-
|
|
532
|
-
console.log(' codex-
|
|
533
|
-
console.log(' codex-
|
|
534
|
-
console.log(' codex-
|
|
535
|
-
console.log(' codex-
|
|
529
|
+
console.log(' claude-codex-proxy accounts add Add account (opens browser)');
|
|
530
|
+
console.log(' claude-codex-proxy accounts add --no-browser Add account (manual code)');
|
|
531
|
+
console.log(' claude-codex-proxy accounts list List all accounts');
|
|
532
|
+
console.log(' claude-codex-proxy accounts remove Remove accounts interactively');
|
|
533
|
+
console.log(' claude-codex-proxy accounts verify Verify account tokens');
|
|
534
|
+
console.log(' claude-codex-proxy accounts clear Remove all accounts');
|
|
535
|
+
console.log(' claude-codex-proxy accounts help Show this help');
|
|
536
536
|
console.log('\nOptions:');
|
|
537
537
|
console.log(' --no-browser Manual authorization code input (for headless/VM servers)');
|
|
538
538
|
console.log(' --port=<port> Server port (default: 8081)');
|
|
539
539
|
console.log('\nHeadless/VM Usage:');
|
|
540
|
-
console.log(' 1. Run: codex-
|
|
540
|
+
console.log(' 1. Run: claude-codex-proxy accounts add --no-browser');
|
|
541
541
|
console.log(' 2. Copy the URL shown and open in browser on another device');
|
|
542
542
|
console.log(' 3. After login, paste the callback URL back in terminal');
|
|
543
543
|
break;
|
package/src/index.js
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Codex
|
|
2
|
+
* Claude Codex Proxy
|
|
3
3
|
* Entry point
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { createRequire } from 'module';
|
|
6
7
|
import { startServer } from './server.js';
|
|
7
8
|
import { logger } from './utils/logger.js';
|
|
8
9
|
import { getStatus, ACCOUNTS_FILE } from './account-manager.js';
|
|
9
10
|
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const packageJson = require('../package.json');
|
|
10
13
|
const PORT = Number(process.env.PORT || 8081);
|
|
14
|
+
const BANNER_WIDTH = 62;
|
|
15
|
+
const centerBannerText = (text) => {
|
|
16
|
+
const padding = Math.max(0, BANNER_WIDTH - text.length);
|
|
17
|
+
const left = Math.floor(padding / 2);
|
|
18
|
+
const right = padding - left;
|
|
19
|
+
return `${' '.repeat(left)}${text}${' '.repeat(right)}`;
|
|
20
|
+
};
|
|
11
21
|
|
|
12
22
|
startServer({ port: PORT });
|
|
13
23
|
|
|
14
24
|
console.log(`
|
|
15
25
|
╔══════════════════════════════════════════════════════════════╗
|
|
16
|
-
|
|
26
|
+
║${centerBannerText(`Claude Codex Proxy v${packageJson.version}`)}║
|
|
17
27
|
║ (Direct API Mode) ║
|
|
18
28
|
╠══════════════════════════════════════════════════════════════╣
|
|
19
29
|
║ Server: http://localhost:${PORT} ║
|
|
@@ -30,7 +40,7 @@ console.log(`
|
|
|
30
40
|
╠══════════════════════════════════════════════════════════════╣
|
|
31
41
|
║ Support: ║
|
|
32
42
|
║ ★ Give it a star on GitHub! ║
|
|
33
|
-
║ https://github.com/
|
|
43
|
+
║ https://github.com/zzy-life/claude-codex-proxy ║
|
|
34
44
|
╚══════════════════════════════════════════════════════════════╝
|
|
35
45
|
`);
|
|
36
46
|
|
package/src/routes/api-routes.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import express from 'express';
|
|
8
|
+
import { createRequire } from 'module';
|
|
8
9
|
import { join, dirname } from 'path';
|
|
9
10
|
import { fileURLToPath } from 'url';
|
|
10
11
|
|
|
@@ -41,6 +42,8 @@ import {
|
|
|
41
42
|
} from './accounts-route.js';
|
|
42
43
|
|
|
43
44
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
45
|
+
const require = createRequire(import.meta.url);
|
|
46
|
+
const packageJson = require('../../package.json');
|
|
44
47
|
|
|
45
48
|
export function registerApiRoutes(app, { port }) {
|
|
46
49
|
// ─── Static Web UI ─────────────────────────────────────────────────────────
|
|
@@ -48,7 +51,7 @@ export function registerApiRoutes(app, { port }) {
|
|
|
48
51
|
|
|
49
52
|
// ─── Health ────────────────────────────────────────────────────────────────
|
|
50
53
|
app.get('/health', (req, res) => {
|
|
51
|
-
res.json({ status: 'ok', ...getStatus(), configPath: ACCOUNTS_FILE });
|
|
54
|
+
res.json({ status: 'ok', version: packageJson.version, ...getStatus(), configPath: ACCOUNTS_FILE });
|
|
52
55
|
});
|
|
53
56
|
|
|
54
57
|
// ─── Anthropic Messages API ────────────────────────────────────────────────
|