Initial commit: ein-ai-proxy

Anthropic-compatible API proxy that routes requests to multiple
providers (Anthropic, Z.ai/GLM-4.7, DeepSeek V3.2) based on
model name. Zero dependencies, SSE streaming, bearer token auth.

Designed to run behind Caddy/nginx on a home server, enabling
Claude Code and Roo Code clients to connect from anywhere.
This commit is contained in:
harrison
2026-03-26 13:54:22 -05:00
commit 7fc0bafb01
8 changed files with 561 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
# Ein AI Proxy - Add this as a new server block or include in your existing nginx config
# Place at: /etc/nginx/sites-available/ai-proxy
# Then: sudo ln -s /etc/nginx/sites-available/ai-proxy /etc/nginx/sites-enabled/
# Then: sudo nginx -t && sudo systemctl reload nginx
#
# Prerequisites:
# - DNS A record for ai.maybe.zone pointing to your server IP
# - SSL cert (use certbot: sudo certbot --nginx -d ai.maybe.zone)
server {
listen 443 ssl http2;
server_name ai.maybe.zone;
# SSL certs - certbot will fill these in, or point to your existing certs
# ssl_certificate /etc/letsencrypt/live/ai.maybe.zone/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/ai.maybe.zone/privkey.pem;
# SSE streaming support - critical for Claude Code / Roo Code
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
# Max body size for large prompts with long context
client_max_body_size 50m;
location / {
proxy_pass http://127.0.0.1:3100;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# SSE streaming headers
proxy_set_header Connection '';
chunked_transfer_encoding on;
}
}
# HTTP -> HTTPS redirect
server {
listen 80;
server_name ai.maybe.zone;
return 301 https://$host$request_uri;
}