MingaClaudeBridge.Wire.RateLimit (minga_claude_bridge v0.1.0)

Copy Markdown View Source

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.

Summary

Functions

Decodes a rate_limit_event frame.

Types

rate_limit_type()

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

status()

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

t()

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

Functions

from_wire(map)

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

Decodes a rate_limit_event frame.