Self-Hosted LLM Gateway Guide for Engineers
A self-hosted LLM gateway provides a flexible, open-source solution for deploying large language models within your own infrastructure. It enables efficient model serving, inference, and routing without relying on external vendors.
This guide covers the deployment options, architecture considerations, configuration, and common use cases for a self-hosted LLM gateway, helping engineers implement a scalable and maintainable AI infrastructure.
What is a Self-Hosted LLM Gateway?
A self-hosted LLM gateway acts as an intermediary layer that routes requests to various model instances within your environment. It supports different deployment shapes, including standalone proxies, containerized setups, and on-premises systems.
The gateway is designed to integrate with model serving frameworks, providing a unified API surface and enabling advanced routing strategies, load balancing, and fallback mechanisms.
Deployment Shapes and Options
Depending on your infrastructure, the self-hosted LLM gateway can be deployed in multiple forms:
Laptop or Single VM
For development or testing, the gateway can run on a laptop or a single virtual machine using the osr-models binary or docker run. This setup offers an Ollama-equivalent experience with commands like osr-models pull, osr-models run, and osr-models ps.
Docker Compose and Platform Stacks
In production environments, the gateway is typically deployed as part of a Docker Compose stack or platform-specific setup. Each profile (e.g., llm, gpt-oss, voice) runs as a separate service, with the gateway acting as a central routing component. The controller runs inside the gateway container, managing model instances.
Cloud and Kubernetes
For cloud deployments, such as Azure Container Apps or Kubernetes, the gateway can be scaled using container orchestration tools. Kubernetes deployments may include Helm charts, Deployment objects, StatefulSet, and KEDA for autoscaling based on metrics.
