Skip to content

tokentopapp/agent-opencode

@tokentop/agent-opencode

npm CI License: MIT

tokentop agent plugin for OpenCode. Parses session data from both SQLite and JSON storage, reads multi-provider credentials, and provides real-time activity monitoring.

Capabilities

Capability Status
Session parsing Yes (SQLite + JSON fallback)
Credential reading Yes (multi-provider)
Real-time tracking Yes
Multi-provider Yes

How It Works

This plugin reads OpenCode's local data to extract:

  • Sessions — parsed from SQLite database (~/.local/share/opencode/opencode.db) with automatic JSON fallback for older installs
  • Credentials — reads OAuth tokens and API keys from ~/.local/share/opencode/auth.json and provider config from ~/.config/opencode/config.json
  • Provider discovery — detects configured providers (Anthropic, OpenAI, Google Gemini, GitHub Copilot, OpenRouter, Antigravity, OpenCode Zen)
  • Real-time monitoring — watches for session file changes to update the dashboard live

Install

This plugin is bundled with tokentop — no separate install needed. If you need it standalone:

bun add @tokentop/agent-opencode

Requirements

  • OpenCode installed
  • Bun >= 1.0.0
  • @tokentop/plugin-sdk ^1.0.0 (peer dependency)

Permissions

Type Access Paths
Filesystem Read ~/.local/share/opencode, ~/.config/opencode

Development

bun install
bun run build
bun test
bun run typecheck

Contributing

See the Contributing Guide. Issues for this plugin should be filed on the main tokentop repo.

License

MIT

About

tokentop agent plugin for OpenCode — session parsing, credential discovery, and real-time cost tracking

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors