跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    gilvex

    Usage Left

    v1.0.3界面与主题
    opencode-usage-left

    OpenCode TUI sidebar showing quota percentages, reset times, and credit balances for connected providers.

    GitHub 星标

    1

    月装机量

    643

    近 7 天 50

    综合评分SCORE

    39.4

    生态多维模型

    最近提交

    12 天前

    2026-08-07

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-usage-left@1.0.3"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    OpenCode TUI plugin that lists every provider shown by opencode auth list in the session sidebar.

    • Percentage quotas show a bar, percentage remaining, and time until reset.
    • Credit quotas show the provider, balance, and amount left.
    • Click the section or any provider header to fold and unfold it.
    • Providers without an accessible usage API remain listed as unavailable.
    • Credentials are read from OpenCode's XDG auth store on every refresh and are never logged or cached.

    Supported usage adapters: OpenAI/Codex, Anthropic OAuth, OpenRouter, Z.AI Coding Plan, Synthetic, MiniMax Token Plan, OpenCode Zen, and OpenCode Go.

    OpenCode does not currently expose Zen balance or Go quota endpoints for API keys. Their adapters use the authenticated workspace dashboard. Store the credentials in ~/.config/opencode/opencode-usage-left.json:

    {
      "openCode": {
        "workspaceId": "wrk_...",
        "authCookie": "your-opencode.ai-auth-cookie"
      }
    }
    

    Protect the browser session cookie from other users:

    chmod 600 ~/.config/opencode/opencode-usage-left.json
    

    The plugin follows XDG_CONFIG_HOME. Set OPENCODE_USAGE_LEFT_CONFIG to use another path. Environment variables are temporary overrides and take precedence over the file:

    export OPENCODE_GO_WORKSPACE_ID="wrk_..."
    export OPENCODE_GO_AUTH_COOKIE="your-opencode.ai-auth-cookie"
    

    Find the auth cookie in your browser's developer tools under Storage/Cookies for opencode.ai. It is only sent to fixed https://opencode.ai/workspace/... URLs and is never logged or cached. Without stored credentials, Zen and Go display need creds.

    Install

    Install the package, then add it to ~/.config/opencode/tui.json:

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": ["opencode-usage-left"]
    }
    

    For local development, use the package directory so OpenCode resolves its runtime-safe ./tui source entrypoint:

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": ["/absolute/path/to/opencode-usage-left"]
    }
    

    Restart OpenCode after changing tui.json.

    Options

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": [
        [
          "opencode-usage-left",
          {
            "refreshIntervalSeconds": 60,
            "requestTimeoutMs": 10000,
            "showUnavailable": true
          }
        ]
      ]
    }
    

    Provider quota endpoints are not standardized and some are private APIs that may change. A failed provider request is isolated and does not prevent other balances from rendering.