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:
Cursor Agent 2026-04-07 22:50:51 +00:00
parent 096893ea97
commit 23a12428bc
No known key found for this signature in database

View file

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