Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FamilyFromHeader ¶
FamilyFromHeader infers provider family from response headers (best-effort).
Types ¶
type AccountQuota ¶
type AccountQuota struct {
Account string `json:"account"`
Kind string `json:"kind"`
Family string `json:"family"`
Adapter string `json:"adapter"`
Used int64 `json:"used"`
Limit int64 `json:"limit"`
Percent int `json:"percent"`
ResetAt *time.Time `json:"reset_at,omitempty"`
Status string `json:"status"`
Enabled bool `json:"enabled"`
SubQuota map[string]int64 `json:"sub_quota,omitempty"` // e.g. codex primary/secondary windows
}
AccountQuota is the aggregated live state for a single account.
type Observation ¶
type Observation struct {
Account string
Kind string // oauth | cookie | free | api_key
Family string // claude | codex | cursor | copilot | kimi | gemini | deepseek | opencode | free
Used int64
Limit int64 // 0 = unknown/unlimited
ResetAt time.Time
Status string // active | exhausted | free
Source string // header | api | local
Timestamp time.Time
}
Observation is a per-request quota signal collected from the upstream response (headers, codex credits) and local usage accounting.
func ParseHeaders ¶
ParseHeaders extracts quota signal from arbitrary upstream response headers. Supports codex-style x-*-primary/secondary-used-percent and reset-at, plus a generic X-Provider-Quota-* convention for provider adapters.
type Tracked ¶
type Tracked struct {
// contains filtered or unexported fields
}
func (*Tracked) List ¶
func (t *Tracked) List() []AccountQuota
List returns sorted per-account quota snapshot.
func (*Tracked) Observe ¶
func (t *Tracked) Observe(o Observation)
Observe records a quota signal for an account.
func (*Tracked) ObserveRaw ¶
ObserveRaw aggregates codex-style per-window percentages (primary/secondary).