Secure remote access to on-premise AI models and compute resources.
SecureBridge is an open-source infrastructure project that enables secure remote access to on-premise AI models (like Ollama, local LLMs) through a cloud-based bridge without exposing your local network or sending sensitive data to external services.
- OpenAI-Compatible API: Drop-in replacement for OpenAI API
- Firewall-Friendly: Client initiates outbound-only connections
- Privacy-First: Data never persists on the bridge server
- Fallback Support: Automatic fallback to cloud APIs (Anthropic Claude)
- Horizontal Scaling: Stateless server design
- Load Balancing: Multiple routing strategies (round-robin, least-connections, random)
- Self-host AI chat while providing public API access
- Cost optimization (use local GPU, fallback to cloud for overflow)
- Data privacy (process sensitive documents locally)
- Development (test against local models before production)
- Edge AI (deploy at edge locations with central management)
- Go 1.21 or higher
- Ollama or other OpenAI-compatible local AI service
- (Optional) Anthropic API key for fallback
# Clone the repository
git clone https://github.com/yourusername/securebridge.git
cd securebridge
# Install dependencies
make install-deps
# Build binaries
make buildTerminal 1 - Start Ollama (or your local AI service):
ollama serve
ollama pull mixtral:8x7bTerminal 2 - Start Bridge Server:
./bin/securebridge-server -config config/server.yamlTerminal 3 - Start Bridge Client:
./bin/securebridge-client -config config/client.yamlTerminal 4 - Test:
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer test-api-key-1" \
-d '{
"model": "mixtral:8x7b",
"messages": [{"role": "user", "content": "Hello!"}]
}'Edit config/server.yaml:
server:
port: 8080
tls:
enabled: false # Set to true in production
cert: /path/to/cert.pem
key: /path/to/key.pem
auth:
api_keys:
- key: "your-api-key"
name: "Client Name"
rate_limit: 100
appliance_keys:
- key: "your-appliance-key"
name: "Appliance Name"
fallback:
enabled: true # Enable fallback to cloud APIs
provider: "anthropic"
api_key: "${ANTHROPIC_API_KEY}" # Use environment variable
trigger: "appliance_unavailable"
routing:
strategy: "round_robin" # or "least_connections", "random"
health_check_interval: 30s
request_timeout: 60sEdit config/client.yaml:
client:
server_url: "ws://localhost:8080/appliance/connect"
api_key: "your-appliance-key"
appliance_id: "unique-id"
name: "My GPU Box"
local_api:
url: "http://localhost:11434" # Ollama default
type: "openai"
timeout: 60s
connection:
reconnect: true
reconnect_interval: 5s
max_reconnect_interval: 60s
heartbeat_interval: 30sPOST /v1/chat/completions
Request body:
{
"model": "mixtral:8x7b",
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 2048
}GET /health # Server health status
GET /ready # Readiness check
GET /admin/appliances # List connected appliances (requires auth)
Server:
docker build -f deployments/docker/Dockerfile.server -t securebridge-server .
docker run -d -p 8080:8080 -v $(pwd)/config:/etc/securebridge securebridge-serverClient:
docker build -f deployments/docker/Dockerfile.client -t securebridge-client .
docker run -d --network host -v $(pwd)/config:/etc/securebridge securebridge-clientSee example service files in deployments/systemd/:
sudo cp deployments/systemd/securebridge-server.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable securebridge-server
sudo systemctl start securebridge-serverkubectl apply -f deployments/kubernetes/External Clients � Bridge Server (Cloud) � Bridge Client (On-Premise) � Local AI
- Bridge Server: Stateless cloud component, exposes OpenAI-compatible API
- Bridge Client: On-premise component, connects to local AI service
- Communication: WebSocket with outbound-only connections (firewall-friendly)
- Security: TLS, API key authentication, no data persistence
make build # Build both server and client
make build-server # Build server only
make build-client # Build client only
make build-all # Build for all platformsmake run-server # Run server from source
make run-client # Run client from sourcemake test # Run tests
make test-coverage # Run tests with coverage- Always use TLS in production - Set
server.tls.enabled: true - Use strong API keys - Generate random, long keys
- Enable fallback carefully - Only when you trust the fallback provider
- Monitor logs - Watch for authentication failures
- Regular updates - Keep dependencies up to date
- Protected: Man-in-the-middle attacks (via TLS), unauthorized access (via API keys)
- Not Protected: DDoS attacks (use a reverse proxy), rate limiting bypass (implement at reverse proxy level)
Prometheus metrics available at :9090/metrics (server) and :9091/metrics (client).
Key metrics:
securebridge_requests_total- Total requestssecurebridge_request_duration_seconds- Request latencysecurebridge_appliances_connected- Connected appliancessecurebridge_fallback_requests_total- Fallback requests
# Server health
curl http://localhost:8080/health
# Client health (local only)
curl http://localhost:9091/health- Check server URL in client config
- Verify API key matches server config
- Check firewall rules
- Enable debug logging:
logging.level: debug
- Increase
request_timeoutin server config - Check local API is responding:
curl http://localhost:11434/v1/models - Monitor client logs for errors
- Verify
ANTHROPIC_API_KEYenvironment variable is set - Check
fallback.enabled: truein server config - Review server logs for fallback triggers
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Additional fallback providers (OpenAI, Cohere, etc.)
- Client libraries in other languages
- Performance optimizations
- Documentation improvements
GNU AFFERO GENERAL PUBLIC LICENSE 3.0 - See LICENSE for details.
- GitHub Issues: https://github.com/yourusername/securebridge/issues
- Documentation: See
Document/TechnicalSpec.md
See Document/TechnicalSpec.md for detailed roadmap.
- Basic WebSocket bridge
- OpenAI-compatible API
- Single/multiple appliance routing
- Authentication & health checks
- Streaming responses (v1.1)
- Advanced monitoring UI (v1.2)
- Multi-tenant support (v2.0)