Skip to main content
Version: 1.10.0-dev

Use the open-source gateway as a library

Reference for the open-source DVARA LLM Gateway, run from one gateway.yaml. The quickstart gets it running.

The gateway is nine Maven modules, and three of them are the ways in:

You wantAddWhat you get
Your application calls the engines — evaluate a policy, redact PII, run a guardrail, rate-limit, write an audit recorddvara-spring-boot-starterthe engines as beans. It maps no URLs.
Your application also serves the OpenAI-compatible APIdvara-spring-boot-starter-gatewaythe first starter plus dvara-gateway-runtime. It claims /v1/** in your application.
The gateway as a processdvara-gateway-serverthe standalone gateway from the quick start.
<dependency>
<groupId>com.dvarahq</groupId>
<artifactId>dvara-spring-boot-starter</artifactId>
<version>1.9.0</version>
</dependency>

dvara-spring-boot-starter-gateway takes the same version. The artifacts are under the com.dvarahq group. A tagged release is published to Maven Central; a -SNAPSHOT version is not, so ./mvnw install puts that one in your local repository.

Model calls the application makes for itself​

An application built on dvara-gateway-runtime sometimes needs a model call of its own: to grade an answer, or to decide which model a request needs. InternalChatClient in dvara-gateway-core sends one through the same path as a caller's request, so the same policies, PII rules, guardrails and budgets apply. Its usage and cost rows go to the workspace and key you name:

ChatResponse answer = internalChatClient.chat(request,
new InternalCall("grading", workspaceId, "internal-grading", callersTraceId));

The response cache is not used. Each call writes an INTERNAL_CALL audit record with its kind, its own trace id and the caller's. While it runs, InternalCall.current() names it on that thread, and a second internal call started from inside it is refused. Only non-streaming calls are supported.

Modules​

The nine modules and what each depends on

Each module depends only on the ones above it.

moduledepends onwhat it is
dvara-gateway-corenothingthe interfaces and the domain model; no Spring
dvara-pii-detectioncorethe structured PII detectors
dvara-rate-limitingcorethe in-process rate limiter and the per-workspace limit resolver
dvara-gateway-policycore, pii-detectionthe policy, PII and guardrail engines
dvara-gateway-autoconfigurecore, rate-limitingthe wiring: providers, routing, resilience, the file audit writer and the gateway.yaml store
dvara-spring-boot-startercore, autoconfigure, policyone dependency for your own application. No code of its own
dvara-gateway-runtimeautoconfigure, policythe /v1 request path as a library: controllers, DTOs, the dispatcher, the filter pipeline, metrics
dvara-gateway-serverruntimethe standalone gateway: a main class and three resource files
dvara-spring-boot-starter-gatewaystarter, runtimeone dependency for an application that should also serve the API. No code of its own