From 16c8549b773d3b4ffcb986101dc268fead84ae60 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 21 Sep 2024 22:20:39 -0700 Subject: [PATCH] docs(virtual_keys.md): add enable/disable virtual keys to docs + refactor sidebar --- docs/my-website/docs/proxy/cost_tracking.md | 20 +++++------ docs/my-website/docs/proxy/demo.md | 2 +- docs/my-website/docs/proxy/user_keys.md | 2 +- docs/my-website/docs/proxy/virtual_keys.md | 38 +++++++++++++++++++++ docs/my-website/sidebars.js | 34 +++++++++--------- 5 files changed, 66 insertions(+), 30 deletions(-) diff --git a/docs/my-website/docs/proxy/cost_tracking.md b/docs/my-website/docs/proxy/cost_tracking.md index 5e755e26c..033413099 100644 --- a/docs/my-website/docs/proxy/cost_tracking.md +++ b/docs/my-website/docs/proxy/cost_tracking.md @@ -10,7 +10,7 @@ Track spend for keys, users, and teams across 100+ LLMs. **Step 1** -👉 [Setup LiteLLM with a Database](https://docs.litellm.ai/docs/proxy/deploy) +👉 [Setup LiteLLM with a Database](https://docs.litellm.ai/docs/proxy/virtual_keys#setup) **Step2** Send `/chat/completions` request @@ -151,7 +151,7 @@ Navigate to the Usage Tab on the LiteLLM UI (found on https://your-proxy-endpoin ## ✨ (Enterprise) API Endpoints to get Spend -#### Getting Spend Reports - To Charge Other Teams, Customers, Users +### Getting Spend Reports - To Charge Other Teams, Customers, Users Use the `/global/spend/report` endpoint to get spend reports @@ -159,7 +159,7 @@ Use the `/global/spend/report` endpoint to get spend reports -##### Example Request +#### Example Request 👉 Key Change: Specify `group_by=team` @@ -168,7 +168,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end -H 'Authorization: Bearer sk-1234' ``` -##### Example Response +#### Example Response @@ -292,7 +292,7 @@ Customer This is the value of `user_id` passed when calling [`/key/generate`](ht ::: -##### Example Request +#### Example Request 👉 Key Change: Specify `group_by=customer` @@ -302,7 +302,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end -H 'Authorization: Bearer sk-1234' ``` -##### Example Response +#### Example Response ```shell @@ -359,7 +359,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end -H 'Authorization: Bearer sk-1234' ``` -##### Example Response +#### Example Response ```shell @@ -406,7 +406,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end -H 'Authorization: Bearer sk-1234' ``` -##### Example Response +#### Example Response ```shell @@ -472,7 +472,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end -#### Allowing Non-Proxy Admins to access `/spend` endpoints +### Allowing Non-Proxy Admins to access `/spend` endpoints Use this when you want non-proxy admins to access `/spend` endpoints @@ -572,7 +572,7 @@ model_list: 👉 Head to [Custom Input/Output Pricing](https://docs.litellm.ai/docs/proxy/custom_pricing) to setup custom pricing or your models -## ✨ Custom k,v pairs +## ✨ Custom Spend Log metadata Log specific key,value pairs as part of the metadata for a spend log diff --git a/docs/my-website/docs/proxy/demo.md b/docs/my-website/docs/proxy/demo.md index d4bcf81a2..c4b8671aa 100644 --- a/docs/my-website/docs/proxy/demo.md +++ b/docs/my-website/docs/proxy/demo.md @@ -1,4 +1,4 @@ -# 🎉 Demo App +# Demo App Here is a demo of the proxy. To log in pass in: diff --git a/docs/my-website/docs/proxy/user_keys.md b/docs/my-website/docs/proxy/user_keys.md index 18b6a3605..e0227d390 100644 --- a/docs/my-website/docs/proxy/user_keys.md +++ b/docs/my-website/docs/proxy/user_keys.md @@ -1,7 +1,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# 💡 Migrating from OpenAI (Langchain, OpenAI SDK, LlamaIndex, Instructor, Curl) +# Langchain, OpenAI SDK, LlamaIndex, Instructor, Curl examples LiteLLM Proxy is **OpenAI-Compatible**, and supports: * /chat/completions diff --git a/docs/my-website/docs/proxy/virtual_keys.md b/docs/my-website/docs/proxy/virtual_keys.md index 692d153fc..6d8890457 100644 --- a/docs/my-website/docs/proxy/virtual_keys.md +++ b/docs/my-website/docs/proxy/virtual_keys.md @@ -598,6 +598,44 @@ client = openai.OpenAI( +### Enable/Disable Virtual Keys + +**Disable Keys** + +```bash +curl -L -X POST 'http://0.0.0.0:4000/key/block' \ +-H 'Authorization: Bearer LITELLM_MASTER_KEY' \ +-H 'Content-Type: application/json' \ +-d '{"key": "KEY-TO-BLOCK"}' +``` + +Expected Response: + +```bash +{ + ... + "blocked": true +} +``` + +**Enable Keys** + +```bash +curl -L -X POST 'http://0.0.0.0:4000/key/unblock' \ +-H 'Authorization: Bearer LITELLM_MASTER_KEY' \ +-H 'Content-Type: application/json' \ +-d '{"key": "KEY-TO-UNBLOCK"}' +``` + + +```bash +{ + ... + "blocked": false +} +``` + + ### Custom Auth You can now override the default api key auth. diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index b6ac55bb9..f1549da0a 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -31,6 +31,7 @@ const sidebars = { "proxy/quick_start", "proxy/docker_quick_start", "proxy/deploy", + "proxy/demo", "proxy/prod", { type: "category", @@ -44,9 +45,23 @@ const sidebars = { }, "proxy/enterprise", "proxy/user_keys", - "proxy/demo", "proxy/configs", "proxy/reliability", + { + type: "category", + label: "🔑 Authentication", + items: ["proxy/virtual_keys", "proxy/token_auth", "proxy/oauth2"], + }, + { + type: "category", + label: "💸 Spend Tracking + Budgets", + items: ["proxy/cost_tracking", "proxy/users", "proxy/custom_pricing", "proxy/team_budgets", "proxy/billing", "proxy/customers"], + }, + { + type: "category", + label: "Routing", + items: ["proxy/load_balancing", "proxy/tag_routing", "proxy/team_based_routing", "proxy/customer_routing",], + }, { type: "category", label: "Use with Provider SDKs", @@ -59,9 +74,6 @@ const sidebars = { "pass_through/langfuse" ], }, - "proxy/cost_tracking", - "proxy/custom_pricing", - "proxy/virtual_keys", { type: "category", label: "Admin UI", @@ -94,24 +106,10 @@ const sidebars = { "oidc" ] }, - "proxy/tag_routing", - "proxy/users", - "proxy/team_budgets", - "proxy/customers", - "proxy/billing", - "proxy/token_auth", - "proxy/oauth2", "proxy/caching", "proxy/pass_through", "proxy/email", "proxy/multiple_admins", - "proxy/team_based_routing", - "proxy/customer_routing", - { - type: "category", - label: "Extra Load Balancing", - items: ["proxy/load_balancing"], - }, "proxy/model_management", "proxy/health", "proxy/debugging",