NeuralTrust/TrustGate
Self-hosted Go gateway for routing and governing LLM, MCP and agent traffic.
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
TrustGate builds one Go binary from cmd/trustgate/; the supplied go.mod declares Go 1.27.4. The default process serves the LLM proxy on 8081. The admin, mcp and agent modes serve ports 8080, 8082 and 8084 respectively, while run combines only admin and proxy for a single node. Separate processes let teams scale model, tool and agent traffic independently. The admin plane owns migrations and configuration and can sync that configuration to data planes without giving them direct PostgreSQL access. The proxy uses Redis.
Incoming traffic is resolved to an application and caller before the gateway applies policies and dispatches upstream. The LLM proxy handles dialect conversion and streaming, the MCP plane aggregates tools, and the agent plane forwards A2A traffic. pkg/api/ contains handlers and middleware, pkg/app/ contains routing, authorization and protocol services, and pkg/infra/ contains provider and policy adapters, persistence, config sync and telemetry. Policy stages run before requests, before responses and on streams.
Key Capabilities & Differentiators
The LLM plane targets 17 provider options, including OpenAI, Anthropic, Azure OpenAI, Bedrock and Google Vertex AI, plus OpenAI-compatible backends such as vLLM and Ollama. Clients can use OpenAI Chat Completions or Responses, Anthropic Messages, Gemini or Vertex AI, Cohere Chat or native Bedrock dialects. Routing includes trigger-based fallback with an attempt budget, smart routing across two or three ordered models, and round-robin, weighted, least-connections, random or semantic balancing. A provider failure mid-stream is surfaced as an error event in the client dialect instead of a seemingly complete result.
MCP aggregates MCP servers and OpenAPI services behind one endpoint with per-user upstream credentials. A2A 0.3 and 1.0 support pinned agent cards, task ownership and delegated identity. Application keys, OIDC claim rules and mTLS feed application- or caller-level rate limits, token or dollar budgets and model or tool allowlists. Policies can enforce or observe, with throttling available for rate limits. Semantic caching, external guardrails and per-gateway OTLP exports round out the shared policy and telemetry layer.
Trade-offs & Limitations
Compared with calling the OpenAI API directly, TrustGate trades a shorter request path and direct access to native provider behavior for centrally enforced identity, budgets, failover and tool policy. A familiar API dialect lowers migration effort, but is not a guarantee of cross-provider feature parity. Test tool-call semantics, stream events and endpoint-specific fields before switching a route. Retries on the same provider are disabled by default; when enabling retries or fallback, budget for additional upstream attempts, latency and potential charges.
The shared gateway also becomes a service that teams must monitor and operate. Private-network egress is allowed by default; set OUTBOUND_ALLOW_PRIVATE_NETWORKS=false when untrusted users can configure upstreams, and review network controls independently. Raw OTLP exporters can carry payloads, and cloud models or guardrails can still receive data from a self-hosted gateway. The gateway and admin API are Apache-2.0; evaluate paid NeuralTrust platform features such as SSO, RBAC and longer retention separately from the gateway's application-level OIDC support.
Hardware & Deployment Guide
For evaluation, start from a checkout with make up, then verify /healthz on the admin, proxy and MCP ports and use examples/curl-first-request/first-request.sh with a valid OpenAI credential. The supplied docker-compose.yaml itself defines PostgreSQL 16 Alpine and Redis 7 Alpine; the full quick-start workflow also launches the TrustGate planes. .env.example covers the DB_* and REDIS_* settings, and admin JWT signing requires a SERVER_SECRET_KEY of at least 32 bytes. Bind or network-restrict the admin API, configure its TLS or put it behind a controlled TLS ingress, and replace the sample database credentials rather than exposing the Compose database and Redis ports as-is.
For separate plane deployment, k8s/ contains Kustomize bases and overlays. Go gateway capacity should be tested against concurrency, streaming duration, policy stages and telemetry volume; model-serving GPU requirements are separate. Release v1.1.0 added per-dimension rate limiting, Retry-After support and caps on parallel requests. v1.2.0 added client addresses to request spans; review collection, access and retention rules for those traces.
Platform teams governing multiple model providers and agent tools, with a need for shared identity, per-caller budgets, failover and traceability.
A single provider's native API meets your needs, you cannot operate an additional gateway and its backing services, or you need an inference engine rather than a proxy.
Quick Start & Installation
curl -fsSL https://raw.githubusercontent.com/NeuralTrust/TrustGate/main/scripts/install.sh | bash
Comparison vs. Top Agents & Frameworks Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| TrustGate ★ | 32 | +24 | Go | Apache-2.0 | Self-hosted Go gateway for routing and governing LLM, MCP and agent traffic. |
| pentagi | 35.7k | +489 | Go | MIT | Self-hosted multi-agent penetration testing with logs and reports for human revi |
| langfuse | 38.2k | +282 | TypeScript | — | OpenTelemetry platform for agent tracing and evals, with an AI gateway |
| hermes-agent | 268.1k | +1.5k | Python | MIT | Self-hosted Python agent with persistent memory and automation across chat and C |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/NeuralTrust/TrustGate.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about TrustGate
How do I put TrustGate in front of an existing OpenAI SDK client?
http://localhost:8081/my-app/v1, and select the gateway with X-AG-Gateway-Slug if using header-based selection. Before switching providers, test the features your client uses, particularly tool calls and streaming events.Does TrustGate need a GPU, and what should I size for?
Can we self-host it commercially and keep regulated data inside our network?
When is TrustGate a better fit than calling the OpenAI API directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy