@sunflower0305/claude-proxy
v1.4.0
Published
A proxy that lets Claude Agent SDK use domestic Chinese LLMs (DeepSeek, Qwen, GLM, MiniMax, Kimi, MIMO) as backend
Downloads
407
Maintainers
Readme
claude-proxy
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.
It currently supports qwen, deepseek, glm, minimax, kimi, and mimo.
Install
Requires Node.js 20.12 or newer.
Run without installing:
npx @sunflower0305/claude-proxyOr install globally:
npm install -g @sunflower0305/claude-proxy
claude-proxyConfigure
The proxy reads configuration from environment variables. You can export them in your shell or create a .env file in the directory where you run claude-proxy; .env loading uses Node.js built-in .env file support.
Example .env:
PROVIDER=deepseek
PROXY_PORT=8080
# Optional: require clients to send this token to write endpoints.
# PROXY_API_KEY=your-local-proxy-token
DEEPSEEK_API_KEY=your-deepseek-api-key
DEEPSEEK_MODEL=deepseek-v4-proAvailable variables:
| Variable | Purpose |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| PROVIDER | Active provider. Defaults to deepseek. |
| PROXY_PORT | Local server port. Defaults to 8080. |
| PROXY_API_KEY | Optional local proxy token for POST /v1/messages and POST /api/provider. |
| CLAUDE_PROXY_LOG | Enable local request/response capture logging. Disabled by default. |
| CLAUDE_PROXY_LOG_DIR | Capture directory. Defaults to .claude-proxy/sessions. |
| CLAUDE_PROXY_REDACT | Redact authorization and API key headers. Enabled by default. |
| QWEN_API_KEY | API key for Qwen. |
| DEEPSEEK_API_KEY | API key for DeepSeek. |
| GLM_API_KEY | API key for GLM. |
| MINIMAX_API_KEY | API key for MiniMax. |
| KIMI_API_KEY | API key for Kimi. |
| MIMO_API_KEY | API key for MIMO. |
| QWEN_ANTHROPIC_BASE_URL, DEEPSEEK_ANTHROPIC_BASE_URL, GLM_ANTHROPIC_BASE_URL, MINIMAX_ANTHROPIC_BASE_URL, KIMI_ANTHROPIC_BASE_URL, MIMO_ANTHROPIC_BASE_URL | Override the upstream Anthropic-compatible base URL for a provider. |
| QWEN_MODEL, DEEPSEEK_MODEL, GLM_MODEL, MINIMAX_MODEL, KIMI_MODEL, MIMO_MODEL | Override the default upstream model for a provider. |
Provider defaults:
| Provider | Model env | Default model |
| ------------------------ | ---------------- | --------------------- |
| deepseek (default) | DEEPSEEK_MODEL | deepseek-v4-pro |
| qwen | QWEN_MODEL | qwen3.7-plus |
| glm | GLM_MODEL | glm-5.2 |
| minimax | MINIMAX_MODEL | minimax-m3 |
| kimi | KIMI_MODEL | kimi-k2.7-code |
| mimo | MIMO_MODEL | mimo-v2.5-pro |
Local Capture Logging
Capture logging is disabled by default. Enable it only for local debugging in a trusted environment:
CLAUDE_PROXY_LOG=1
CLAUDE_PROXY_LOG_DIR=.claude-proxy/sessions
CLAUDE_PROXY_REDACT=1Each completed, failed, or client-aborted POST /v1/messages request is written
as one JSON file. With redaction enabled, Authorization and x-api-key
headers are replaced with [REDACTED].
Capture files still contain complete request and response bodies. Prompts, messages, tool inputs and outputs, metadata, generated content, and other sensitive payload data are not redacted. The capture store currently has no body-size limit, file rotation, or retention policy, so long-running streams and repeated requests can consume memory and disk space. Use this feature only for short-lived debugging, protect the capture directory, and remove captures when they are no longer needed.
You can use the bundled example as a starting point:
cp node_modules/@sunflower0305/claude-proxy/.env.example .envIf you installed globally, create .env manually or export the variables in your shell before starting the proxy.
Start The Proxy
claude-proxyWhen the server starts, it listens on http://localhost:8080 by default.
Point Claude Code or the Claude Agent SDK at the proxy:
export ANTHROPIC_BASE_URL=http://localhost:8080
export ANTHROPIC_API_KEY=any-string-worksIf you set PROXY_API_KEY, set the client ANTHROPIC_API_KEY to the same
value. The proxy accepts it through either x-api-key or
Authorization: Bearer. If PROXY_API_KEY is not set, the local proxy does not
validate the client API key and any non-empty string can be used.
Example SDK usage:
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "http://localhost:8080",
apiKey: process.env.PROXY_API_KEY || "any-string",
});Runtime Endpoints
| Method | Path | Description |
| -------------- | --------------- | ------------------------------------------ |
| POST | /v1/messages | Main Anthropic Messages API proxy endpoint |
| GET | /v1/models | Lists supported Claude-facing model ids |
| GET | /health | Health check |
| GET / POST | /api/provider | Read or switch the active provider |
Health check:
curl http://localhost:8080/healthSwitch provider at runtime:
curl -X POST http://localhost:8080/api/provider \
-H "Content-Type: application/json" \
-d '{"provider":"qwen"}'Library Usage
The package also keeps the programmatic Express entrypoint:
import { createApp } from "@sunflower0305/claude-proxy";
const app = createApp();
app.listen(8080);Development
From source:
npm install
npm run devChangelog
See CHANGELOG.md and GitHub Releases for release notes.
License
MIT
