forked from phoenix/litellm-mirror
30 lines
894 B
Markdown
30 lines
894 B
Markdown
# 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
|
|
}
|
|
```
|
|
|
|
|