How rishankreddy12/proofgate works
ProofGate is an OpenAI-compatible, multi-tenant LLM gateway. Client requests enter through the public HTTP API, are authenticated and processed by an ordered policy pipeline, then routed to provider adapters; results and usage are returned and recorded. Separate branches provide embeddings, MCP governance, administration, and evidence-based cache/routing optimization. PostgreSQL, Redis, and ClickHouse serve distinct control-plane, coordination/cache, and telemetry roles. Some subsystem links reflect README-documented behavior because their implementation files were not sampled.
Main entry points: app/pipeline.go Stage Wiring · routes.go HTTP Routes · pipeline/pipeline.go Stage Pipeline · route.go Route Executor
Components 24
Gateway API
- HTTP Routes
internal/server/routes.go - Chat Handler
internal/server/chat.go - Embeddings
internal/server/embeddings.go - API Authentication
internal/auth/middleware.go
Request Execution
- Stage Pipeline
internal/pipeline/pipeline.go - Stage Wiring
internal/app/pipeline.go - Rate Limits
internal/ratelimit/limiter.go - Tenant Budgets
internal/budget/budget.go - Privacy Guardrails
internal/guard/stage.go - Route Executor
internal/router/route.go - Provider Adapters
internal/provider/gemini.go
Proof and Governance
- MCP Proxy
internal/mcpproxy/proxy.go - Response Cache
internal/cache/stage.go - Smart Routing
internal/smartroute/stage.go - Quality Judge
internal/proof/judge.go - Agent Run Limits
internal/agentrun/runs.go
Control and Operations
- Admin CLI
cmd/proofgatectl/main.go - Admin Sessions
internal/adminauth/session.go - Gateway Runtime
cmd/proofgate/main.go
State and Telemetry
- PostgreSQL
- Redis
- ClickHouse
internal/analytics/clickhouse.go - Metrics
internal/telemetry/metrics.go
Other components
- API Client
Connections 30
- API Client → HTTP Routes: sends requests
internal/server/routes.go - HTTP Routes → API Authentication: authenticates API
internal/server/routes.go - HTTP Routes → Chat Handler: dispatches chat
internal/server/routes.go - HTTP Routes → Embeddings: dispatches embeddings
internal/server/routes.go - HTTP Routes → MCP Proxy: mounts proxy
internal/server/routes.go - API Authentication → PostgreSQL: looks up keys
internal/auth/middleware.go - Chat Handler → Stage Pipeline: runs stages
- Stage Wiring → Stage Pipeline: constructs stages
internal/app/pipeline.go - Stage Wiring → Rate Limits: registers stage
internal/app/pipeline.go - Stage Wiring → Tenant Budgets: registers stage
internal/app/pipeline.go - Stage Wiring → Privacy Guardrails: registers stage
internal/app/pipeline.go - Stage Wiring → Response Cache: registers stage
internal/app/pipeline.go - Stage Wiring → Smart Routing: registers stage
internal/app/pipeline.go - Stage Wiring → Agent Run Limits: registers stage
internal/app/pipeline.go - Stage Pipeline → Route Executor: dispatches requests
internal/pipeline/pipeline.go - Route Executor → Provider Adapters: executes target
README.md - Embeddings → Route Executor: executes embedding
internal/server/embeddings.go - Rate Limits → Redis: coordinates limits
README.md - Tenant Budgets → Redis: reserves spend
README.md - Response Cache → Redis: stores responses
README.md - Smart Routing → Quality Judge: records quality evidence
README.md - MCP Proxy → ClickHouse: audits calls
README.md - Stage Wiring → Metrics: registers stage
internal/app/pipeline.go - Metrics → ClickHouse: records usage
README.md - Gateway Runtime → Stage Wiring: builds pipeline
- Gateway Runtime → HTTP Routes: starts gateway
- Admin CLI → PostgreSQL: manages records
cmd/proofgatectl/main.go - Admin CLI → Admin Sessions: manages sessions
- Admin Sessions → PostgreSQL: persists sessions
internal/adminauth/session.go - Agent Run Limits → Redis: tracks run budgets
README.md