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 image2docker pull avarana/gateway:latest34# Or clone the repository for customization5git clone https://github.com/avarana/gateway.git6cd gatewaySelf-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.yaml2# Avarana Gateway Configuration34providers:5 openai:6 base_url: https://api.openai.com/v17 api_key: ${OPENAI_API_KEY}8 anthropic:9 base_url: https://api.anthropic.com10 api_key: ${ANTHROPIC_API_KEY}1112# PII Detection & Redaction (Presidio-based)13redaction:14 enabled: true15 types:16 - PERSON17 - EMAIL18 - PHONE_NUMBER19 - CREDIT_CARD20 - US_SSN2122# Cost-Aware Routing23routing:24 enabled: true25 default_model: gpt-4o26 rules:27 - name: simple-queries28 condition:29 max_tokens: 10030 route_to: llama-3-70b31 - name: complex-queries32 route_to: gpt-4o3334# Audit Logging35logging:36 enabled: true37 output: ./logs38 include_prompts: false # Set true for debugging onlyREDACTION
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# .env2OPENAI_API_KEY=sk-your-openai-key3ANTHROPIC_API_KEY=sk-ant-your-anthropic-keyBYOK (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.yaml2version: '3.8'3services:4 avarana:5 image: avarana/gateway:latest6 ports:7 - "8080:8080"8 volumes:9 - ./config.yaml:/app/config.yaml10 - ./logs:/app/logs11 env_file:12 - .envterminal
bash
1# Start the gateway2docker compose up -d34# Check the logs5docker compose logs -f avarana5
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 }'1011# 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.
