Documentation
¶
Overview ¶
Package grok implements the Grok (xAI) usage provider.
Auth: Usage Buttons Helper extension with the user's grok.com browser session (cookies). Endpoint: POST /rest/rate-limits with a JSON body specifying {requestKind, modelName}. We hit it twice — once for grok-3 and once for grok-4-heavy — mirroring how grok.com's own /usage page (and the JoshuaWang2211/grok-usage-watch extension) fetches limits.
Unlike Perplexity's rate-limit endpoint, Grok's response includes total* values alongside remaining*, so we render honest count tiles (X/Y) per category. windowSizeSeconds is the rolling-window length and is intentionally NOT used as a reset countdown — it doesn't say when the current window opened, so deriving "time until reset" from it would re-anchor on every poll. The countdown only fires when the API explicitly hands us a waitTimeSeconds (rate-limited state).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct{}
Provider fetches Grok usage data.
func (Provider) BrandColor ¶
BrandColor returns the accent color used on button faces. Grok renders as a reference card (no meter fill — see Ratio=nil in countMetric), so BrandColor only colors the watermark glyph, value text, and caption. White on a black canvas matches xAI's monochrome presentation.