Skip to content
← All projects
AI / ML Active ★ Featured Sep 2026

Eco-Guard

A self-hosted LLM inference gateway and MLOps control plane: an OpenAI-compatible API with multi-backend routing, content guardrails, cost tracking, a model registry with canary and blue-green deploys, and Prometheus and OpenTelemetry observability.

Source ★ 1
Eco-Guard
aillminference-gatewaymlopsguardrailsobservabilitykubernetesself-hostedpython
api endpoints
208
routers
12
test suite
173 tests
frontend pages
16
db migrations
8
backends
llama.cpp, Ollama, vLLM, TGI, OpenAI-compatible

Eco-Guard is a control plane for serving, observing and managing LLM inference on your own infrastructure. It presents an OpenAI-compatible API, routes to whichever inference backend you run, adds content safety and cost governance in front of it, and manages the model lifecycle behind it. The whole platform deploys as a single Docker container.

The inference gateway

The API is a drop-in for the OpenAI chat completions, embeddings and models endpoints, so any OpenAI SDK client works unchanged. Behind that surface it routes to llama.cpp, Ollama, vLLM, Hugging Face TGI or any OpenAI-compatible endpoint through a common backend interface, which means backends can be hot-swapped without a restart. It supports streaming over server-sent events, model-specific chat templates for Llama 3, Mistral, ChatML, Gemma and Zephyr, OpenAI-compatible function calling, batch inference of up to 100 prompts, and fallback chains with per-step timeouts.

Content safety

A guardrails pipeline runs with per-stage actions: block, flag, sanitize or allow. It detects prompt injection and jailbreak patterns, redacts PII such as card numbers, emails, phone numbers and IP addresses, classifies self-harm, violence and hate speech, and flags prompt anomalies like spam floods and unusual token counts.

Cost and governance

Per-model pricing is pre-configured, requests can be compared across six providers before they run, and workspaces carry budget caps with alert thresholds. Token counting uses tiktoken with a heuristic fallback, every administrative action is audit-logged, and GDPR export and deletion endpoints are built in.

MLOps

A model registry moves models through Registered, Staging, Production and Archived with checksum verification and rollbacks. Deployments support direct, canary, blue-green and A/B strategies, with automated evaluation gating rollouts on pass or fail thresholds. Drift detection uses a statistical Z-score and can trigger retraining, experiments log metrics per step, and a leaderboard ranks models by latency, accuracy, token efficiency and drift. There is also a RAG pipeline for ingestion, chunking, embedding and retrieval.

Observability and platform

Prometheus metrics, OpenTelemetry tracing with an OTLP exporter, structured JSON logs with request correlation, a real-time WebSocket for live metrics and a 17-panel Grafana dashboard. On the platform side there is multi-tenancy with roles and token quotas, JWT cookies with brute-force protection and scrypt hashing, hashed API keys, Google and GitHub SSO, a Redis-backed sliding-window rate limiter and circuit breaker, CIDR IP allowlisting, and GitOps configuration with hot reload. The security posture is explicit: no analytics, no tracking, no phone-home.

Deployment

Docker Compose brings up the API with PostgreSQL 15 and Redis 7 with health checks and migrations. A Helm chart adds a Deployment, Service, Ingress, HorizontalPodAutoscaler, NetworkPolicy, PodDisruptionBudget, ServiceMonitor and PersistentVolumeClaim, and a Terraform module covers infrastructure as code.

The hard part

  • Hot-swapping inference backends. Different engines expose different APIs, so a common backend interface with OpenAI compatibility on the outside was the only way to change engines without touching clients or restarting.
  • Shared state across workers. Rate limits, circuit breakers and WebSocket broadcasts cannot live in process memory once more than one worker runs, so they are Redis-backed with an in-memory fallback for single-process use.
  • Content safety without leaking data. Guardrails have to catch injection and PII while processing prompts locally, which rules out a third-party safety API for a self-hosted product.
  • Cost governance across tenants. Budget caps, token counting and per-model pricing all have to hold per workspace, not globally.

Outcome

  • 208 API endpoints across 12 routers, covering inference, MLOps, enterprise administration, production traces and a toolkit layer.
  • 173 tests across unit, integration and end-to-end suites.
  • A 16-page Vue 3 dashboard plus a Python SDK and CLI that drop in for the OpenAI SDK.
  • Docker Compose, a Helm chart and a Terraform module for deployment.
  • GDPR export and right-to-deletion endpoints, audit logging, and a documented no-telemetry policy.
  • A 17-panel Grafana dashboard and Prometheus alerts shipped in the repo.

What I'd do differently

  • Process memory is not shared state. Once the deployment runs more than one worker, every rate limit and breaker has to move to Redis, with an explicit single-process fallback.
  • Hashing is the default for secrets. API keys are stored as SHA-256 hashes and admin passwords use scrypt, so a database leak does not hand over credentials.
  • A self-hosted product should not phone home. No analytics, no tracking and local-only guardrails are part of the product, not an afterthought.
  • Ship the operations, not just the app. A Helm chart, migrations, health checks and a Grafana dashboard are what make it deployable.

Architecture & screenshots