model management

Set Access Group Budget

Set or replace the shared budget of an access group. Idempotent.

Every key that can reach a model in the group draws from this one budget.

Example:

curl -X PUT 'http://localhost:4000/access_group/production-models/budget' \
  -H 'Authorization: Bearer sk-1234' \
  -H 'Content-Type: application/json' \
  -d '{
    "max_budget": 100.0,
    "budget_duration": "30d"
  }'

Parameters:

  • access_group: str - The access group name (URL path parameter)
  • max_budget: Optional[float] - Requests fail once the group's shared spend exceeds this
  • soft_budget: Optional[float] - Fires an alert when reached; requests still succeed
  • budget_duration: Optional[str] - Frequency of resetting the group's spend (e.g. '30d')
  • budget_id: Optional[str] - Link an existing budget instead of creating one

Returns:

  • AccessGroupBudgetResponse with the stored budget and current spend

Raises:

  • HTTPException 400: If no budget field is given, or budget_duration cannot be parsed
  • HTTPException 404: If access group not found
put/access_group/{access_group}/budget

Path parameters

access_groupstring required

Request body

budget_idstring nullable
max_budgetnumber nullable
soft_budgetnumber nullable
budget_durationstring nullable

Response

Successful Response

access_groupstring required
spendnumber required

Changes

Changed in 1 of the 42 revisions of this API.1