@jcanizalez7/clauxy 0.2.0 → 0.2.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 +40 -26
- package/dist/cli.js +44 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@jcanizalez7/clauxy)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
> **Note:** Clauxy is in early development.
|
|
8
|
+
> **Note:** Clauxy is in early development. **GitHub Copilot with Anthropic models is stable and recommended.** ChatGPT and Google Gemini support are experimental and may have issues as providers update their APIs. Feedback and contributions are welcome!
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -29,14 +29,19 @@ No API keys needed. Just authenticate once with OAuth and you're ready to go.
|
|
|
29
29
|
npm install -g @jcanizalez7/clauxy
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Also requires [Claude Code](https://docs.anthropic.com/en/docs/claude-code):
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g @anthropic-ai/claude-code
|
|
35
|
+
```
|
|
36
|
+
|
|
32
37
|
---
|
|
33
38
|
|
|
34
39
|
## Quick Start
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
Just run:
|
|
37
42
|
|
|
38
43
|
```bash
|
|
39
|
-
clauxy
|
|
44
|
+
clauxy
|
|
40
45
|
```
|
|
41
46
|
|
|
42
47
|
First time? Select your provider and authenticate:
|
|
@@ -51,35 +56,45 @@ First time? Select your provider and authenticate:
|
|
|
51
56
|
└
|
|
52
57
|
```
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
In a new terminal:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
export ANTHROPIC_BASE_URL="http://localhost:3000"
|
|
60
|
-
export ANTHROPIC_API_KEY="clauxy"
|
|
61
|
-
claude
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
That's it! Claude Code now uses your selected provider.
|
|
65
|
-
|
|
66
|
-
> **Tip:** Add the exports to your `~/.zshrc` or `~/.bashrc` to make them permanent.
|
|
59
|
+
That's it! Clauxy starts the proxy and launches Claude Code automatically with the correct environment variables.
|
|
67
60
|
|
|
68
61
|
---
|
|
69
62
|
|
|
70
63
|
## Commands
|
|
71
64
|
|
|
72
65
|
```bash
|
|
73
|
-
|
|
74
|
-
clauxy
|
|
75
|
-
clauxy
|
|
76
|
-
clauxy
|
|
77
|
-
clauxy
|
|
66
|
+
# Default: Start proxy + launch Claude Code
|
|
67
|
+
clauxy # Just works!
|
|
68
|
+
clauxy "fix the bug" # Pass arguments to Claude
|
|
69
|
+
clauxy -p copilot # Use specific provider
|
|
70
|
+
clauxy -c # Re-authenticate before starting
|
|
71
|
+
clauxy --port 3000 # Use specific port (reuses existing proxy if running)
|
|
72
|
+
|
|
73
|
+
# Proxy-only mode (for advanced users)
|
|
74
|
+
clauxy run # Start proxy without launching Claude
|
|
75
|
+
clauxy run --port 3001 # Proxy on specific port
|
|
76
|
+
clauxy run -p chatgpt # Proxy with specific provider
|
|
77
|
+
|
|
78
|
+
# Configuration
|
|
78
79
|
clauxy model # Configure model mappings
|
|
79
80
|
clauxy auth list # Show configured providers
|
|
80
81
|
```
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
### Port Reuse
|
|
84
|
+
|
|
85
|
+
When you specify `--port`, Clauxy checks if a proxy is already running on that port:
|
|
86
|
+
- If yes, it reuses the existing proxy (no new instance started)
|
|
87
|
+
- If no, it starts a new proxy on that port
|
|
88
|
+
|
|
89
|
+
This lets you run multiple Claude Code sessions sharing a single proxy:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Terminal 1
|
|
93
|
+
clauxy --port 3000 # Starts proxy + Claude
|
|
94
|
+
|
|
95
|
+
# Terminal 2
|
|
96
|
+
clauxy --port 3000 # Reuses proxy, launches another Claude
|
|
97
|
+
```
|
|
83
98
|
|
|
84
99
|
---
|
|
85
100
|
|
|
@@ -96,7 +111,7 @@ Claude Code requests are automatically mapped to your provider's models:
|
|
|
96
111
|
Customize with `clauxy model` or environment variables:
|
|
97
112
|
|
|
98
113
|
```bash
|
|
99
|
-
CLAUXY_MODEL_BIG=gpt-4o CLAUXY_MODEL_MID=gpt-4o clauxy
|
|
114
|
+
CLAUXY_MODEL_BIG=gpt-4o CLAUXY_MODEL_MID=gpt-4o clauxy
|
|
100
115
|
```
|
|
101
116
|
|
|
102
117
|
---
|
|
@@ -123,14 +138,13 @@ Credentials are stored locally in `~/.clauxy/` with restricted permissions.
|
|
|
123
138
|
|
|
124
139
|
**"Token refresh failed"** or **"Not authenticated"**
|
|
125
140
|
```bash
|
|
126
|
-
clauxy
|
|
141
|
+
clauxy -c
|
|
127
142
|
```
|
|
128
143
|
|
|
129
144
|
**Port already in use**
|
|
130
145
|
```bash
|
|
131
|
-
clauxy
|
|
146
|
+
clauxy --port 3001
|
|
132
147
|
```
|
|
133
|
-
Then update `ANTHROPIC_BASE_URL`.
|
|
134
148
|
|
|
135
149
|
**Reset everything**
|
|
136
150
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -2558,8 +2558,18 @@ async function authenticateProvider2(providerId) {
|
|
|
2558
2558
|
prompts3.outro(`Connected to ${provider.info.name}`);
|
|
2559
2559
|
return providerId;
|
|
2560
2560
|
}
|
|
2561
|
+
async function isClauxyRunning(port) {
|
|
2562
|
+
try {
|
|
2563
|
+
const response = await fetch(`http://localhost:${port}/health`, {
|
|
2564
|
+
signal: AbortSignal.timeout(1000)
|
|
2565
|
+
});
|
|
2566
|
+
return response.ok && await response.text() === "OK";
|
|
2567
|
+
} catch {
|
|
2568
|
+
return false;
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2561
2571
|
async function wrapperCommand(options) {
|
|
2562
|
-
const { logLevel = "warn", connect = false, provider, claudeArgs = [] } = options;
|
|
2572
|
+
const { logLevel = "warn", connect = false, provider, port: requestedPort, claudeArgs = [] } = options;
|
|
2563
2573
|
const claudePath = await findClaudeCli();
|
|
2564
2574
|
if (!claudePath) {
|
|
2565
2575
|
console.error(c2.red("Error: Claude CLI not found."));
|
|
@@ -2594,18 +2604,28 @@ Install it with: ${c2.cyan("npm i -g @anthropic-ai/claude-code")}`);
|
|
|
2594
2604
|
}
|
|
2595
2605
|
}
|
|
2596
2606
|
await Config.setActiveProvider(activeProvider);
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2607
|
+
let proxyPort;
|
|
2608
|
+
let proxyServer = null;
|
|
2609
|
+
if (requestedPort && await isClauxyRunning(requestedPort)) {
|
|
2610
|
+
proxyPort = requestedPort;
|
|
2611
|
+
console.log(`${c2.green(">")} ${c2.bold("Clauxy")} reusing proxy on ${c2.cyan(`localhost:${proxyPort}`)}`);
|
|
2612
|
+
} else {
|
|
2613
|
+
const { startProxy: startProxy2 } = await init_proxy().then(() => exports_proxy);
|
|
2614
|
+
const server = await startProxy2({
|
|
2615
|
+
port: requestedPort,
|
|
2616
|
+
logLevel,
|
|
2617
|
+
providerId: activeProvider,
|
|
2618
|
+
quiet: true
|
|
2619
|
+
});
|
|
2620
|
+
proxyServer = server;
|
|
2621
|
+
proxyPort = server.port;
|
|
2622
|
+
const providerInfo = await getProvider(activeProvider);
|
|
2623
|
+
console.log(`${c2.green(">")} ${c2.bold("Clauxy")} proxy on ${c2.cyan(`localhost:${proxyPort}`)} ${c2.dim(`(${providerInfo.info.name})`)}`);
|
|
2624
|
+
}
|
|
2605
2625
|
const claude = Bun.spawn(["claude", ...claudeArgs], {
|
|
2606
2626
|
env: {
|
|
2607
2627
|
...process.env,
|
|
2608
|
-
ANTHROPIC_BASE_URL: `http://localhost:${
|
|
2628
|
+
ANTHROPIC_BASE_URL: `http://localhost:${proxyPort}`,
|
|
2609
2629
|
ANTHROPIC_API_KEY: "clauxy"
|
|
2610
2630
|
},
|
|
2611
2631
|
stdin: "inherit",
|
|
@@ -2617,14 +2637,14 @@ Install it with: ${c2.cyan("npm i -g @anthropic-ai/claude-code")}`);
|
|
|
2617
2637
|
if (isCleaningUp)
|
|
2618
2638
|
return;
|
|
2619
2639
|
isCleaningUp = true;
|
|
2620
|
-
proxyServer
|
|
2640
|
+
proxyServer?.stop();
|
|
2621
2641
|
claude.kill();
|
|
2622
2642
|
};
|
|
2623
2643
|
process.on("SIGINT", cleanup);
|
|
2624
2644
|
process.on("SIGTERM", cleanup);
|
|
2625
2645
|
process.on("SIGHUP", cleanup);
|
|
2626
2646
|
const exitCode = await claude.exited;
|
|
2627
|
-
proxyServer
|
|
2647
|
+
proxyServer?.stop();
|
|
2628
2648
|
process.exit(exitCode);
|
|
2629
2649
|
}
|
|
2630
2650
|
|
|
@@ -2776,7 +2796,7 @@ Models configured:`);
|
|
|
2776
2796
|
// package.json
|
|
2777
2797
|
var package_default = {
|
|
2778
2798
|
name: "@jcanizalez7/clauxy",
|
|
2779
|
-
version: "0.2.
|
|
2799
|
+
version: "0.2.2",
|
|
2780
2800
|
description: "Multi-provider AI proxy for Claude Code (GitHub Copilot, ChatGPT Plus, Google Gemini)",
|
|
2781
2801
|
type: "module",
|
|
2782
2802
|
bin: {
|
|
@@ -2898,7 +2918,7 @@ var main = defineCommand({
|
|
|
2898
2918
|
meta: {
|
|
2899
2919
|
name: "clauxy",
|
|
2900
2920
|
version: package_default.version,
|
|
2901
|
-
description: "Multi-Provider AI Proxy for Claude Code"
|
|
2921
|
+
description: "Multi-Provider AI Proxy for Claude Code. Run without arguments to start proxy and launch Claude automatically."
|
|
2902
2922
|
},
|
|
2903
2923
|
args: {
|
|
2904
2924
|
"log-level": {
|
|
@@ -2917,6 +2937,10 @@ var main = defineCommand({
|
|
|
2917
2937
|
type: "string",
|
|
2918
2938
|
alias: "p",
|
|
2919
2939
|
description: "Provider to use (copilot, chatgpt, google)"
|
|
2940
|
+
},
|
|
2941
|
+
port: {
|
|
2942
|
+
type: "string",
|
|
2943
|
+
description: "Port to use (reuses existing proxy if running)"
|
|
2920
2944
|
}
|
|
2921
2945
|
},
|
|
2922
2946
|
subCommands: {
|
|
@@ -2926,10 +2950,16 @@ var main = defineCommand({
|
|
|
2926
2950
|
models: model
|
|
2927
2951
|
},
|
|
2928
2952
|
async run({ args, rawArgs }) {
|
|
2953
|
+
const port = args.port ? parseInt(args.port, 10) : undefined;
|
|
2954
|
+
if (args.port && isNaN(port)) {
|
|
2955
|
+
console.error(`Invalid port number: "${args.port}". Use --port <number> (e.g., --port 3000).`);
|
|
2956
|
+
process.exit(1);
|
|
2957
|
+
}
|
|
2929
2958
|
await wrapperCommand({
|
|
2930
2959
|
logLevel: args["log-level"],
|
|
2931
2960
|
connect: args.connect,
|
|
2932
2961
|
provider: args.provider,
|
|
2962
|
+
port,
|
|
2933
2963
|
claudeArgs: rawArgs
|
|
2934
2964
|
});
|
|
2935
2965
|
}
|