docs(users.md): set budgets per user docs

This commit is contained in:
Krrish Dholakia 2023-12-27 20:30:20 +05:30
parent b071157df5
commit b437260ece
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,30 @@
# Set budgets per user
LiteLLM exposes a `/user/new` endpoint to create budgets for users, that persist across multiple keys.
Requirements:
- Need to a postgres database (e.g. [Supabase](https://supabase.com/), [Neon](https://neon.tech/), etc)
This is documented in the swagger (live on your server root endpoint - e.g. `http://0.0.0.0:8000/`). Here's an example request.
```curl
curl --location 'http://localhost:8000/user/new' \
--header 'Authorization: Bearer <your-master-key>' \
--header 'Content-Type: application/json' \
--data-raw '{"models": ["azure-models"], "max_budget": 0, "user_id": "krrish3@berri.ai"}'
```
The request is a normal `/key/generate` request body + a `max_budget` field.
**Sample Response**
```curl
{
"key": "sk-YF2OxDbrgd1y2KgwxmEA2w",
"expires": "2023-12-22T09:53:13.861000Z",
"user_id": "krrish3@berri.ai",
"max_budget": 0.0
}
```

View file

@ -104,6 +104,7 @@ const sidebars = {
"proxy/load_balancing",
"proxy/virtual_keys",
"proxy/user_keys",
"proxy/users",
"proxy/model_management",
"proxy/reliability",
"proxy/health",