A secure API key proxy for AI agents and tools.
889
.env files.REQUIRE_AGENT_AUTH (Default: true).The easiest way to start KeyRelay is via a simple Docker Run command. The official image is provided on Docker Hub.
docker run -d \
-p 8080:8080 \
-v keyrelay_data:/app/data \
--name keyrelay \
codingflexx/keyrelay:latest
Upon first start, the container automatically bootstraps your encrypted SQLite database (vault.db) and securely generates the master encryption key (.vault_key) inside the persisted volume.
http://localhost:8080/admin/ui in your browser.admin user and password.(Note for automated deployments: You can bypass the UI setup by passing -e BOOTSTRAP_ADMIN_USERNAME=admin and -e BOOTSTRAP_ADMIN_PASSWORD=your_password to your docker run command).
curl -X POST "http://localhost:8080/openai/chat/completions" \
-H "Authorization: Bearer <your-proxy-user-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hi"}]
}'
KeyRelay acts as a drop-in replacement for OpenAI-compatible SDKs (OpenClaw, LiteLLM, LangChain, etc.):
import openai
client = openai.OpenAI(
base_url="http://localhost:8080/openai/v1",
api_key="<your-proxy-user-key>",
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
KeyRelay supports three distinct security models (KEYRELAY_SECURITY_MODE), catering to different risk profiles.
hardened_localexamples/docker-compose.local.ymlhardened_localexamples/docker-compose.multi.ymlremote_secureexamples/docker-compose.remote.ymlFor detailed setup instructions regarding TLS, remote hosting, and the Python CLI (cli.py), please refer to the Documentation.
GET /health - Public health checkGET /health/services - Service status (Requires auth)GET /admin/ui - Admin Web DashboardGET /admin/audit-logs - Recent logs (Admin only)GET /admin/audit-stats - Traffic statistics (Admin only)| Variable | Default | Description |
|---|---|---|
AGENT_VAULT_APP_DIR | /app/data | Directory for the vault.db SQLite file |
REQUIRE_AGENT_AUTH | true | Enforce proxy authentication |
KEYRELAY_SECURITY_MODE | hardened_local | Security profile (local, hardened_local, remote_secure) |
CORS_ALLOWED_ORIGINS | localhost:3000,localhost:8080 | Allowed CORS origins |
MIT License.
Content type
Image
Digest
sha256:4ffced20a…
Size
66.2 MB
Last updated
7 months ago
docker pull codingflexx/keyrelay