βŒ• Search… ⌘K
GitHub
Open Source Β· Apache 2.0 Β· v0.1.0

LLM API key management
for modern teams

Provision scoped, trackable, revocable vendor API keys β€” without a proxy. One leaked key used to mean full org exposure. Not anymore.

4
Vendors Supported
0ms
Added Latency
100%
Audit Coverage
1 cmd
Docker Deploy
βœ“ key.provision
sk-proj-...7xKm
audit logged
The Problem

One shared key = full org exposure

Your org has one OpenAI key shared across 100+ developers. No audit trail, no per-developer budgets, no way to revoke one person without rotating for everyone.

βœ— No per-developer visibility
βœ— Can't revoke individual access
βœ— No budget controls per user
βœ— No audit trail of key usage
The Solution

Real keys, scoped per developer

KeyGate uses vendor Admin APIs to create scoped projects/workspaces per developer and issue real API keys. Developers talk directly to the vendor β€” no proxy, no latency, no SDK changes.

βœ“ Per-developer scoped API keys
βœ“ Instant revocation at vendor level
βœ“ Budget caps enforced by vendor
βœ“ Full audit log with actor & time
Everything you need
Production-ready key management with zero configuration overhead.
πŸ”‘

Real Vendor Keys

Not proxy tokens. Developers use real keys directly with vendor SDKs β€” no SDK changes, no added latency.

πŸ‘₯

Per-Developer Scoping

Each key lives in its own vendor project or workspace, perfectly isolated from other team members.

πŸ’°

Budget Controls

Set per-developer USD spending limits enforced at the vendor level. No surprise bills ever.

⏱️

Rate Limiting

Per-key RPM limits enforced by the vendor. Protect shared quotas from runaway scripts.

πŸ”„

Key Rotation

One-click rotate: revoke old, provision new for the same developer. Zero downtime handoff.

πŸ“‹

Audit Log

Every provision, revoke, rotate, and config change is immutably logged with actor and timestamp.

🏒

Multi-Vendor

OpenAI, Anthropic, Azure OpenAI, Google Vertex AI β€” all from one unified dashboard.

🐳

Docker-Ready

One command to run the full stack in production. Deploy to AWS, GCP, Azure, or Kubernetes.

Supported Vendors
KeyGate's vendor system is extensible β€” add custom vendors with a single class.
VendorMechanismWhat's CreatedStatus
πŸ€– OpenAIProject + Service Account per developersk-proj-... API keySupported
🧠 AnthropicWorkspace + API Key per developerWorkspace-scoped API keySupported
☁️ Azure OpenAICognitive Services resource per developerUnique endpoint + Key1Supported
πŸ”΅ Google VertexService Account + IAM binding per developerJSON credentials fileSupported
+ CustomImplement BaseVendorProvisionerAny key formatExtensible
How it works
KeyGate is only involved at key lifecycle time β€” zero added latency at inference.
1
Admin triggers provisioning
πŸ–±οΈ
Provision Key
Admin selects User + vendor OpenAI in the dashboard and clicks Provision.
↓
2
KeyGate orchestrates vendor API calls
βš™οΈ
KeyGate Backend
Validates developer exists and is active
Loads encrypted OpenAI admin credentials
POST /v1/organization/projects β†’ "keygate-ml-user-a3f2c1"
POST /projects/{id}/service_accounts β†’ real API key generated
Stores only metadata β€” hint, budget, expiry. Never the full key.
Returns real key to admin shown once
↓
3
Admin shares key with developer
πŸ“€
Secure Handoff
Admin securely delivers the key to User via your preferred channel.
↓
4
Developer uses key directly β€” no proxy
πŸš€
Direct to OpenAI
User sets the key in her SDK. Traffic goes straight to OpenAI β€” KeyGate is not in the request path.
openai.api_key = "sk-proj-..."0ms overhead

API Reference

Base URL: http://localhost:8000  Β·  Swagger: /docs  Β·  ReDoc: /redoc

Authentication

πŸ”’ Bearer Token Required

All endpoints except /health and /api/v1/auth/login require a JWT bearer token in the Authorization header.

bash
# Get a token
curl -X POST http://localhost:8000/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@keygate.dev", "password": "changeme"}'

