LLM egress router · one door, three Gemini tiers, a guard on both sides
agentgateway front (Keycloak JWT · guard webhook · token budget · cost log) → vLLM Semantic Router (domain + keyword signals) → agentgateway egress → Vertex AI · guards = presidio-guard + nemo-guard (two deployments) · ledger in Postgres over OTLP · ops-chat (React + FastAPI) registers MCP servers and runs their tools through the MCP gateway of project 1
CALLERS · one token, two doors
THE LLM DOOR · llm.jainosoft.com · namespace llm
VERTEX AI · cloud models only
ops-chat React 19 + FastAPI chat.jainosoft.com · OIDC · Postgres MCP servers registered per user
any OpenAI SDK base_url = llm.…/v1 · model auto
n8n · agents · CI same Keycloak token
MCP gateway · project 1 mcp.jainosoft.com · CEL per role ops-chat's tools run as the user k8s · ops-db · gcp · github
tools
Cloudflare Tunnel TLS at the edge · no public IP shared with project 1
agentgateway · front :4000
1 · identity Keycloak JWT · aud agentgateway 401 without it
2 · guards (request) presidio-guard masks PII · counts nemo-guard self-check-input blocks 400 on jailbreak
3 · budget 50k tokens / user / hour 429 when spent
5 · guards (response) presidio-guard masks the answer nemo-guard self-check-output
ledger · Postgres access log (OTLP) + guards user · model · tokens · cost
4 · vLLM Semantic Router v0.4
Envoy ext_proc · ~130 ms to decide
signals domain classifier (MMLU: math, physics, chemistry, engineering, CS, other) + keywords
decisions (priority)
coding → gemini-3.8-flash reasoning → gemini-3.8-flash simple_chat → gemini-3.5-flash-lite general → gemini-3.5-flash default → gemini-3.5-flash
response headers: x-vsr-selected-decision, x-vsr-selected-model, routing latency
semantic cache (memory) · the router never holds a cloud credential: every tier is an alias for the egress →
agentgateway · egress :4100
cluster-internal · Workload Identity
(sa-llm-gateway, aiplatform.user)
from the router tier chosen per prompt
from the front pinned tiers (comparison drills)
from the guard NeMo's judge model (flash-lite)
one listener = one place where every Gemini call of the platform is metered: gen_ai.request.model · tokens agw.ai.usage.cost.total
gemini-3.5-flash-lite cheapest · small talk, rewrites $0.10 / $0.40 per 1M
gemini-3.5-flash default · general questions $0.30 / $2.50 per 1M
gemini-3.8-flash strongest · code, maths, reasoning $0.50 / $3.00 per 1M
no GPU, no self-hosted model: the switching is the project, the tiers are whatever the cloud sells.
MEASURED (recorded run)
· · · · ·
a normal prompt: guard pass → router → tier → answer, logged with cost a prompt with personal data: masked before the model, counted a jailbreak: refused at the door, no model involved