Skip to main content
Version: 1.16.0

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 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.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.

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-providerscorethe provider adapters (OpenAI, Anthropic, Gemini, Bedrock, Vertex AI and the others) and the Mock provider, as a library with no auto-configuration
dvara-gateway-configcorethe gateway.yaml format and its loader, bootstrap seeding and the gateway's settings classes, with no auto-configuration
dvara-gateway-policycore, pii-detectionthe policy, PII and guardrail engines, with no auto-configuration
dvara-gateway-policy-autoconfigurepolicyregisters the policy, PII and guardrail engines as Spring Boot beans
dvara-gateway-autoconfigurecore, providers, config, rate-limitingthe wiring: providers, routing, resilience, the file audit writer and the gateway.yaml store
dvara-spring-boot-startercore, autoconfigure, policy, policy-autoconfigureone dependency for your own application. No code of its own
dvara-gateway-runtimeautoconfigure, policy, policy-autoconfigurethe /v1 request path as a library: controllers, DTOs, the dispatcher, the filter pipeline, metrics
dvara-gateway-serverruntimethe standalone gateway: a main class, the key and audit-check commands, 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

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.