Quickstart

Deploy the Gateway
in 5 minutes.

Run Avarana as a Docker container to intercept LLM traffic, redact PII, and route queries to cost-effective models. Self-host in your European region.

5 min setup·Prerequisites: Docker
1

Pull the Docker Image

The Avarana Gateway is distributed as a Docker image. Pull it directly or clone the repository if you want to customize the source.

terminal
bash
1# Pull the Avarana Gateway image
2docker pull avarana/gateway:latest
3
4# Or clone the repository for customization
5git clone https://github.com/avarana/gateway.git
6cd gateway
Self-Hosted
The gateway runs entirely in your infrastructure. No data is sent to external services except the LLM providers you configure.
2

Configure the Gateway

Create a config.yaml file to define your providers, redaction rules, and routing policies.

config.yaml
yaml
1# config.yaml
2# Avarana Gateway Configuration
3
4providers:
5 openai:
6 base_url: https://api.openai.com/v1
7 api_key: ${OPENAI_API_KEY}
8 anthropic:
9 base_url: https://api.anthropic.com
10 api_key: ${ANTHROPIC_API_KEY}
11
12# PII Detection & Redaction (Presidio-based)
13redaction:
14 enabled: true
15 types:
16 - PERSON
17 - EMAIL
18 - PHONE_NUMBER
19 - CREDIT_CARD
20 - US_SSN
21
22# Cost-Aware Routing
23routing:
24 enabled: true
25 default_model: gpt-4o
26 rules:
27 - name: simple-queries
28 condition:
29 max_tokens: 100
30 route_to: llama-3-70b
31 - name: complex-queries
32 route_to: gpt-4o
33
34# Audit Logging
35logging:
36 enabled: true
37 output: ./logs
38 include_prompts: false # Set true for debugging only
REDACTION
Presidio-based PII detection before LLM calls
ROUTING
Rule-based routing to cost-optimal models
LOGGING
Audit logs to storage you control
3

Set Your API Keys

Create a .env file with your LLM provider API keys. Avarana uses your keys directly (BYOK).

.env
bash
1# .env
2OPENAI_API_KEY=sk-your-openai-key
3ANTHROPIC_API_KEY=sk-ant-your-anthropic-key
BYOK (Bring Your Own Keys)
You supply your own API keys. Avarana does not have access to your keys or bill you for model usage. You pay your providers directly.
4

Start the Gateway

Use Docker Compose to start the gateway. It will listen on port 8080 and proxy requests to your configured providers.

docker-compose.yaml
yaml
1# docker-compose.yaml
2version: '3.8'
3services:
4 avarana:
5 image: avarana/gateway:latest
6 ports:
7 - "8080:8080"
8 volumes:
9 - ./config.yaml:/app/config.yaml
10 - ./logs:/app/logs
11 env_file:
12 - .env
terminal
bash
1# Start the gateway
2docker compose up -d
3
4# Check the logs
5docker compose logs -f avarana
5

Test the Integration

Point your application to http://localhost:8080 instead of the OpenAI API. The gateway exposes an OpenAI-compatible endpoint.

terminal
bash
1# Test the gateway (uses OpenAI-compatible API)
2curl http://localhost:8080/v1/chat/completions \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "gpt-4o",
6 "messages": [
7 {"role": "user", "content": "Analyze customer John Doe, SSN 555-01-9999"}
8 ]
9 }'
10
11# Response shows redacted values sent to OpenAI:
12# "content": "Analyzing customer [REDACTED_NAME], SSN [REDACTED_SSN]..."
Transparent Proxy
Your existing code works unchanged. Just swap the base URL. The gateway handles redaction and routing transparently.