DVĀRA (द्वार) — Avyay Unified API Gateway
द्वार (DVĀRA) — Sanskrit for “gateway” or “door”
DVĀRA is the unified API gateway for all Avyay AI products. It provides a single endpoint with authentication, rate limiting, and usage tracking for MĀRGA, RAKṢĀ, and DevOps RAG.
Architecture
┌──────────────┐
│ Clients │
└──────┬───────┘
│
┌──────▼───────┐
│ DVĀRA │
│ Gateway │
│ :9000 │
└──────┬───────┘
│
┌────────────────┼────────────────┐
│ │ │
┌──────▼──────┐ ┌──────▼──────┐ ┌───────▼──────┐
│ MĀRGA │ │ RAKṢĀ │ │ DevOps RAG │
│ LLM Router │ │ Scanner │ │ Knowledge │
│ :8080 │ │ :8080 │ │ :8080 │
└─────────────┘ └─────────────┘ └──────────────┘Features
- Unified Authentication: Single API key for all services via
X-API-Keyheader or Bearer token - Rate Limiting: Per-key and global rate limits to prevent abuse
- Usage Tracking: Monitor API usage by service and key with
/v1/gateway/usage - Health Aggregation: Single
/healthendpoint checks all backend services - Service Routing: Automatic request routing to the correct backend
Quick Start
docker pull ghcr.io/gaurav21/avyay-gateway:latest
docker run -p 9000:9000 \
-e MARGA_URL=http://marga:8080 \
-e RAKSHA_URL=http://raksha:8080 \
-e DEVOPS_RAG_URL=http://devops-rag:8080 \
ghcr.io/gaurav21/avyay-gateway:latestEndpoints
| Method | Path | Service | Description |
|---|---|---|---|
GET | / | Gateway | Gateway info and registered services |
GET | /health | Gateway | Health check for all services |
GET | /v1/gateway/usage | Gateway | Usage statistics (admin) |
POST | /v1/marga/chat/completions | MĀRGA | Chat completions via LLM Router |
GET | /v1/marga/metrics | MĀRGA | Router metrics (Prometheus format) |
GET | /v1/marga/usage | MĀRGA | MĀRGA usage statistics |
POST | /v1/raksha/scan/upload | RAKṢĀ | Upload code for scanning |
POST | /v1/raksha/scan/github | RAKṢĀ | Scan GitHub repository |
GET | /v1/raksha/scan/{"{id}"} | RAKṢĀ | Get scan results |
POST | /v1/devops-rag/ask | DevOps RAG | Ask a DevOps question |
GET | /v1/devops-rag/stats | DevOps RAG | Index statistics |
Authentication
All requests (except / and /health) require authentication:
# Using X-API-Key header
curl -H "X-API-Key: your-api-key" http://localhost:9000/v1/marga/chat/completions
# Using Bearer token
curl -H "Authorization: Bearer your-api-key" http://localhost:9000/v1/marga/chat/completionsExample: Chat Completion via Gateway
curl -X POST http://localhost:9000/v1/marga/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello from DVĀRA!"}]
}'Example: Security Scan via Gateway
curl -X POST http://localhost:9000/v1/raksha/scan/github \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{"url": "https://github.com/your-org/your-repo"}'Example: DevOps Question via Gateway
curl -X POST http://localhost:9000/v1/devops-rag/ask \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{"question": "How do I fix CrashLoopBackOff?"}'