3cfc7cffeb7c791981a03c039fdc58efa7966832
- Add CONTEXT.md: Full infrastructure documentation with architecture diagram, routing table, network details, common operations, and important limitations - Add CLAUDE.md: Project-level context for AI agents working in this codebase - Add global-claude-md/CLAUDE.md: User-level global context for ~/.claude/ - Delete nginx-ai-proxy.conf: Unused, Caddy replaced nginx on big-server - Update deploy.sh: Remove stale nginx setup step, update domain to ai.ein-softworks.com - Update README.md: Remove nginx-ai-proxy.conf from files list, update domain, and remove leaked auth token from example Context files provide persistent reference for AI coding sessions across all projects and the ein-ai-proxy codebase specifically.
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": "your-proxy-auth-token",
"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.ein-softworks.com
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 filedeploy.sh— Deployment scriptCLAUDE.md— Project-level context for AI agentsCONTEXT.md— Full infrastructure documentation
License
MIT
Description
Languages
JavaScript
89%
Shell
11%