# litellm_budget Resource

Manages a budget object on the LiteLLM proxy. Budgets can be attached to keys, teams, organizations, and end users to enforce spend limits

## Example Usage

```hcl
resource "litellm_budget" "engineering" {
  budget_id             = "engineering-monthly"
  max_budget            = 500.0
  soft_budget           = 400.0
  budget_duration       = "30d"
  tpm_limit             = 500000
  rpm_limit             = 5000
  max_parallel_requests = 100

  model_max_budget = jsonencode({
    "gpt-4o" = {
      max_budget      = 100.0
      budget_duration = "1d"
    }
  })
}
```

## Argument Reference

- `budget_id` (Optional, Forces new resource) - Unique ID for the budget. Generated by the server if not provided
- `max_budget` (Optional) - Requests fail if this budget in USD is exceeded
- `soft_budget` (Optional) - Requests do not fail if this is exceeded, but alerts fire
- `max_parallel_requests` (Optional) - Maximum concurrent requests allowed for this budget
- `tpm_limit` (Optional) - Maximum tokens per minute allowed for this budget
- `rpm_limit` (Optional) - Maximum requests per minute allowed for this budget
- `budget_duration` (Optional) - Budget reset period, e.g. `1hr`, `1d`, `28d`
- `model_max_budget` (Optional) - JSON string of per-model budget config, e.g. `jsonencode({"gpt-4o" = {max_budget = 10.0}})`

## Attribute Reference

- `id` - The budget ID
- `budget_reset_at` - Datetime when the budget is reset

## Import

Budgets can be imported using the budget ID:

```shell
terraform import litellm_budget.engineering <budget-id>
```
