https://github.com/sunflower0305/claude-proxy
Claude Code / Claude Agent SDK proxy for DeepSeek, Qwen, GLM, MiniMax and Kimi via Anthropic Messages API
https://github.com/sunflower0305/claude-proxy
anthropic claude claude-agent-sdk claude-code llm-proxy
Last synced: 19 days ago
JSON representation
Claude Code / Claude Agent SDK proxy for DeepSeek, Qwen, GLM, MiniMax and Kimi via Anthropic Messages API
- Host: GitHub
- URL: https://github.com/sunflower0305/claude-proxy
- Owner: sunflower0305
- License: mit
- Created: 2026-04-08T07:48:23.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2026-05-01T09:21:45.000Z (about 2 months ago)
- Last Synced: 2026-05-01T09:26:36.808Z (about 2 months ago)
- Topics: anthropic, claude, claude-agent-sdk, claude-code, llm-proxy
- Language: TypeScript
- Homepage:
- Size: 193 KB
- Stars: 24
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# claude-proxy
[](https://github.com/sunflower0305/claude-proxy/actions/workflows/ci.yml)
[](https://github.com/sunflower0305/claude-proxy/actions/workflows/cd.yml)
[](https://coveralls.io/github/sunflower0305/claude-proxy?branch=master)
[](https://www.npmjs.com/package/@sunflower0305/claude-proxy)
[](https://www.npmjs.com/package/@sunflower0305/claude-proxy)
[](https://github.com/sunflower0305/claude-proxy/stargazers)
[](https://zread.ai/sunflower0305/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:
```bash
npx @sunflower0305/claude-proxy
```
Or install globally:
```bash
npm install -g @sunflower0305/claude-proxy
claude-proxy
```
## Configure
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`:
```dotenv
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-pro
```
Available 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`. |
| `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.1` |
| `minimax` | `MINIMAX_MODEL` | `minimax-m3` |
| `kimi` | `KIMI_MODEL` | `kimi-k2.6` |
| `mimo` | `MIMO_MODEL` | `mimo-v2.5-pro` |
You can use the bundled example as a starting point:
```bash
cp node_modules/@sunflower0305/claude-proxy/.env.example .env
```
If you installed globally, create `.env` manually or export the variables in your shell before starting the proxy.
## Start The Proxy
```bash
claude-proxy
```
When the server starts, it listens on `http://localhost:8080` by default.
Point Claude Code or the Claude Agent SDK at the proxy:
```bash
export ANTHROPIC_BASE_URL=http://localhost:8080
export ANTHROPIC_API_KEY=any-string-works
```
If 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:
```ts
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:
```bash
curl http://localhost:8080/health
```
Switch provider at runtime:
```bash
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:
```ts
import { createApp } from "@sunflower0305/claude-proxy";
const app = createApp();
app.listen(8080);
```
## Development
From source:
```bash
npm install
npm run dev
```
## Changelog
See [CHANGELOG.md](https://github.com/sunflower0305/claude-proxy/blob/master/CHANGELOG.md) and [GitHub Releases](https://github.com/sunflower0305/claude-proxy/releases) for release notes.
## License
MIT