docs(virtual_keys.md): add enable/disable virtual keys to docs + refactor sidebar

This commit is contained in:
Krrish Dholakia 2024-09-21 22:20:39 -07:00
parent b6bf994084
commit 16c8549b77
5 changed files with 66 additions and 30 deletions

View file

@ -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
</Tabs>
## ✨ (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
<TabItem value="per team" label="Spend Per Team">
##### 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
<Tabs>
<TabItem value="response" label="Expected 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
</Tabs>
#### 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

View file

@ -1,4 +1,4 @@
# 🎉 Demo App
# Demo App
Here is a demo of the proxy. To log in pass in:

View file

@ -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

View file

@ -598,6 +598,44 @@ client = openai.OpenAI(
</TabItem>
</Tabs>
### 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.

View file

@ -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",