mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
docs: add Customers tab to Reset Budgets section
Add a 'Customers' tab to the Reset Budgets section showing how to use /customer/new and /customer/update with budget_duration to set up automatically resetting budgets for customers (end-users). Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
parent
096893ea97
commit
23a12428bc
1 changed files with 42 additions and 0 deletions
|
|
@ -621,6 +621,48 @@ curl 'http://0.0.0.0:4000/team/new' \
|
|||
"budget_duration": "30s", # 👈 KEY CHANGE
|
||||
}'
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="customers" label="Customers">
|
||||
|
||||
Use `/customer/new` to create a customer with a `budget_duration`. The budget will automatically reset at the end of the specified duration.
|
||||
|
||||
```bash
|
||||
curl 'http://0.0.0.0:4000/customer/new' \
|
||||
--header 'Authorization: Bearer <your-master-key>' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"user_id": "my-customer-id",
|
||||
"max_budget": 10,
|
||||
"budget_duration": "30d", # 👈 KEY CHANGE
|
||||
}'
|
||||
```
|
||||
|
||||
To update an existing customer's budget duration:
|
||||
|
||||
```bash
|
||||
curl 'http://0.0.0.0:4000/customer/update' \
|
||||
--header 'Authorization: Bearer <your-master-key>' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"user_id": "my-customer-id",
|
||||
"max_budget": 10,
|
||||
"budget_duration": "30d", # 👈 KEY CHANGE
|
||||
}'
|
||||
```
|
||||
|
||||
Then pass the customer's `user_id` as the `user` parameter in `/chat/completions` requests:
|
||||
|
||||
```bash
|
||||
curl 'http://0.0.0.0:4000/chat/completions' \
|
||||
--header 'Authorization: Bearer <your-api-key>' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"model": "gpt-4o",
|
||||
"user": "my-customer-id",
|
||||
"messages": [{"role": "user", "content": "Hello!"}]
|
||||
}'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue