Skip to main content

Quickstart

Get Dvara running and make your first API call in under 5 minutes.

Prerequisites

  • JDK 21 (or later)
  • Maven 3.9+ (or use the included ./mvnw wrapper)
  • At least one provider API key (e.g., OPENAI_API_KEY)

Step 1: Clone and Build

git clone https://github.com/kdhrubo/dvara.git
cd dvara
./mvnw clean install -DskipTests

Step 2: Set Your API Key

export OPENAI_API_KEY=sk-your-key-here

You can configure multiple providers at once:

export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=AIza...

Step 3: Start the Gateway

./mvnw -pl gateway-server spring-boot:run

The gateway starts on port 8080. You should see Spring Boot startup logs indicating the server is ready.

Step 4: Verify

Check that the gateway is running:

curl http://localhost:8080/status
# → JSON with status, providers, routes, and config version

Or open the built-in test panel in your browser: http://localhost:8080/try

List available models:

curl -s http://localhost:8080/v1/models | python3 -m json.tool

Step 5: Make Your First Request

curl -s -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "What is the capital of France?"}
]
}' | python3 -m json.tool

Response:

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 8,
"total_tokens": 22
}
}

Using the OpenAI SDK

Since Dvara is fully OpenAI-compatible, point any OpenAI SDK at it:

Python:

from openai import OpenAI

client = OpenAI(
api_key="any-key",
base_url="http://localhost:8080/v1"
)

response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello from Dvara!"}]
)
print(response.choices[0].message.content)

Node.js:

import OpenAI from "openai";

const client = new OpenAI({
apiKey: "any-key",
baseURL: "http://localhost:8080/v1",
});

const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello from Dvara!" }],
});
console.log(response.choices[0].message.content);

Step 6: Open the Admin Dashboard (Optional)

Start the admin UI in a separate terminal for real-time monitoring:

./mvnw -pl gateway-ui spring-boot:run

Open http://localhost:8090 to see live traffic metrics, provider health, and configuration status. See Admin UI Guide for details.

Next Steps