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 twelve 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.16.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. The InternalChatClient interface, in the core module, 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 twelve 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-providers | core | the provider adapters (OpenAI, Anthropic, Gemini, Bedrock, Vertex AI and the others) and the Mock provider, as a library with no auto-configuration |
dvara-gateway-config | core | the gateway.yaml format and its loader, bootstrap seeding and the gateway's settings classes, with no auto-configuration |
dvara-gateway-policy | core, pii-detection | the policy, PII and guardrail engines, with no auto-configuration |
dvara-gateway-policy-autoconfigure | policy | registers the policy, PII and guardrail engines as Spring Boot beans |
dvara-gateway-autoconfigure | core, providers, config, rate-limiting | the wiring: providers, routing, resilience, the file audit writer and the gateway.yaml store |
dvara-spring-boot-starter | core, autoconfigure, policy, policy-autoconfigure | one dependency for your own application. No code of its own |
dvara-gateway-runtime | autoconfigure, policy, policy-autoconfigure | 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, the key and audit-check commands, 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 |
From 1.16.0 the provider adapters, the gateway.yaml format and the policy engines are libraries of their own, so
an application can use one without the Spring Boot wiring. The two starters bring in the new modules themselves;
an application that depends on the starters needs no change.