# z33mscessex/offline-llm-gateway architecture

> Architecture diagram of the GitHub repository z33mscessex/offline-llm-gateway, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/z33mscessex/offline-llm-gateway
- Repository: https://github.com/z33mscessex/offline-llm-gateway

## Overview

Offline LLM Gateway packages local model serving behind an access-controlled LiteLLM API. The main workflow is a client request through the gateway to a local model, with Prometheus monitoring the services; offline networking and preloaded weights keep the stack self-hosted. The repository also provides direct Ollama calling, GPU/vLLM evaluation, load testing, and a local Kubernetes deployment. Relationships for unsampled runtime configuration are based on README statements; the excerpts do not expose the full Compose or service configuration.

Main entry points: [`litellm/config.yaml`](https://github.com/z33mscessex/offline-llm-gateway/blob/main/litellm/config.yaml) (LiteLLM gateway), [`colab/gateway_gpu.py`](https://github.com/z33mscessex/offline-llm-gateway/blob/main/colab/gateway_gpu.py) (GPU gateway evaluation), [`prometheus/prometheus.yml`](https://github.com/z33mscessex/offline-llm-gateway/blob/main/prometheus/prometheus.yml) (Prometheus), [`docker-compose.yml`](https://github.com/z33mscessex/offline-llm-gateway/blob/main/docker-compose.yml) (Compose stack)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deployment["Deployment and offline"]
  node_compose["Compose stack<br/>[docker-compose.yml]"]
  node_offline["Offline check<br/>[check_offline.sh]"]
end

subgraph group_gateway["Gateway and models"]
  node_gateway["LiteLLM gateway<br/>[config.yaml]"]
  node_ollama["Ollama model server"]
  node_vllm["vLLM GPU server<br/>[gateway_gpu.py]"]
  node_database[("Gateway database")]
  node_directcall["Direct Ollama caller<br/>[call_model.py]"]
end

subgraph group_operations["Monitoring and evaluation"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_loadtest["Load test<br/>[load_test.py]"]
  node_gpueval["GPU gateway evaluation<br/>[gateway_gpu.py]"]
end

subgraph group_kubernetes["Kubernetes deployment"]
  node_k8s["Kubernetes stack<br/>[stack.yaml]"]
  node_k8sup["Cluster launcher<br/>[k8s_up.sh]"]
  node_k8stest["Kubernetes tests job<br/>[tests-job.yaml]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_gateway
node_gateway -->|"routes requests"| node_ollama
node_gateway -->|"routes GPU requests"| node_vllm
node_gateway -->|"looks up keys"| node_database
node_directcall -->|"calls API"| node_ollama
node_compose -->|"configures service"| node_gateway
node_compose -->|"packages service"| node_ollama
node_prometheus -->|"scrapes metrics"| node_gateway
node_prometheus -->|"scrapes metrics"| node_ollama
node_prometheus -->|"scrapes metrics"| node_vllm
node_loadtest -.->|"measures load"| node_gateway
node_gpueval -->|"starts server"| node_vllm
node_gpueval -->|"starts gateway"| node_gateway
node_gpueval -->|"sends direct requests"| node_vllm
node_gpueval -->|"sends test requests"| node_gateway
node_offline -->|"checks isolation"| node_compose
node_k8sup -->|"deploys stack"| node_k8s
node_k8sup -->|"runs tests"| node_k8stest

click node_compose "https://github.com/z33mscessex/offline-llm-gateway/blob/main/docker-compose.yml"
click node_offline "https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/check_offline.sh"
click node_gateway "https://github.com/z33mscessex/offline-llm-gateway/blob/main/litellm/config.yaml"
click node_vllm "https://github.com/z33mscessex/offline-llm-gateway/blob/main/colab/gateway_gpu.py"
click node_directcall "https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/call_model.py"
click node_prometheus "https://github.com/z33mscessex/offline-llm-gateway/blob/main/prometheus/prometheus.yml"
click node_loadtest "https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/load_test.py"
click node_gpueval "https://github.com/z33mscessex/offline-llm-gateway/blob/main/colab/gateway_gpu.py"
click node_k8s "https://github.com/z33mscessex/offline-llm-gateway/blob/main/k8s/stack.yaml"
click node_k8sup "https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/k8s_up.sh"
click node_k8stest "https://github.com/z33mscessex/offline-llm-gateway/blob/main/k8s/tests-job.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_compose,node_offline,node_client toneBlue
class node_gateway,node_ollama,node_vllm,node_database,node_directcall toneAmber
class node_prometheus,node_loadtest,node_gpueval toneMint
class node_k8s,node_k8sup,node_k8stest toneRose
```

## Components

### Deployment and offline

- [Compose stack](https://github.com/z33mscessex/offline-llm-gateway/blob/main/docker-compose.yml): `docker-compose.yml`
- [Offline check](https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/check_offline.sh): `scripts/check_offline.sh`

### Gateway and models

- [LiteLLM gateway](https://github.com/z33mscessex/offline-llm-gateway/blob/main/litellm/config.yaml): `litellm/config.yaml`
- **Ollama model server**
- [vLLM GPU server](https://github.com/z33mscessex/offline-llm-gateway/blob/main/colab/gateway_gpu.py): `colab/gateway_gpu.py`
- **Gateway database**
- [Direct Ollama caller](https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/call_model.py): `scripts/call_model.py`

### Monitoring and evaluation

- [Prometheus](https://github.com/z33mscessex/offline-llm-gateway/blob/main/prometheus/prometheus.yml): `prometheus/prometheus.yml`
- [Load test](https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/load_test.py): `scripts/load_test.py`
- [GPU gateway evaluation](https://github.com/z33mscessex/offline-llm-gateway/blob/main/colab/gateway_gpu.py): `colab/gateway_gpu.py`

### Kubernetes deployment

- [Kubernetes stack](https://github.com/z33mscessex/offline-llm-gateway/blob/main/k8s/stack.yaml): `k8s/stack.yaml`
- [Cluster launcher](https://github.com/z33mscessex/offline-llm-gateway/blob/main/scripts/k8s_up.sh): `scripts/k8s_up.sh`
- [Kubernetes tests job](https://github.com/z33mscessex/offline-llm-gateway/blob/main/k8s/tests-job.yaml): `k8s/tests-job.yaml`

### Other components

- **API client**

## Connections

- API client → LiteLLM gateway: sends requests (evidence: `README.md`)
- LiteLLM gateway → Ollama model server: routes requests (evidence: `README.md`)
- LiteLLM gateway → vLLM GPU server: routes GPU requests (evidence: `README.md`)
- LiteLLM gateway → Gateway database: looks up keys (evidence: `README.md`)
- Direct Ollama caller → Ollama model server: calls API (evidence: `scripts/call_model.py`)
- Compose stack → LiteLLM gateway: configures service (evidence: `README.md`)
- Compose stack → Ollama model server: packages service (evidence: `README.md`)
- Prometheus → LiteLLM gateway: scrapes metrics (evidence: `README.md`)
- Prometheus → Ollama model server: scrapes metrics (evidence: `README.md`)
- Prometheus → vLLM GPU server: scrapes metrics (evidence: `README.md`)
- Load test → LiteLLM gateway: measures load
- GPU gateway evaluation → vLLM GPU server: starts server (evidence: `colab/gateway_gpu.py`)
- GPU gateway evaluation → LiteLLM gateway: starts gateway (evidence: `colab/gateway_gpu.py`)
- GPU gateway evaluation → vLLM GPU server: sends direct requests (evidence: `colab/gateway_gpu.py`)
- GPU gateway evaluation → LiteLLM gateway: sends test requests (evidence: `colab/gateway_gpu.py`)
- Offline check → Compose stack: checks isolation (evidence: `README.md`)
- Cluster launcher → Kubernetes stack: deploys stack (evidence: `README.md`)
- Cluster launcher → Kubernetes tests job: runs tests (evidence: `README.md`)
