- 🚀 High Performance: Built in Go for maximum efficiency and minimal latency
- 🌍 Multi-Provider: Multiple LLM provider support
- 🤖 AI-Ready: Optimized for AI model providers (OpenAI, Anthropic, etc.)
- 🔄 Fallback Ready: Built-in model fallback capabilities
- 🔄 Load Balancing: Advanced algorithms including round-robin, weighted round-robin, and IP hash
- 🔒 Security: Built-in authentication, rate limiting, and token management
- 🔌 Plugin System: Extensible architecture for custom functionality
- ⚡ Real-time Config: Dynamic configuration without restarts
- ☁️ Cloud Agnostic: Deploy anywhere with cloud-agnostic architecture
# Clone the repository
git clone https://github.com/NeuralTrust/TrustGate.git
cd TrustGate
# Start the services
docker compose -f docker-compose.prod.yaml up -d
Coming soon
# Start dependencies
docker compose up -d redis postgres
# Run the servers
./scripts/run_local.sh
TrustGate consists of two main components:
-
Admin API (Port 8080)
- Gateway management
- Configuration management
- API key management
- Plugin configuration
-
Proxy API (Port 8081)
- Request routing
- Load balancing
- Plugin execution
TrustGate provides comprehensive monitoring through Prometheus metrics:
# config.yaml
metrics:
enabled: true # Enable metrics collection
enable_latency: true # Basic latency metrics
enable_upstream: true # Upstream latency tracking
enable_connections: true # Connection tracking
enable_per_route: true # Per-route metrics
trustgate_requests_total
- Request counts by gateway, method, and statustrustgate_latency_ms
- Overall request processing timetrustgate_detailed_latency_ms
- Granular latency by service/routetrustgate_upstream_latency_ms
- Upstream service latencytrustgate_connections
- Active connection tracking
scrape_configs:
- job_name: 'trustgate'
static_configs:
- targets: ['localhost:9090']
For detailed metrics documentation, dashboards, and advanced queries, see our Monitoring Guide.
Extend functionality with plugins:
type Plugin interface {
Name() string
Stages() []types.Stage
AllowedStages() []types.Stage
Execute(ctx *Context) error
}
- Rate Limiter
- Token Rate Limiter
- External API Call
- Data Masking (Pre-defined entities, custom keywords, regex)
- Prompt Moderation (keywords, regex)
- Toxicity Detection (Open AI Moderation API)
-
Jailbreak Protection
- Azure Prompt Guard
- AWS Prompt Guard
- GCP Prompt Guard
-
Toxicity Detection
- Azure Content Safety API
-
Prompt Moderation
- Topic detection (accepted/denied)
-
Network Security
- CORS protection
- SQL Injection prevention
- Cross-site injection protection
We love contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
TrustGate is licensed under the Apache License 2.0 - see the LICENSE file for details.
Made with ❤️ by NeuralTrust