Agentic.LLM.Usage (agentic v0.2.2)

Copy Markdown

Provider quota / spend snapshot.

Returned by Provider.fetch_usage/1 and cached by Agentic.LLM.UsageManager. Different providers expose different shapes — some have rolling rate-limit windows (Anthropic 5h/7d), some have credit balances (OpenRouter), some have RPM caps (Groq). This struct accommodates all of them via a list of %UsageWindow{}s plus an optional :credits map.

Summary

Types

t()

@type t() :: %Agentic.LLM.Usage{
  credits: %{used: float(), limit: float()} | nil,
  error: String.t() | nil,
  fetched_at: integer() | nil,
  label: String.t(),
  plan: String.t() | nil,
  provider: atom(),
  windows: [Agentic.LLM.UsageWindow.t()]
}