Skip to content

LLM Gateway Index

Document ID: LLM-INDEX-001
File Path: docs/05-llm-gateway/index.md
Version: 1.0.0
Status: Active
Owner: AI Platform Team
Last Updated: 2026-06-27


This document is the central navigation and architecture index for the LLM Gateway in the Wovyr AI Platform.

The LLM Gateway is the single, governed entry point through which every subsystem reaches an AI model provider. It turns the in-process Provider SDK into a shared, network-accessible platform service with centralized routing, resilience, cost control, caching, and observability.


These two components are deliberately separated. Understanding the boundary is essential.

ConcernProvider SDK (04-agent-framework)LLM Gateway (05-llm-gateway)
FormIn-process Rust libraryDeployable service / container
ScopeA single processThe whole platform / many tenants
AudienceAgent Runtime codeAny service over REST / gRPC / WebSocket
CredentialsReads provider keys at call siteHolds keys centrally; callers never see them
RoutingLibrary-level provider selectionFleet-wide, policy- and budget-aware routing
StateStateless helperShared cache, quotas, circuit-breaker state
GovernanceNoneTenant isolation, quotas, audit, cost ceilings

The Gateway embeds the Provider SDK to talk to providers. The SDK defines the provider abstraction; the Gateway operates it as infrastructure.

See C4 Container §4.5 for where the Gateway sits among deployable containers.


LLM Gateway
├── Provider API (external request/response contract)
├── Router (provider & model selection)
├── Resilience Engine (failover, retry, circuit breaking)
├── Streaming Engine (unified token / event streaming)
├── Token Manager (accounting, budgets, cost control)
├── Cache (exact + semantic response caching)
├── Credential Vault (secret references, key rotation)
└── Telemetry (logs, metrics, traces, cost events)

Caller (Agent Runtime / Workflow / Service)
│ REST / gRPC / WebSocket
Provider API ──► AuthN/Z + tenant resolution
Token Manager ──► budget & quota pre-check
Cache ──► hit? return immediately
│ miss
Router ──► select provider + model
Resilience Eng. ──► attempt, retry, failover
Provider SDK ──► provider adapter → provider API
Stream / collect ──► usage metering + cost event
Cache store ──► response returned to caller

A detailed sequence appears in Overview §6.


DocumentResponsibility
overview.mdService responsibilities, architecture, lifecycle, NFRs
provider-api.mdExternal request/response contract (REST + gRPC)
routing.mdProvider/model selection strategies and policies
resilience.mdFailover, retries, timeouts, circuit breaking
streaming.mdUnified streaming event protocol
token-management.mdToken accounting, budgets, cost control
caching.mdExact and semantic response caching

  1. One door for all models — no subsystem calls a provider directly.
  2. Provider-neutral contract — callers speak one schema regardless of vendor.
  3. Governed by default — every request is authenticated, metered, and audited.
  4. Resilient — provider failure degrades gracefully via failover.
  5. Cost-aware — budgets and quotas are enforced before spend occurs.
  6. Observable — every request emits logs, metrics, traces, and a cost event.
  7. Stateless callers, stateful gateway — shared cache and quotas live here.



VersionDateDescription
1.0.02026-06-27Initial LLM Gateway Index