# Use the token
curl -H "Authorization: Bearer <token>" http://localhost:8000/api/v1/developers

Auth

POST /api/v1/auth/login Get JWT access token β–Ύ

Authenticate with email and password to receive a JWT bearer token.

Request Body

emailrequired
string
Admin account email address.
passwordrequired
string
Admin account password.
Request
Response 200
json
{ "email": "admin@keygate.dev", "password": "changeme" }
json
{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "bearer" }
200 OK422 Validation Error

Vendors

POST/api/v1/vendors/configureStore vendor admin credentialsβ–Ύ

Store or update admin API credentials for a vendor. Credentials are encrypted at rest.

βœ… Supported vendors

openai, anthropic, azure_openai, google_vertex

Request Body

vendorrequired
string
Vendor identifier.
admin_api_keyrequired
string
Organization-level admin API key from the vendor console.
org_id
string | null
Organization ID (e.g., org-... for OpenAI).
extra_config
object | null
Additional vendor-specific configuration.
Request
json
{
  "vendor": "openai",
  "admin_api_key": "sk-admin-abc123...",
  "org_id": "org-XXXXXXXX"
}
200 OK422 Validation Error
GET/api/v1/vendorsList configured vendors (keys masked)β–Ύ

Returns all configured vendors. Admin keys are masked β€” only a hint is returned.

200 OK

Developers

POST/api/v1/developersRegister a new developerβ–Ύ
namerequired
string (1–255)
Developer's full name.
emailrequired
string
Developer email address.
team
string
Team name for grouping. Default: "default".
role
string
Organizational role. Default: "developer".
Request
json
{ "name": "Priya Sharma", "email": "priya@company.com", "team": "ml" }
200 OK422 Validation Error
GET/api/v1/developersList developersβ–Ύ
team
string | null
Filter by team name.
active_only
boolean
Only return active developers. Default: true.
200 OK
DELETE/api/v1/developers/{dev_id}Deactivate + revoke all keysβ–Ύ
⚠️ Destructive

Deactivates the developer and immediately revokes all their active API keys at the vendor level.

dev_idrequired
path Β· string
The developer's ID.
200 OK422 Validation Error

Keys

POST/api/v1/keys/provision⚑ Provision a real vendor API keyβ–Ύ

The core endpoint. Creates a scoped vendor project/workspace and provisions a real API key. The key is returned exactly once.

πŸ”‘ One-Time Display

The api_key is shown exactly once. Copy it immediately β€” it's never stored in full by KeyGate.

Request Body

developer_idrequired
string
The developer to provision the key for.
vendorrequired
string
openai, anthropic, azure_openai, google_vertex
budget_limit_usd
number
Max spend in USD. Default: 50.0.
rate_limit_rpm
integer
Requests per minute cap. Default: 60.
expires_in_days
integer
Key TTL in days. Default: 90.
models_allowed
string[] | null
Restrict to specific models e.g. ["gpt-4","gpt-4o"].
description
string
Human-readable note for the audit trail.
Request
Response 200
json
{
  "developer_id": "dev-abc123",
  "vendor": "openai",
  "budget_limit_usd": 100,
  "rate_limit_rpm": 120,
  "expires_in_days": 90,
  "models_allowed": ["gpt-4", "gpt-4o"],
  "description": "GPT-4 for ML experiments"
}
json
{
  "key_id": "key-xyz789",
  "vendor": "openai",
  "api_key": "sk-proj-...",
  "key_hint": "sk-proj-...7xKm",
  "project_name": "keygate-ml-priya-a3f2c1",
  "budget_limit_usd": 100,
  "expires_at": "2026-06-22T08:00:00+00:00",
  "instructions": {
    "base_url": "https://api.openai.com/v1",
    "auth_header": "Authorization: Bearer <your-key>"
  }
}
200 OK422 Validation Error
GET/api/v1/keysList issued keys (metadata only)β–Ύ

Returns key metadata. Full key values are never included.

vendor
string | null
Filter by vendor.
developer_id
string | null
Filter by developer.
status
string
Filter by status. Default: "active".
200 OK
POST/api/v1/keys/{key_id}/revokeRevoke a key immediatelyβ–Ύ

