Docs/BYOP
Self-hosted

Bring Your Own Proxy

Run the KeyVault Edge proxy inside your own VPC, Kubernetes cluster, or bare-metal server. Same token validation and key injection — your traffic never leaves your infrastructure.

When to use BYOP

Data residency requirements

SOC 2, HIPAA, or GDPR constraints that forbid traffic leaving a specific region or cloud provider.

Low-latency private networks

Your application servers and AI API calls are on the same cloud — no reason to route through a public proxy.

Custom middleware needed

You want to inject your own request logging, tenant routing, or payload transformation before forwarding.

Air-gapped environments

Your deployment has no outbound internet access — BYOP runs entirely on your internal network.

If none of these apply, the hosted proxy at proxy.keyvaultedge.com is simpler — no infrastructure to manage.

Prerequisites

  • A KeyVault Edge account — tokens are issued from the dashboard regardless of which proxy handles traffic
  • Your MASTER_KEY, HMAC_KEY, and DASHBOARD_API_KEY from Vercel / your dashboard deployment
  • Node.js 20+ (bare metal), Docker 24+, or a Kubernetes cluster with Helm 3+
  • Outbound HTTPS access to your upstream API providers (OpenAI, Anthropic, etc.)

Setup

1

Deploy the proxy

Choose your deployment method. All three produce an HTTP server on port 3001 (configurable via PORT).

services:  kve-proxy:    image: ghcr.io/trevor-crypto243/keyvault-edge/byop:latest    restart: unless-stopped    ports:      - "3001:3001"    environment:      PORT: "3001"      MASTER_KEY: "${MASTER_KEY}"      HMAC_KEY: "${HMAC_KEY}"      DASHBOARD_API_URL: "https://keyvaultedge.com"      DASHBOARD_API_KEY: "${DASHBOARD_API_KEY}"      RATE_LIMIT_WINDOW_MINUTES: "1"      RATE_LIMIT_MAX_REQUESTS: "1000"    healthcheck:      test: ["CMD", "curl", "-f", "http://localhost:3001/v1/status"]      interval: 30s      timeout: 5s      retries: 3
2

Configure TLS (production)

The BYOP server speaks plain HTTP — put a TLS-terminating reverse proxy in front of it. Nginx or Caddy work well. If you're on Kubernetes, your ingress controller handles this.

nginx.conf
# Nginx reverse proxy with TLS terminationserver {    listen 443 ssl;    server_name proxy.yourdomain.com;     ssl_certificate     /etc/ssl/proxy.crt;    ssl_certificate_key /etc/ssl/proxy.key;     location / {        proxy_pass http://localhost:3001;        proxy_set_header Host $host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_read_timeout 60s;    }}
3

Point your token at the BYOP host

In the dashboard, go to Tokens → Edit and set the Proxy Host field to your BYOP URL (e.g. https://proxy.internal). The token will now only work when requests arrive through your proxy.

Host binding applies to BYOP too. The token is bound to the domains you specified at creation time — requests from unexpected domains are still rejected.
4

Test the connection

Replace the URL with your BYOP host and your token.

bash
# Test the BYOP proxy is forwarding correctlycurl https://your-proxy.internal/v1/chat/completions \  -H "Authorization: Bearer kvt_your_token_here" \  -H "Content-Type: application/json" \  -H "X-KV-Target: openai" \  -d '{    "model": "gpt-4o",    "messages": [{ "role": "user", "content": "Hello" }]  }'

A 200 from the upstream provider means end-to-end decryption and forwarding are working. Check GET /v1/status on the BYOP host for a health summary.

Environment variables

VariableRequiredDescription
MASTER_KEYYesAES-256 key encryption key. Must match the value used by the dashboard.
HMAC_KEYYesHMAC-SHA256 signing key. Must match the dashboard value.
DASHBOARD_API_URLYesBase URL of your KeyVault Edge dashboard (e.g. https://keyvaultedge.com).
DASHBOARD_API_KEYYesInternal API key for breach event logging back to the dashboard.
PORTNoHTTP port to listen on. Default: 3001.
RATE_LIMIT_WINDOW_MINUTESNoRate limit window in minutes. Default: 1.
RATE_LIMIT_MAX_REQUESTSNoMax requests per window. Default: 1000.
LOG_LEVELNoLogging verbosity: error | warn | info | debug. Default: info.

Feature parity with the hosted proxy

Token validation
AES-256-GCM key decryption
Host-binding enforcement
Rate limiting
Breach event logging
Ephemeral session tokens
Cost cap enforcement
Cloudflare global PoP network
Automatic DDoS protection
Zero-config TLS

Related docs