opencode-quota  by slkiser

Track AI provider quota and token usage within OpenCode

Created 3 months ago
304 stars

Top 87.9% on SourcePulse

GitHubView on GitHub
Project Summary

OpenCode Quota (slkiser/opencode-quota) addresses the need for transparent usage tracking of various AI coding assistants within the OpenCode IDE. It provides users with real-time visibility into token consumption and quota limits for services like GitHub Copilot, OpenAI, Anthropic Claude, Cursor, and many others, directly within their development environment. This tool is designed for developers and power users who leverage multiple AI coding tools and need to monitor their usage, manage costs, and avoid unexpected overages, all without polluting the AI's context window.

How It Works

This project integrates as an OpenCode plugin, offering a multi-faceted approach to quota and token visibility. It features a TUI (Text User Interface) sidebar panel that displays quota information, alongside optional popup "toasts" that appear after assistant responses. Users can also invoke detailed reports and diagnostics via slash commands like /quota, /quota_status, and various /tokens_* commands. The plugin supports auto-detection for many AI providers, leveraging existing OpenCode authentication, while also allowing manual configuration and offering specific setup guides for providers requiring companion plugins or local CLI installations.

Quick Start & Requirements

The recommended installation is via the automatic setup command: npx @slkiser/opencode-quota init. This interactive installer guides users through configuration choices for scope, UI elements, provider mode, and display styles. Manual installation involves adding the plugin to opencode.json (and tui.json for the sidebar). OpenCode version 1.4.3 or later is required. Some providers necessitate additional companion plugins (e.g., for Cursor, Google Antigravity, Qwen Code) or local installations (e.g., Claude Code CLI). Configuration settings are managed in opencode.json/opencode.jsonc and tui.json/tui.jsonc.

Highlighted Details

  • Extensive Provider Support: Integrates with a wide array of services including Anthropic (Claude), GitHub Copilot, OpenAI, Cursor, Qwen Code, Alibaba Coding Plan, MiniMax, Kimi Code, Chutes AI, Synthetic, Google Antigravity, Z.ai, NanoGPT, and OpenCode Go.
  • Flexible UI: Offers a choice between a TUI sidebar, non-intrusive popup toasts, or both, alongside comprehensive slash commands for detailed reports.
  • Zero Context Pollution: Engineered to provide usage data without impacting the AI's operational context window.
  • Detailed Token Reporting: Provides usage statistics for various timeframes (daily, weekly, monthly, session) and includes local pricing estimations for deterministic reporting.

Maintenance & Community

The repository includes a CONTRIBUTING.md file, suggesting a structured approach to contributions. However, specific details regarding maintainers, sponsorships, or community channels (like Discord or Slack) are not readily available in the provided README.

Licensing & Compatibility

The project is released under the MIT License, which is permissive and generally allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

The OpenCode Go provider relies on scraping the OpenCode Go dashboard, making it susceptible to breakage if the dashboard's HTML structure changes; an official API is pending. Several providers, such as Google Antigravity and Qwen Code, require separate companion authentication plugins to be installed manually. Additionally, some providers necessitate specific local installations or authentication configurations, adding to the setup complexity for those particular services.

Health Check
Last Commit

14 hours ago

Responsiveness

Inactive

Pull Requests (30d)
9
Issues (30d)
19
Star History
211 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.