Calls the vendor API to delete/disable the key, then marks it revoked locally. Revocation is immediate at the vendor level.

200 OK422 Validation Error
POST/api/v1/keys/{key_id}/rotateRotate β€” revoke old, provision newβ–Ύ

Atomically revokes the existing key and provisions a fresh one for the same developer and vendor. Response identical to POST /keys/provision.

200 OK422 Validation Error

Audit & System

GET/api/v1/auditQuery the audit logβ–Ύ

Immutable log of all provisioning, revocation, and configuration events.

limit
integer (max 500)
Number of events. Default: 50.
action
string | null
Filter by action type, e.g. key.provision.
200 OK
GET/healthHealth check β€” no auth requiredβ–Ύ

Liveness probe for load balancers and container orchestrators.

json
{ "status": "healthy", "service": "keygate", "version": "0.1.0" }
200 OK
Quick Start
Get KeyGate running in under 5 minutes.
1

Clone and configure

Clone the repository and copy the example environment file.

bash
git clone https://github.com/Aakashbhardwaj27/keygate.git
cd keygate && cp .env.example .env
2

Edit .env with required values

bash
SECRET_KEY=$(openssl rand -hex 32)
ADMIN_EMAIL=admin@yourcompany.com
ADMIN_PASSWORD=<strong-password>
DB_PASSWORD=<strong-password>
OPENAI_ADMIN_KEY=sk-admin-...
3

Start the stack

bash
docker compose up -d
# Dashboard β†’ http://localhost:3000
# API docs  β†’ http://localhost:8000/docs
4

Configure a vendor & provision your first key

Log in, add your vendor admin key, register a developer, click Provision Key. Copy the key β€” it's shown exactly once.

Configuration Reference

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
SECRET_KEYYesJWT signing key (openssl rand -hex 32)
ADMIN_EMAILYesInitial admin email
ADMIN_PASSWORDYesInitial admin password
OPENAI_ADMIN_KEYNoOpenAI org admin API key
ANTHROPIC_ADMIN_KEYNoAnthropic admin API key
AZURE_SUBSCRIPTION_IDNoAzure subscription ID
GCP_PROJECT_IDNoGoogle Cloud project ID

Deployment Options

Changelog
All notable changes to KeyGate are documented here.
v0.1.0
Mar 2026

Initial Release πŸŽ‰

NEWNEWNEW
  • OpenAI provisioner β€” Project + Service Account per developer
  • Anthropic provisioner β€” Workspace + API Key per developer
  • Azure OpenAI provisioner β€” Cognitive Services resource per developer
  • Google Vertex AI β€” Service Account + IAM binding per developer
  • Full audit log with actor, timestamp, event details
  • JWT authentication with configurable expiry
  • Key rotation (revoke old + provision new atomically)
  • Workspace and team management
  • Docker Compose production stack
  • React dashboard frontend
v0.2.0
Roadmap

Upcoming

  • Prometheus /metrics endpoint
  • SSO/SAML integration (Okta, Auth0, Google Workspace)
  • Self-service developer portal with approval flows
  • Spend tracking via vendor usage APIs
  • Slack/Teams notifications on key events
  • Helm chart for Kubernetes
  • CLI: keygate provision --vendor openai --dev priya
  • Webhook support for key lifecycle events
βŒ• Esc
POST /api/v1/keys/provision β€” Provision a vendor API key
API Reference β€Ί Keys
POST /api/v1/auth/login β€” Get JWT access token
API Reference β€Ί Auth
POST /api/v1/vendors/configure β€” Store vendor credentials
API Reference β€Ί Vendors
POST /api/v1/developers β€” Register a developer
API Reference β€Ί Developers
POST /api/v1/keys/{id}/revoke β€” Revoke a key immediately
API Reference β€Ί Keys
POST /api/v1/keys/{id}/rotate β€” Rotate a key
API Reference β€Ί Keys
Quick Start β€” Docker Compose setup guide
Guide β€Ί Getting Started
Configuration β€” Environment variables reference
Guide β€Ί Configuration
Supported Vendors β€” OpenAI, Anthropic, Azure, GCP
Overview
Changelog β€” v0.1.0 initial release
Changelog