Versão atual: 2026.8.0.
Manifest V3 extension that acts as a client/collector for the Home Assistant integration in alves-dev/ai-usage. It collects AI provider usage data from the browser's authenticated session and sends structured payloads to a Home Assistant webhook.
The extension runs a background service worker. For each enabled provider, it schedules periodic collections with chrome.alarms, accesses the provider endpoints or pages using the browser's existing authenticated session, and normalizes the result to the contract documented in docs/payload-contract.md.
After each collection, the payload is sent with POST to the configured Home Assistant webhook. The extension does not store provider tokens and does not send cookies, raw HTML, or API keys in the payload.
- Codex: collects plan and usage limit data for Codex Cloud on
chatgpt.com. - Ollama Cloud: collects account, plan, and usage limit data from the Ollama Cloud settings page.
Each provider can be enabled or disabled independently on the options page, with a configurable collection interval in minutes. The labels of each usage window can also be customized; the technical window IDs remain stable.
On the extension options page, configure:
- Home Assistant domain: the HA base domain, for example
https://ha.example.com. - Webhook ID: only the webhook ID, for example
ai_tools_usage_xxxxx.
The extension builds the final URL as:
https://ha.example.com/api/webhook/ai_tools_usage_xxxxx
The Test connection button sends a test payload. If Home Assistant returns 400, the test is considered successful because it confirms the request reached HA even though the test contract is invalid.
- Open
chrome://extensionsin a Chromium-based browser. - Enable Developer mode.
- Click Load unpacked.
- Select this repository folder.
- Open the extension options page and configure the webhook.
After changing local files, reload the extension from chrome://extensions.
There is no build step or bundler. Source code lives in src/:
src/background/: service worker and page probe logic.src/options/: configuration UI.src/providers/: provider collectors.src/services/: storage, scheduler, and Home Assistant client.src/utils/: constants, normalization, and Chrome API wrappers.
Available command:
npm run check
npm testThis runs node --check for every JavaScript file in src/.
Releases use the calendar version in manifest.json (YYYY.M or YYYY.M.P).
For this release, the Payload Contract is 2.0 and the extension version is
2026.8.0.
docs/payload-contract.md: payload contract sent to Home Assistant.docs/codex-collector.md: Codex collection details.docs/ollama-cloud-collector.md: Ollama Cloud collection details.
Do not commit private webhook URLs, real provider responses, or account data. The extension depends on browser permissions to access the Home Assistant domain and the provider domains configured in manifest.json.
