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 want | Add | What you get |
|---|---|---|
| Your application calls the engines — evaluate a policy, redact PII, run a guardrail, rate-limit, write an audit record | dvara-spring-boot-starter | the engines as beans. It maps no URLs. |
| Your application also serves the OpenAI-compatible API | dvara-spring-boot-starter-gateway | the first starter plus dvara-gateway-runtime. It claims /v1/** in your application. |
| The gateway as a process | dvara-gateway-server | the 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.
| module | depends on | what it is |
|---|---|---|
dvara-gateway-core | nothing | the interfaces and the domain model; no Spring |
dvara-pii-detection | core | the structured PII detectors |
dvara-rate-limiting | core | the in-process rate limiter and the per-workspace limit resolver |
dvara-gateway-policy | core, pii-detection | the policy, PII and guardrail engines |
dvara-gateway-autoconfigure | core, rate-limiting | the wiring: providers, routing, resilience, the file audit writer and the gateway.yaml store |
dvara-spring-boot-starter | core, autoconfigure, policy | one dependency for your own application. No code of its own |
dvara-gateway-runtime | autoconfigure, policy | the /v1 request path as a library: controllers, DTOs, the dispatcher, the filter pipeline, metrics |
dvara-gateway-server | runtime | the standalone gateway: a main class and three resource files |
dvara-spring-boot-starter-gateway | starter, runtime | one dependency for an application that should also serve the API. No code of its own |