# `Spectre.Inference.Budget`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/inference/budget.ex#L1)

Portable aggregate budget owned by an Instance for one logical inference.

Reservations happen before dispatch and settlements are keyed by attempt id,
making duplicate terminal receipts idempotent. Ambiguous attempts retain
their reservation until a reconciliation result is committed.

# `t`

```elixir
@type t() :: %Spectre.Inference.Budget{
  consumed: Spectre.Inference.Usage.t(),
  deadline_at: integer() | nil,
  estimation_policy: :provider | :conservative | :unavailable,
  inference_id: String.t(),
  limits: map(),
  pricing_ref: String.t() | nil,
  reservations: %{optional(String.t()) =&gt; Spectre.Inference.Usage.t()},
  settlements: %{optional(String.t()) =&gt; map()}
}
```

# `new`

```elixir
@spec new(
  String.t(),
  keyword()
) :: t()
```

# `remaining`

```elixir
@spec remaining(t()) :: map()
```

# `reserve`

```elixir
@spec reserve(t(), String.t(), Spectre.Inference.Usage.t() | map() | keyword()) ::
  {:ok, t(), Spectre.Inference.BudgetSnapshot.t()} | {:error, term()}
```

# `settle`

```elixir
@spec settle(
  t(),
  String.t(),
  Spectre.Inference.Usage.t() | map(),
  :confirmed | :ambiguous
) ::
  {:ok, t()} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
