ClaudeCode.Message.RateLimitEvent (ClaudeCode v0.36.3)
View SourceRepresents a rate limit event from the Claude CLI.
Emitted when the session encounters a rate limit. This is common for claude.ai subscription users and provides information about rate limit status and when limits reset.
Fields
:rate_limit_info- Map with rate limit details::status- One of:allowed,:allowed_warning, or:rejected:resets_at- Unix timestamp (ms) when the limit resets (optional):utilization- Current utilization as a float 0.0–1.0 (optional):rate_limit_type- Type of rate limit (e.g.,"five_hour","seven_day","overage"):overage_status- Overage status:"allowed","allowed_warning", or"rejected":overage_resets_at- Unix timestamp (ms) when overage limit resets:overage_disabled_reason- Reason overage was disabled (string, optional):is_using_overage- Whether the session is using overage (boolean):surpassed_threshold- Threshold that was surpassed (number)
:uuid- Message UUID:session_id- Session identifier
JSON Format
{
"type": "rate_limit_event",
"rate_limit_info": {
"status": "allowed_warning",
"resetsAt": 1700000000000,
"utilization": 0.85,
"rateLimitType": "five_hour",
"overageStatus": "allowed",
"isUsingOverage": false
},
"uuid": "...",
"session_id": "..."
}
Summary
Functions
Creates a new RateLimitEvent from JSON data.
Type guard to check if a value is a RateLimitEvent.
Types
@type rate_limit_info() :: %{ status: status(), resets_at: integer() | nil, utilization: number() | nil, rate_limit_type: String.t() | nil, overage_status: String.t() | nil, overage_resets_at: integer() | nil, overage_disabled_reason: String.t() | nil, is_using_overage: boolean() | nil, surpassed_threshold: number() | nil }
@type status() :: :allowed | :allowed_warning | :rejected
@type t() :: %ClaudeCode.Message.RateLimitEvent{ rate_limit_info: rate_limit_info(), session_id: String.t(), type: :rate_limit_event, uuid: String.t() | nil }
Functions
Creates a new RateLimitEvent from JSON data.
Examples
iex> RateLimitEvent.new(%{
...> "type" => "rate_limit_event",
...> "rate_limit_info" => %{"status" => "allowed_warning", "resetsAt" => 1700000000000},
...> "session_id" => "session-1"
...> })
{:ok, %RateLimitEvent{type: :rate_limit_event, ...}}
iex> RateLimitEvent.new(%{"type" => "assistant"})
{:error, :invalid_message_type}
Type guard to check if a value is a RateLimitEvent.