A lightweight CORS proxy that lets Ethical Tech CoLab GitHub Pages demos make live AI calls — to the Claude API, GPU-hosted models, or both — without exposing API keys in client-side code.
GitHub Pages is static hosting. You can't:
- Hide API keys (everything is visible in the browser)
- Make server-side API calls
- Bypass CORS restrictions to reach your own GPU server
GitHub Pages (static) → This Proxy (your server) → Claude API
→ GPU models (vLLM, Ollama, etc.)
↑
- holds API keys
- allowlists origins
- rate limits
- handles CORS
The proxy runs on your GPU server (or any server). Only allowlisted origins (your GitHub Pages sites) can call it.
git clone https://github.com/Ethical-Tech-CoLab/ethical-ai-proxy.git
cd ethical-ai-proxy
npm installcp .env.example .envEdit .env:
ANTHROPIC_API_KEY=sk-ant-your-key-here
GPU_SERVER_URL=http://localhost:8000
ALLOWED_ORIGINS=https://ethical-tech-colab.github.io
PORT=3001npm startFor production, use pm2 or systemd:
# pm2
npm install -g pm2
pm2 start server.js --name ethical-ai-proxy
pm2 save
# systemd (create /etc/systemd/system/ethical-ai-proxy.service)Add the client helper to your page:
<script src="https://ethical-tech-colab.github.io/ethical-ai-proxy/client.js"></script>
<script>
const ai = new EthicalAI('https://your-proxy-server.com:3001');
// Simple ask
const answer = await ai.ask('Analyze this artwork.');
// Streaming
await ai.stream('Describe this image', (text) => {
document.getElementById('output').textContent += text;
});
// GPU model
const result = await ai.gpu('v1/completions', { prompt: '...' });
</script>| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Status check — shows what's configured |
/api/claude |
POST | Proxy to Claude API (messages) |
/api/claude/stream |
POST | Streaming proxy to Claude API |
/api/gpu/* |
ANY | Forward to GPU inference server |
- Origin allowlist — only configured origins can call the proxy
- API keys stay server-side — never exposed to the browser
- Rate limiting — configurable per-origin request cap
- No open relay — GPU proxy only forwards to the configured server
┌─────────────────────────────────────┐
│ GitHub Pages (static demos) │
│ ethical-tech-colab.github.io/* │
│ │
│ - digital-passport-artworks │
│ - other demos... │
└──────────────┬──────────────────────┘
│ HTTPS (CORS allowed)
▼
┌─────────────────────────────────────┐
│ Ethical AI Proxy (this server) │
│ running on your GPU server │
│ │
│ - checks origin allowlist │
│ - rate limits │
│ - holds API keys │
└──────┬───────────────┬──────────────┘
│ │
▼ ▼
┌─────────────┐ ┌──────────────────┐
│ Claude API │ │ GPU Models │
│ (Anthropic) │ │ (vLLM/TGI/etc.) │
└─────────────┘ └──────────────────┘