Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat: Add OAuth2 auth and scheduled key rotation

Cursor Agentc684a18e38d4
diff --git a/docs/my-website/docs/mcp.md b/docs/my-website/docs/mcp.md
index 18c7c6b8508..7eee979cc67 100644
--- a/docs/my-website/docs/mcp.md
+++ b/docs/my-website/docs/mcp.md
@@ -149,6 +149,16 @@ mcp_servers:
auth_type: "api_key"
auth_value: "abc123" # headers={"X-API-Key": "abc123"}
+ # NEW – OAuth 2.0 Client Credentials (v1.77.5)
+ oauth2_example:
+ url: "https://my-mcp-server.com/mcp"
+ auth_type: "oauth2" # 👈 KEY CHANGE
+ authorization_url: "https://my-mcp-server.com/oauth/authorize" # optional for client-credentials
+ token_url: "https://my-mcp-server.com/oauth/token" # required
+ client_id: os.environ/OAUTH_CLIENT_ID
+ client_secret: os.environ/OAUTH_CLIENT_SECRET
+ scopes: ["tool.read", "tool.write"] # optional
+
bearer_example:
url: "https://my-mcp-server.com/mcp"
auth_type: "bearer_token"
diff --git a/docs/my-website/docs/proxy/virtual_keys.md b/docs/my-website/docs/proxy/virtual_keys.md
index bf1090e5859..68cbe91b0f6 100644
--- a/docs/my-website/docs/proxy/virtual_keys.md
+++ b/docs/my-website/docs/proxy/virtual_keys.md
@@ -66,6 +66,50 @@ curl 'http://0.0.0.0:4000/key/generate' \
--data-raw '{"models": ["gpt-3.5-turbo", "gpt-4"], "metadata": {"user": "[email protected]"}}'
```
+## 🔁 Scheduled Key Rotations (NEW in v1.77.5)
+
+LiteLLM can now rotate **virtual keys automatically** on a schedule you define.
+
+### How it works
+1. When creating a virtual key you set `rotation_schedule` – a [cron expression](https://crontab.guru/).
+2. LiteLLM stores the schedule in the DB and runs a background job that regenerates the key at the specified time.
+3. Existing key string is invalidated; a **notification webhook** (if configured) is sent with the new key value.
+
+### Create a key with rotation
+
+```bash
+curl 'http://0.0.0.0:4000/key/generate' \
+ -H 'Authorization: Bearer <your-master-key>' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "models": ["gpt-4o"],
+ "rotation_schedule": "0 0 * * SUN", # rotate every Sunday at 00:00 UTC
+ "webhook_url": "https://example.com/key-rotated"
+ }'
+```
+
+### Enable globally via env
+
+Set these env vars when starting the proxy:
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `LITELLM_KEY_ROTATION_ENABLED` | Enable the rotation worker | `false` |
+| `LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS` | How often to scan for keys to rotate | `86400` |
+
+### Webhook payload
+
+```json
+{
+ "event": "virtual_key.rotated",
+ "old_key_id": "sk-abc...",
+ "new_key": "sk-def...",
+ "rotation_time": "2025-10-05T00:00:00Z"
+}
+```
+
+If no `webhook_url` is provided the new key value is returned in the response of the `/key/rotate` REST call instead.
+
## Spend Tracking
Get spend per: