2e71fda7657387d6c482193545a010eea63b9651
ein-ai-proxy
Anthropic-compatible API proxy that routes requests to multiple AI providers based on model name. Built to run on a home server behind nginx, letting you use Claude Code and Roo Code from any machine while keeping costs optimized.
How it works
Clients (Claude Code CLI, Roo Code, Cline, etc.) send standard Anthropic Messages API requests to your proxy. The proxy inspects the model field and forwards the request to the appropriate provider:
| Client requests | Routed to | Why |
|---|---|---|
claude-opus-4-6 |
Anthropic API | Complex tasks that need the best model |
claude-sonnet-4-6 |
Z.ai → GLM-4.7 | Daily workhorse, $10/mo flat rate |
claude-haiku-4-5-* |
DeepSeek → V3.2 | Trivial tasks, pennies per token |
glm-4.7 (direct) |
Z.ai | Explicit GLM request |
deepseek-chat (direct) |
DeepSeek | Explicit DeepSeek request |
SSE streaming is fully supported — responses are piped through without buffering.
Setup
# 1. Copy and edit config
cp config.example.json config.json
nano config.json # Add your API keys + set authToken
# 2. Deploy (installs systemd service, tests proxy)
chmod +x deploy.sh
./deploy.sh
# 3. Follow the nginx + SSL steps printed by deploy.sh
Client Configuration
Claude Code CLI
Add to ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://ai.ein-softworks.com",
"ANTHROPIC_AUTH_TOKEN": "2d6aca1161e8ad8451c3c1247edf037b736dd7054fc2fab9e35adee313fdba5c",
"API_TIMEOUT_MS": "3000000"
}
}
Roo Code (VS Code)
- Open Roo Code settings
- Set API Provider to Anthropic
- Enter your proxy auth token as the API Key
- Check Use custom base URL
- Enter
https://ai.maybe.zone
Switching models
From Claude Code, the default Sonnet model routes to GLM-4.7. To use Opus for a complex task, use /model and select Opus — the proxy will route it to the real Anthropic API.
Files
proxy.mjs— The proxy server (zero dependencies, Node.js 18+)config.json— Your API keys and auth token (gitignored)config.example.json— Template configein-ai-proxy.service— Systemd unit filenginx-ai-proxy.conf— Nginx reverse proxy configdeploy.sh— Deployment script
License
MIT
Description
Languages
JavaScript
89%
Shell
11%