Skip to content

Commit

Permalink
docs(virtual_keys.md): add enable/disable virtual keys to docs + refa…
Browse files Browse the repository at this point in the history
…ctor sidebar
  • Loading branch information
krrishdholakia committed Sep 22, 2024
1 parent b6bf994 commit 16c8549
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 30 deletions.
20 changes: 10 additions & 10 deletions docs/my-website/docs/proxy/cost_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -151,15 +151,15 @@ 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

<Tabs>

<TabItem value="per team" label="Spend Per Team">

##### Example Request
#### Example Request

👉 Key Change: Specify `group_by=team`

Expand All @@ -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">
Expand Down Expand Up @@ -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`

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/my-website/docs/proxy/demo.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 🎉 Demo App
# Demo App

Here is a demo of the proxy. To log in pass in:

Expand Down
2 changes: 1 addition & 1 deletion docs/my-website/docs/proxy/user_keys.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
38 changes: 38 additions & 0 deletions docs/my-website/docs/proxy/virtual_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 16 additions & 18 deletions docs/my-website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const sidebars = {
"proxy/quick_start",
"proxy/docker_quick_start",
"proxy/deploy",
"proxy/demo",
"proxy/prod",
{
type: "category",
Expand All @@ -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",
Expand All @@ -59,9 +74,6 @@ const sidebars = {
"pass_through/langfuse"
],
},
"proxy/cost_tracking",
"proxy/custom_pricing",
"proxy/virtual_keys",
{
type: "category",
label: "Admin UI",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 16c8549

Please sign in to comment.