TrustGate

April 1, 2025 ยท View on GitHub

AI Gateway Logo

A powerful, AI Gateway designed from scratch for AI

Go Reference Go Report Card License Docker Pulls GitHub Actions GitHub Actions

Documentation | Quick Start | Community

โœจ Features

  • ๐Ÿš€ 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

๐Ÿš€ Quick Start

Using Docker Compose

# Clone the repository
git clone https://github.com/NeuralTrust/TrustGate.git
cd TrustGate

# Clone env
cp .env.example .env

# Start the services
docker compose -f docker-compose.prod.yaml up -d

Using Kubernetes

Coming soon

Local Development

# Start dependencies
docker compose up -d redis postgres

# Run the servers
./scripts/run_local.sh

Run Unit Tests

make test

Run Functional Tests

make test-functional

๐Ÿ—๏ธ Architecture

TrustGate consists of two main components:

  1. Admin API (Port 8080)

    • Gateway management
    • Configuration management
    • API key management
    • Plugin configuration
  2. Proxy API (Port 8081)

    • Request routing
    • Load balancing
    • Plugin execution

๐Ÿ“Š Monitoring

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

Key Metrics

  • trustgate_requests_total - Request counts by gateway, method, and status
  • trustgate_latency_ms - Overall request processing time
  • trustgate_detailed_latency_ms - Granular latency by service/route
  • trustgate_upstream_latency_ms - Upstream service latency
  • trustgate_connections - Active connection tracking

Prometheus Configuration

scrape_configs:
  - job_name: 'trustgate'
    static_configs:
      - targets: ['localhost:9090']

For detailed metrics documentation, dashboards, and advanced queries, see our Monitoring Guide.

๐Ÿค Contributing

We love contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

๐Ÿ“œ License

TrustGate is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐ŸŒŸ Star History

Star History Chart

๐Ÿ“ซ Community & Support

Made with โค๏ธ by NeuralTrust