opencode-streamdeck-stats
v1.1.0
Published
OpenCode plugin that serves Stream Deck-ready stats from local OpenCode data
Maintainers
Readme
OpenCode Stats Plugin
This plugin runs inside OpenCode and serves Stream Deck-ready stats at:
GET /healthGET /stats
Default bind: 127.0.0.1:4649
Install
- Create the global plugins directory if it does not exist:
mkdir -p ~/.config/opencode/plugins- Copy this plugin file:
cp opencode-streamdeck-stats.js ~/.config/opencode/plugins/opencode-streamdeck-stats.jsAlternative (from npm package):
npm view opencode-streamdeck-stats version
npm pack opencode-streamdeck-stats
tar -xzf opencode-streamdeck-stats-*.tgz
cp package/opencode-streamdeck-stats.js ~/.config/opencode/plugins/opencode-streamdeck-stats.js
rm -rf package opencode-streamdeck-stats-*.tgz- Restart OpenCode.
OpenCode loads plugins at startup. Restart is required after updating this file.
Environment overrides
OPENCODE_STREAMDECK_HOST(default:127.0.0.1)OPENCODE_STREAMDECK_PORT(default:4649)OPENCODE_DB_PATH(default:~/.local/share/opencode/opencode.db)
Response shape
GET /stats returns:
{
"ok": true,
"source": "opencode-plugin",
"generatedAt": 0,
"stats": {
"totalCost": 0,
"costPerDay": 0,
"costLastDay": 0,
"costLast30Days": 0,
"costThisMonth": 0,
"inputTokens": 0,
"outputTokens": 0,
"reasoningTokens": 0,
"cacheRead": 0,
"cacheWrite": 0,
"activeSessions": 0,
"totalSessions": 0,
"tokensPerSession": 0
}
}Notes:
- Uses the local OpenCode SQLite DB.
- Excludes subtask sessions (
parent_id IS NOT NULL) to avoid double counting.
