# `MingaClaudeBridge.Wire.RateLimit`
[🔗](https://github.com/jsmestad/minga-claude-bridge/blob/main/lib/minga_claude_bridge/wire/rate_limit.ex#L1)

A `rate_limit_event` frame: plan usage for Claude subscription accounts.

Fields come from the SDK's `SDKRateLimitInfo`, read from `rate_limit_info`:

  * `status` (`status`): `:allowed`, `:allowed_warning`, `:rejected`, or `{:other, string}`.
  * `resets_at` (`resetsAt`): when the window resets, in Unix seconds.
  * `rate_limit_type` (`rateLimitType`): `:five_hour`, `:seven_day`, `:seven_day_opus`, `:seven_day_sonnet`, `:seven_day_overage_included`, `:overage`, or `{:other, string}`.
  * `utilization` (`utilization`): the used fraction of the window.

## Unverified

The SDK types do not state the unit of `resetsAt`. pi-claude-bridge treats it as Unix seconds based on observed CLI output, and this module documents it the same way. The SDK types also do not state whether `utilization` is a 0..1 fraction or a percentage; the value is passed through as a number.

# `rate_limit_type`

```elixir
@type rate_limit_type() ::
  :five_hour
  | :seven_day
  | :seven_day_opus
  | :seven_day_sonnet
  | :seven_day_overage_included
  | :overage
  | {:other, String.t()}
```

# `status`

```elixir
@type status() :: :allowed | :allowed_warning | :rejected | {:other, String.t()}
```

# `t`

```elixir
@type t() :: %MingaClaudeBridge.Wire.RateLimit{
  rate_limit_type: rate_limit_type() | nil,
  resets_at: number() | nil,
  session_id: String.t() | nil,
  status: status(),
  utilization: number() | nil
}
```

# `from_wire`

```elixir
@spec from_wire(MingaClaudeBridge.Wire.Field.json_map()) :: {:ok, t()} | :error
```

Decodes a `rate_limit_event` frame.

---

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