cccproxy 1.0.0 → 1.1.0
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/LICENSE +4 -0
- package/README.md +81 -0
- package/dist/index.js +3 -1
- package/package.json +12 -3
package/LICENSE
CHANGED
|
@@ -2,6 +2,10 @@ MIT License
|
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 Ruslan Yakushev
|
|
4
4
|
|
|
5
|
+
This software includes code derived from [copilot-api](https://github.com/ericc-ch/copilot-api)
|
|
6
|
+
Copyright (c) 2025 Erick Christian Purwanto
|
|
7
|
+
Licensed under MIT License
|
|
8
|
+
|
|
5
9
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
10
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
11
|
in the Software without restriction, including without limitation the rights
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Claude Code Copilot Proxy (cccproxy)
|
|
2
|
+
|
|
3
|
+
A minimal proxy server that allows [Claude Code](https://docs.anthropic.com/en/docs/claude-code) to use GitHub Copilot as its backend. This enables Claude Code users with GitHub Copilot subscriptions to leverage their existing subscription for Claude Code functionality.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js 18 or later
|
|
8
|
+
- A GitHub account with an active GitHub Copilot subscription
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g cccproxy
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or run directly with npx:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx cccproxy
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Start the proxy server:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cccproxy [options]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Options
|
|
31
|
+
|
|
32
|
+
| Option | Short | Description | Default |
|
|
33
|
+
|--------|-------|-------------|---------|
|
|
34
|
+
| `--port <port>` | `-p` | Port to listen on | `4141` |
|
|
35
|
+
| `--account-type <type>` | `-a` | Account type: `individual`, `business`, `enterprise` | `individual` |
|
|
36
|
+
| `--github-token <token>` | `-g` | GitHub token (or use `GH_TOKEN` env var) | - |
|
|
37
|
+
| `--help` | `-h` | Show help message | - |
|
|
38
|
+
|
|
39
|
+
### Authentication
|
|
40
|
+
|
|
41
|
+
On first run, if no GitHub token is provided, the proxy will initiate a device code flow to authenticate with GitHub. Follow the on-screen instructions to authorize the application.
|
|
42
|
+
|
|
43
|
+
Alternatively, provide a GitHub token via:
|
|
44
|
+
- Command line: `--github-token <token>` or `-g <token>`
|
|
45
|
+
- Environment variable: `GH_TOKEN`
|
|
46
|
+
|
|
47
|
+
### Configuring Claude Code
|
|
48
|
+
|
|
49
|
+
Once the proxy is running, configure Claude Code to use it by setting these environment variables:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export ANTHROPIC_BASE_URL=http://localhost:4141
|
|
53
|
+
export ANTHROPIC_AUTH_TOKEN=dummy
|
|
54
|
+
export ANTHROPIC_MODEL=claude-sonnet-4
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or add to your `.claude/settings.json`:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"env": {
|
|
62
|
+
"ANTHROPIC_BASE_URL": "http://localhost:4141",
|
|
63
|
+
"ANTHROPIC_AUTH_TOKEN": "dummy",
|
|
64
|
+
"ANTHROPIC_MODEL": "claude-sonnet-4"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Security
|
|
70
|
+
|
|
71
|
+
- The server binds to `127.0.0.1` only (localhost)
|
|
72
|
+
- CORS is restricted to localhost origins
|
|
73
|
+
- GitHub tokens are stored in memory only
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
78
|
+
|
|
79
|
+
## Acknowledgments
|
|
80
|
+
|
|
81
|
+
This project is based on [copilot-api](https://github.com/ericc-ch/copilot-api) by Erick Christian Purwanto, licensed under MIT.
|
package/dist/index.js
CHANGED
|
@@ -550,7 +550,9 @@ async function handleMessages(c) {
|
|
|
550
550
|
const openAIPayload = translateToOpenAI(anthropicPayload);
|
|
551
551
|
const response = await createChatCompletions(openAIPayload);
|
|
552
552
|
if ("choices" in response) {
|
|
553
|
-
const anthropicResponse = translateToAnthropic(
|
|
553
|
+
const anthropicResponse = translateToAnthropic(
|
|
554
|
+
response
|
|
555
|
+
);
|
|
554
556
|
return c.json(anthropicResponse);
|
|
555
557
|
}
|
|
556
558
|
return streamSSE(c, async (stream) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cccproxy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cccproxy": "dist/index.js"
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"build": "tsup src/index.ts --format esm --target node18 --clean",
|
|
13
13
|
"prepublishOnly": "npm run build",
|
|
14
14
|
"start": "node dist/index.js",
|
|
15
|
-
"dev": "tsup src/index.ts --format esm --target node18 --watch"
|
|
15
|
+
"dev": "tsup src/index.ts --format esm --target node18 --watch",
|
|
16
|
+
"lint": "eslint src/**/*.ts",
|
|
17
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
18
|
+
"format": "prettier --write src",
|
|
19
|
+
"format:check": "prettier --check src"
|
|
16
20
|
},
|
|
17
21
|
"engines": {
|
|
18
22
|
"node": ">=18.0.0"
|
|
@@ -23,8 +27,13 @@
|
|
|
23
27
|
"hono": "^4.7.0"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
30
|
+
"@eslint/js": "^10.0.1",
|
|
26
31
|
"@types/node": "^25.3.3",
|
|
32
|
+
"eslint": "^10.0.2",
|
|
33
|
+
"eslint-config-prettier": "^10.1.8",
|
|
34
|
+
"prettier": "^3.8.1",
|
|
27
35
|
"tsup": "^8.5.1",
|
|
28
|
-
"typescript": "^5.7.0"
|
|
36
|
+
"typescript": "^5.7.0",
|
|
37
|
+
"typescript-eslint": "^8.56.1"
|
|
29
38
|
}
|
|
30
39
|
}
|