@sunflower0305/claude-proxy 1.1.1 → 1.1.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/.env.example +2 -2
- package/README.md +17 -68
- package/dist/proxy.js +3 -3
- package/package.json +1 -1
package/.env.example
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Choose your provider: qwen | deepseek | glm | minimax | kimi
|
|
2
|
-
PROVIDER=
|
|
2
|
+
PROVIDER=deepseek
|
|
3
3
|
|
|
4
4
|
# Proxy server port (default: 8080)
|
|
5
5
|
PROXY_PORT=8080
|
|
@@ -13,7 +13,7 @@ KIMI_API_KEY=your-kimi-key
|
|
|
13
13
|
|
|
14
14
|
# Optional model overrides
|
|
15
15
|
QWEN_MODEL=qwen-plus
|
|
16
|
-
DEEPSEEK_MODEL=deepseek-
|
|
16
|
+
DEEPSEEK_MODEL=deepseek-v4-pro
|
|
17
17
|
GLM_MODEL=glm-5.1
|
|
18
18
|
MINIMAX_MODEL=MiniMax-M2.7-highspeed
|
|
19
19
|
KIMI_MODEL=kimi-k2.6
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
[](https://github.com/sunflower0305/claude-proxy/actions/workflows/cd.yml)
|
|
5
5
|
[](https://coveralls.io/github/sunflower0305/claude-proxy?branch=master)
|
|
6
6
|
[](https://www.npmjs.com/package/@sunflower0305/claude-proxy)
|
|
7
|
+
[](https://www.npmjs.com/package/@sunflower0305/claude-proxy)
|
|
8
|
+
[](https://github.com/sunflower0305/claude-proxy/stargazers)
|
|
7
9
|
[](https://github.com/sunflower0305/claude-proxy/blob/master/LICENSE)
|
|
8
10
|
|
|
9
11
|
`claude-proxy` is published on npm as `@sunflower0305/claude-proxy`. It is a lightweight Express proxy that lets Claude Code or the Claude Agent SDK talk to domestic Chinese LLM providers through Anthropic-compatible `/v1/messages` endpoints.
|
|
@@ -32,17 +34,17 @@ The proxy reads configuration from environment variables. You can export them in
|
|
|
32
34
|
Example `.env`:
|
|
33
35
|
|
|
34
36
|
```dotenv
|
|
35
|
-
PROVIDER=
|
|
37
|
+
PROVIDER=deepseek
|
|
36
38
|
PROXY_PORT=8080
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
DEEPSEEK_API_KEY=your-deepseek-api-key
|
|
40
|
+
DEEPSEEK_MODEL=deepseek-v4-pro
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
Available variables:
|
|
42
44
|
|
|
43
45
|
| Variable | Purpose |
|
|
44
46
|
| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
45
|
-
| `PROVIDER` | Active provider. Defaults to `
|
|
47
|
+
| `PROVIDER` | Active provider. Defaults to `deepseek`. |
|
|
46
48
|
| `PROXY_PORT` | Local server port. Defaults to `8080`. |
|
|
47
49
|
| `QWEN_API_KEY` | API key for Qwen. |
|
|
48
50
|
| `DEEPSEEK_API_KEY` | API key for DeepSeek. |
|
|
@@ -52,6 +54,16 @@ Available variables:
|
|
|
52
54
|
| `QWEN_ANTHROPIC_BASE_URL`, `DEEPSEEK_ANTHROPIC_BASE_URL`, `GLM_ANTHROPIC_BASE_URL`, `MINIMAX_ANTHROPIC_BASE_URL`, `KIMI_ANTHROPIC_BASE_URL` | Override the upstream Anthropic-compatible base URL for a provider. |
|
|
53
55
|
| `QWEN_MODEL`, `DEEPSEEK_MODEL`, `GLM_MODEL`, `MINIMAX_MODEL`, `KIMI_MODEL` | Override the default upstream model for a provider. |
|
|
54
56
|
|
|
57
|
+
Provider defaults:
|
|
58
|
+
|
|
59
|
+
| Provider | Model env | Default model |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| **`deepseek` (default)** | `DEEPSEEK_MODEL` | **`deepseek-v4-pro`** |
|
|
62
|
+
| `qwen` | `QWEN_MODEL` | `qwen-plus` |
|
|
63
|
+
| `glm` | `GLM_MODEL` | `glm-5.1` |
|
|
64
|
+
| `minimax` | `MINIMAX_MODEL` | `MiniMax-M2.7-highspeed` |
|
|
65
|
+
| `kimi` | `KIMI_MODEL` | `kimi-k2.6` |
|
|
66
|
+
|
|
55
67
|
You can use the bundled example as a starting point:
|
|
56
68
|
|
|
57
69
|
```bash
|
|
@@ -106,7 +118,7 @@ Switch provider at runtime:
|
|
|
106
118
|
```bash
|
|
107
119
|
curl -X POST http://localhost:8080/api/provider \
|
|
108
120
|
-H "Content-Type: application/json" \
|
|
109
|
-
-d '{"provider":"
|
|
121
|
+
-d '{"provider":"qwen"}'
|
|
110
122
|
```
|
|
111
123
|
|
|
112
124
|
## Library Usage
|
|
@@ -120,25 +132,6 @@ const app = createApp();
|
|
|
120
132
|
app.listen(8080);
|
|
121
133
|
```
|
|
122
134
|
|
|
123
|
-
## Release Verification
|
|
124
|
-
|
|
125
|
-
`v1.1.0` was verified on April 21, 2026 after publishing `@sunflower0305/claude-proxy` to npm.
|
|
126
|
-
|
|
127
|
-
Verified items:
|
|
128
|
-
|
|
129
|
-
- `npm view @sunflower0305/claude-proxy version dist-tags --json` confirmed `version: 1.1.0` and `latest: 1.1.0`
|
|
130
|
-
- `npm install @sunflower0305/claude-proxy` completed successfully in a clean temporary directory
|
|
131
|
-
- the published `claude-proxy` CLI started correctly from the installed package
|
|
132
|
-
- `GET /health` and `GET /v1/models` returned `200 OK`
|
|
133
|
-
- local end-to-end proxying against a mock Anthropic-compatible upstream passed for both non-streaming and streaming `POST /v1/messages`
|
|
134
|
-
|
|
135
|
-
Observed behavior during verification:
|
|
136
|
-
|
|
137
|
-
- smoke-test startup succeeded with `PROVIDER=qwen`
|
|
138
|
-
- the published artifact returned the expected `health` payload with `provider: qwen` and `model: qwen-plus`
|
|
139
|
-
- the published artifact returned the expected Claude-facing model list from `GET /v1/models`
|
|
140
|
-
- the published package included the expected CLI entrypoint, `dist/` build output, `README.md`, `LICENSE`, and `.env.example`
|
|
141
|
-
|
|
142
135
|
## Development
|
|
143
136
|
|
|
144
137
|
From source:
|
|
@@ -148,50 +141,6 @@ npm install
|
|
|
148
141
|
npm run dev
|
|
149
142
|
```
|
|
150
143
|
|
|
151
|
-
## CI And Releases
|
|
152
|
-
|
|
153
|
-
GitHub Actions provides separate CI and CD workflows:
|
|
154
|
-
|
|
155
|
-
- `CI` runs on branch pushes and pull requests
|
|
156
|
-
- `CD` runs when you push a `vX.Y.Z` tag and can also be re-run manually with `workflow_dispatch`
|
|
157
|
-
|
|
158
|
-
The `CD` workflow:
|
|
159
|
-
|
|
160
|
-
- checks that the tag exactly matches `package.json.version`
|
|
161
|
-
- requires `docs/releases/<version>.md` to exist before publishing
|
|
162
|
-
- runs `npm run build`, `npm run test:proxy-local`, `npm run test:coverage`, and `npm pack --dry-run`
|
|
163
|
-
- fails fast if the npm version already exists
|
|
164
|
-
- publishes the package to npm using the `NPM_TOKEN` repository secret
|
|
165
|
-
- creates or updates the GitHub Release from `docs/releases/<version>.md`
|
|
166
|
-
|
|
167
|
-
Required repository secret:
|
|
168
|
-
|
|
169
|
-
- `NPM_TOKEN`: npm automation token with permission to publish `@sunflower0305/claude-proxy`
|
|
170
|
-
|
|
171
|
-
Release flow:
|
|
172
|
-
|
|
173
|
-
1. bump `package.json`, `CHANGELOG.md`, and `docs/releases/<version>.md`
|
|
174
|
-
2. commit the release prep
|
|
175
|
-
3. create and push the matching `vX.Y.Z` tag
|
|
176
|
-
4. let the `CD` workflow publish npm and GitHub Release
|
|
177
|
-
|
|
178
|
-
The package still relies on `prepack` and `prepublishOnly` in `package.json` to build and verify the artifact before release.
|
|
179
|
-
|
|
180
|
-
Build and local package verification:
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
npm run build
|
|
184
|
-
env npm_config_cache=/tmp/claude-proxy-npm-cache npm pack --dry-run
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Local integration test:
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
npm run test:proxy-local
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Release notes for `v1.1.0` are available in [docs/releases/1.1.0.md](docs/releases/1.1.0.md).
|
|
194
|
-
|
|
195
144
|
## License
|
|
196
145
|
|
|
197
146
|
MIT
|
package/dist/proxy.js
CHANGED
|
@@ -41,7 +41,7 @@ const PROVIDERS = {
|
|
|
41
41
|
baseUrl: pickEnv("DEEPSEEK_ANTHROPIC_BASE_URL") ||
|
|
42
42
|
"https://api.deepseek.com/anthropic",
|
|
43
43
|
apiKey: process.env.DEEPSEEK_API_KEY || "",
|
|
44
|
-
model: pickEnv("DEEPSEEK_MODEL") || "deepseek-
|
|
44
|
+
model: pickEnv("DEEPSEEK_MODEL") || "deepseek-v4-pro",
|
|
45
45
|
},
|
|
46
46
|
qwen: {
|
|
47
47
|
baseUrl: pickEnv("QWEN_ANTHROPIC_BASE_URL") ||
|
|
@@ -71,10 +71,10 @@ function isProviderKey(value) {
|
|
|
71
71
|
return Boolean(value && value in PROVIDERS);
|
|
72
72
|
}
|
|
73
73
|
function getInitialProvider() {
|
|
74
|
-
return isProviderKey(process.env.PROVIDER) ? process.env.PROVIDER : "
|
|
74
|
+
return isProviderKey(process.env.PROVIDER) ? process.env.PROVIDER : "deepseek";
|
|
75
75
|
}
|
|
76
76
|
function getProviderConfig(provider) {
|
|
77
|
-
return PROVIDERS[provider] || PROVIDERS.
|
|
77
|
+
return PROVIDERS[provider] || PROVIDERS.deepseek;
|
|
78
78
|
}
|
|
79
79
|
function getHeaderValue(value) {
|
|
80
80
|
if (Array.isArray(value))
|
package/package.json
CHANGED