Quota and token tracking for OpenCode providers via Toasts and Commands with no LLM calls.
Quota Toasts - See your remaining quota at a glance after each assistant response.
Token Report Commands - Track token usage and estimated costs across sessions.
Add to your opencode.json:
{
"plugin": ["@slkiser/opencode-quota"]
}Then enable the providers you use:
That's it. Toasts appear automatically after assistant responses.
LLM Agents: Ask your agent to install
https://github.com/slkiser/opencode-quotawith the providers you have enabled. See LLM Agent Installation Instructions for details.
| Command | Description |
|---|---|
/quota |
Show quota toast (verbose) |
/quota_status |
Show diagnostics (config, providers, accounts) |
/tokens_today |
Tokens used today (calendar day) |
/tokens_daily |
Tokens used in last 24 hours |
/tokens_weekly |
Tokens used in last 7 days |
/tokens_monthly |
Tokens used in last 30 days |
/tokens_all |
Tokens used all time |
/tokens_session |
Tokens used in current session |
/tokens_between |
Tokens between two dates (YYYY-MM-DD) |
/firmware_reset_window |
Resets Firmware 5-hour window (requires confirm) |
| Provider | Config ID | Auth Source |
|---|---|---|
| GitHub Copilot | copilot |
OpenCode auth (automatic) |
| OpenAI (Plus/Pro) | openai |
OpenCode auth (automatic) |
| Firmware AI | firmware |
OpenCode auth or API key |
| Chutes AI | chutes |
OpenCode auth or API key |
| Google Antigravity | google-antigravity |
Multi-account via opencode-antigravity-auth |
GitHub Copilot (usually no setup needed)
Copilot works automatically if OpenCode has Copilot configured and logged in.
Optional: For more reliable quota reporting, provide a fine-grained PAT:
- Create a fine-grained PAT at GitHub with Account permissions > Plan > Read
- Create
~/.config/opencode/copilot-quota-token.json:
{
"token": "github_pat_...",
"username": "your-username",
"tier": "pro"
}Tier options: free, pro, pro+, business, enterprise
OpenAI (no setup needed)
OpenAI works automatically if OpenCode has OpenAI/ChatGPT configured.
Firmware AI
Works automatically if OpenCode has Firmware configured. Alternatively, provide an API key:
{
"provider": {
"firmware": {
"options": {
"apiKey": "{env:FIRMWARE_API_KEY}",
},
},
},
"experimental": {
"quotaToast": {
"enabledProviders": ["firmware"],
},
},
}The apiKey field supports {env:VAR_NAME} syntax or a direct key.
Firmware-specific command: Use /firmware_reset_window confirm to reset your 5-hour spending window (consumes 1 of 2 weekly resets). Running without confirm shows a warning first.
Chutes AI
Works automatically if OpenCode has Chutes configured. Alternatively, provide an API key:
{
"provider": {
"chutes": {
"options": {
"apiKey": "{env:CHUTES_API_KEY}",
},
},
},
"experimental": {
"quotaToast": {
"enabledProviders": ["chutes"],
},
},
}Google Antigravity
Requires the opencode-antigravity-auth plugin for multi-account support:
{
"plugin": ["opencode-antigravity-auth", "@slkiser/opencode-quota"]
}Account credentials are stored in ~/.config/opencode/antigravity-accounts.json.
All options go under experimental.quotaToast in opencode.json:
| Option | Default | Description |
|---|---|---|
enabled |
true |
Enable/disable plugin |
enableToast |
true |
Show popup toasts |
enabledProviders |
[] |
Provider IDs to query (see table above) |
minIntervalMs |
300000 |
Minimum ms between API fetches (default: 5 min) |
toastDurationMs |
9000 |
How long toasts display (ms) |
onlyCurrentModel |
false |
Only show quota for the current model |
showSessionTokens |
true |
Show per-model input/output tokens in toast |
googleModels |
["CLAUDE"] |
Google models: CLAUDE, G3PRO, G3FLASH |
debug |
false |
Show debug info in toasts |
Toast not appearing? Run /quota_status to check config and provider availability.
LLM Agent Installation Instructions
This section provides instructions for LLM agents to install and configure opencode-quota based on the user's current OpenCode setup.
First, determine what providers the user has connected. You can:
- Read the user's
opencode.json(typically at~/.config/opencode/opencode.json) - Run
/connectedin OpenCode to see active providers - Ask the user which providers they use
Add the plugin to the user's opencode.json:
{
"plugin": ["@slkiser/opencode-quota"]
}If the user already has plugins, append to the existing array.
Based on the user's connected providers, add the appropriate enabledProviders:
{
"experimental": {
"quotaToast": {
"enabledProviders": [
// Add only the providers the user has configured:
// "copilot" - if using GitHub Copilot
// "openai" - if using OpenAI/ChatGPT
// "firmware" - if using Firmware AI
// "chutes" - if using Chutes AI
// "google-antigravity" - if using Google Antigravity (requires opencode-antigravity-auth)
],
},
},
}| If user's config has... | Add to enabledProviders |
|---|---|
github-copilot provider or Copilot models |
"copilot" |
openai / chatgpt provider |
"openai" |
firmware / firmware-ai provider |
"firmware" |
chutes provider |
"chutes" |
google provider with antigravity models |
"google-antigravity" |
opencode-antigravity-auth in plugins |
"google-antigravity" |
For a user with Copilot and Google Antigravity:
{
"plugin": [
"opencode-antigravity-auth", // Required for google-antigravity
"@slkiser/opencode-quota",
],
"experimental": {
"quotaToast": {
"enabledProviders": ["copilot", "google-antigravity"],
"googleModels": ["CLAUDE"], // Options: CLAUDE, G3PRO, G3FLASH
"minIntervalMs": 300000, // 5 minutes between fetches
"toastDurationMs": 9000, // Toast shows for 9 seconds
},
},
}After configuration, instruct the user to:
- Restart OpenCode (or reload the window)
- Run
/quota_statusto verify providers are detected - Run
/quotato manually trigger a toast
- Toast not showing: Run
/quota_statusto diagnose - Google Antigravity not working: Ensure
opencode-antigravity-authplugin is installed and accounts are configured - Copilot quota unreliable: Consider setting up a fine-grained PAT (see Provider-Specific Setup above)
MIT


{ "experimental": { "quotaToast": { "enabledProviders": ["copilot", "openai", "google-antigravity"], }, }, }