opencode-quota icon indicating copy to clipboard operation
opencode-quota copied to clipboard

[bug]: `show` CLI command seems to fail for some providers (Gemini, Copilot)

Open capyBearista opened this issue 7 months ago • 2 comments

Pre-flight checks

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I verified this on the current production released OpenCode version, or I explain why not below.

OpenCode version tested

1.14.31

opencode-quota version tested

3.5.0

Bug summary

Executing npx @slkiser/opencode-quota show (latest—v3.5.0—version verified) does not seem to correctly show the quota data for the Gemini CLI and Copilot providers, but it does for OpenCode Go and OpenAI.

Steps to reproduce

  1. Set up config (opencode.json):
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "@slkiser/opencode-quota"
  ],
  "experimental": {
    "quotaToast": {
      "enableToast": true,
      "showSessionTokens": true,
      "enabledProviders": [
        "copilot",
        "google-gemini-cli",
        "openai",
        "opencode-go"
      ],
      "formatStyle": "allWindows",
      "percentDisplayMode": "used"
    }
  }
}
  1. Run npx @slkiser/opencode-quota show.

Expected behavior

Displaying an output similar to this (taken from OpenCode sidebar):

Image

Actual behavior

Providers Gemini CLI and Copilot fail:

Image

Relevant logs/output

# Quota Status (opencode-quota v3.4.0) (/quota_status) 12:10 01/05/2026

toast:
- configSource: files
- configPaths: /home/arjun/.config/opencode/opencode.json (experimental.quotaToast)
- precedence: global defaults -> workspace overrides
- global_config_paths: /home/arjun/.config/opencode/opencode.json (experimental.quotaToast)
- workspace_config_paths: (none)
- setting_sources: enableToast<=/home/arjun/.config/opencode/opencode.json (experimental.quotaToast) | formatStyle<=/home/arjun/.config/opencode/opencode.json (experimental.quotaToast) | percentDisplayMode<=/home/arjun/.config/opencode/opencode.json (experimental.quotaToast) | enabledProviders<=/home/arjun/.config/opencode/opencode.json (experimental.quotaToast) | showSessionTokens<=/home/arjun/.config/opencode/opencode.json (experimental.quotaToast)
- enabledProviders: copilot,google-gemini-cli,openai,opencode-go
- onlyCurrentModel: false
- currentModel: (error: session.get returned no modelID)

tui:
- workspace_root: /home/arjun
- config_root: /home/arjun
- config_configured: true
- inferred_selected_config_path: /home/arjun/.config/opencode/tui.json
- present_config_paths: /home/arjun/.config/opencode/tui.json
- candidate_config_paths: /home/arjun/.config/opencode/tui.json | /home/arjun/.config/opencode/tui.jsonc | /home/arjun/tui.json | /home/arjun/tui.jsonc | /home/arjun/.opencode/tui.json | /home/arjun/.opencode/tui.jsonc
- quota_plugin_configured: true
- quota_plugin_paths: /home/arjun/.config/opencode/tui.json
- providers:
  - anthropic: disabled unavailable
  - copilot: enabled available
  - openai: enabled available
  - cursor: disabled unavailable
  - qwen-code: disabled available
  - alibaba-coding-plan: disabled unavailable
  - synthetic: disabled unavailable
  - chutes: disabled unavailable
  - google-antigravity: disabled unavailable
  - google-gemini-cli: enabled available
  - zai: disabled unavailable
  - nanogpt: disabled unavailable
  - minimax-coding-plan: disabled unavailable
  - kimi-for-coding: disabled unavailable
  - opencode-go: enabled available

paths:
- opencode_dirs: data=/home/arjun/.local/share/opencode config=/home/arjun/.config/opencode cache=/home/arjun/.cache/opencode state=/home/arjun/.local/state/opencode
- auth.json: preferred=/home/arjun/.local/share/opencode/auth.json present=/home/arjun/.local/share/opencode/auth.json candidates=/home/arjun/.local/share/opencode/auth.json
- qwen oauth auth configured: true
- qwen_oauth_source: qwen-code
- qwen_local_plan: qwen-code/free
- alibaba auth configured: false
- alibaba_api_key_source: (none)
- alibaba_api_key_checked_paths: /home/arjun/.config/opencode/opencode.json
- alibaba_api_key_auth_paths: /home/arjun/.local/share/opencode/auth.json
- alibaba coding plan fallback tier: lite
- alibaba_coding_plan: (none)

openai:
- auth_configured: true
- auth_source: openai
- token_status: valid
- token_expires_at: 2026-05-02T22:56:11.218Z
- account_email: [email protected]
- account_id: 079bb194-5651-4f9d-8437-45546a68159d
- live_probe: success
- live_entry_1: OpenAI (free) percent_remaining=85 reset_at=2026-05-07T05:41:35.000Z

anthropic:
- cli_installed: true
- cli_version: 2.1.123
- auth_status: authenticated
- quota_supported: false
- quota_source: (none)
- checked_commands: claude --version | claude auth status --json
- message: Claude CLI auth detected, but quota was unavailable from both the local CLI and Claude OAuth fallback. Anthropic API error 401: {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials","details":{"error_

cursor:
- plan: none
- included_api_usd: (none)
- billing_cycle_start_day: (calendar month)
- auth_state: present
- auth_selected_path: /home/arjun/.local/share/opencode/auth.json
- auth_present_paths: /home/arjun/.local/share/opencode/auth.json
- auth_candidate_paths: /home/arjun/.local/share/opencode/auth.json | /home/arjun/.config/cursor/cli-config.json | /home/arjun/.config/cursor/auth.json | /home/arjun/.cursor/cli-config.json | /home/arjun/.cursor/auth.json
- plugin_enabled: false
- canonical_plugin_package: @playwo/opencode-cursor-oauth
- provider_configured: false
- config_matches: (none)
- config_checked_paths: /home/arjun/.config/opencode/opencode.json | /home/arjun/.config/opencode/opencode.jsonc | /home/arjun/opencode.json | /home/arjun/opencode.jsonc
- cycle_source: calendar_month
- cycle_reset_at: 2026-06-01T04:00:00.000Z
- api_usage: $0.00 across 0 messages
- auto_composer_usage: $0.00 across 0 messages
- total_cursor_usage: $0.00 across 0 messages
- unknown_cursor_models: 0
- qwen free local quota: path=/home/arjun/.local/state/opencode/opencode-quota/qwen-local-quota.json exists=false
- qwen free local usage: daily=0/1000 rpm=0/60 (default state)
- alibaba coding plan local quota: path=/home/arjun/.local/state/opencode/opencode-quota/alibaba-coding-plan-local-quota.json exists=false

minimax:
- auth_state: none
- api_key_configured: false
- api_key_source: (none)
- api_key_checked_paths: /home/arjun/.config/opencode/opencode.json
- api_key_auth_paths: /home/arjun/.local/share/opencode/auth.json

kimi:
- auth_state: none
- api_key_configured: false
- api_key_source: (none)
- api_key_checked_paths: /home/arjun/.config/opencode/opencode.json
- api_key_auth_paths: /home/arjun/.local/share/opencode/auth.json

opencode_go:
- config_state: configured
- config_source: env
- config_checked_paths: /home/arjun/.config/opencode/opencode-quota/opencode-go.json
- selected_windows: rolling,weekly,monthly
- rolling_usage: percent_used=0 percent_remaining=100 reset_in_sec=18000 reset_at=2026-05-01T21:10:43.431Z
- weekly_usage: percent_used=74 percent_remaining=26 reset_in_sec=200956 reset_at=2026-05-03T23:59:59.431Z
- monthly_usage: percent_used=87 percent_remaining=13 reset_in_sec=1652102 reset_at=2026-05-20T19:05:45.431Z
- live_probe: success
- live_entry_1: OpenCode Go Monthly percent_remaining=13 reset_at=2026-05-20T19:05:45.720Z

zai:
- auth_state: none
- api_key_configured: false
- api_key_source: (none)
- api_key_checked_paths: /home/arjun/.config/opencode/opencode.json
- api_key_auth_paths: /home/arjun/.local/share/opencode/auth.json

synthetic:
- synthetic api key: configured=false checked=/home/arjun/.config/opencode/opencode.json

chutes:
- chutes api key: configured=false checked=/home/arjun/.config/opencode/opencode.json

nanogpt:
- api_key_configured: false
- api_key_source: (none)
- api_key_checked_paths: /home/arjun/.config/opencode/opencode.json
- api_key_auth_paths: /home/arjun/.local/share/opencode/auth.json

copilot_quota_auth:
- pat_state: absent
- billing_mode: user_quota
- billing_scope: user
- quota_api: copilot_internal_user
- billing_api_access_likely: true
- remaining_totals_state: available
- pat_checked_paths: /home/arjun/.config/opencode/copilot-quota-token.json
- oauth_configured: true key=github-copilot refresh=true access=true
- effective_source: oauth
- override: none
- live_probe: success
- live_entry_1: percent_remaining=100 reset_at=2026-06-01T00:00:00.000Z

google_antigravity:
- auth_state: missing
- selected_accounts_path: (none)
- present_accounts_paths: (none)
- candidate_accounts_paths: /home/arjun/.config/opencode/antigravity-accounts.json | /home/arjun/.local/share/opencode/antigravity-accounts.json
- account_count: 0
- valid_account_count: 0
- companion_package_state: missing
- companion_package_path: (none)
- companion_error: Install opencode-antigravity-auth separately to enable Google Antigravity quota
- token_cache_path: /home/arjun/.cache/opencode/opencode-quota/google-access-tokens.json exists=true
- opencode db: preferred=/home/arjun/.local/share/opencode/opencode.db present=/home/arjun/.local/share/opencode/opencode.db candidates=/home/arjun/.local/share/opencode/opencode.db

google_gemini_cli:
- auth_state: present
- auth_source: google
- account_count: 1
- valid_account_count: 1
- companion_package_state: present
- companion_package_path: /home/arjun/.cache/opencode/node_modules/opencode-gemini-auth/src/constants.ts
- live_probe: success
- live_entry_1: percent_remaining=84 reset_at=2026-05-01T22:02:17Z

storage:
- sessions_in_db: 735
- messages_in_db: 19,380
- assistant_messages_in_db: 17,613

pricing_snapshot:
- pricing: source=https://models.dev/api.json active_source=runtime generated_at=2026-04-26T19:59:50.434Z units=USD per 1M tokens
- selection: configured=auto active=runtime
- runtime_paths: snapshot=/home/arjun/.cache/opencode/opencode-quota/modelsdev-pricing.runtime.min.json refresh_state=/home/arjun/.cache/opencode/opencode-quota/modelsdev-pricing.refresh-state.json
- staleness: age_ms=418,266,178 max_age_ms=604,800,000 stale=false
- refresh_policy: auto_refresh_days=7
- refresh: last_attempt_at=2026-04-26T19:59:50.434Z last_success_at=2026-04-26T19:59:50.434Z last_failure_at=(none) last_result=success
- providers: anthropic,google,moonshotai,openai,xai,zai
- coverage_seen: priced_keys=18 mapped_but_missing=2 unpriced_keys=0
  - anthropic: models=23 priced_models_seen=1 mapped_but_missing_models_seen=0 unpriced_models_seen=0
  - google: models=35 priced_models_seen=5 mapped_but_missing_models_seen=1 unpriced_models_seen=0
  - moonshotai: models=7 priced_models_seen=2 mapped_but_missing_models_seen=0 unpriced_models_seen=0
  - openai: models=47 priced_models_seen=6 mapped_but_missing_models_seen=0 unpriced_models_seen=0
  - xai: models=25 priced_models_seen=1 mapped_but_missing_models_seen=0 unpriced_models_seen=0
  - zai: models=13 priced_models_seen=3 mapped_but_missing_models_seen=1 unpriced_models_seen=0

supported_providers_pricing:
- anthropic: pricing=yes (models.dev snapshot provider)
- copilot: pricing=yes (connector (priced via models.dev openai))
- openai: pricing=yes (models.dev snapshot provider)
- cursor: pricing=partial (API-pool models map to official pricing; Auto/Composer use bundled static Cursor rates)
- qwen-code: pricing=no (local request-count estimate (free tier, no token pricing API))
- alibaba-coding-plan: pricing=no (local request-count estimate (tiered rolling windows, no token pricing API))
- synthetic: pricing=no (subscription request quota (not token-priced))
- chutes: pricing=no (no local usage observed)
- google-antigravity: pricing=yes (connector (priced via models.dev google/anthropic))
- google-gemini-cli: pricing=yes (connector (priced via models.dev google))
- zai: pricing=yes (models.dev snapshot provider)
- nanogpt: pricing=no (subscription request quota + account balance (not token-priced))
- minimax-coding-plan: pricing=no (no local usage observed)
- kimi-for-coding: pricing=no (request quota via Kimi Code API (not token-priced))
- opencode-go: pricing=no (subscription percentage quota via dashboard scraping (not token-priced))

unpriced_models:
- none

unknown_pricing:
- keys: 14 tokens_total=212,373,957
- opencode-go/deepseek-v4-pro: mapped=(none) tokens=98,917,210 msgs=887
- opencode-go/qwen3.6-plus: mapped=(none) tokens=65,678,662 msgs=604
- opencode-go/deepseek-v4-flash: mapped=(none) tokens=18,590,921 msgs=117
- opencode/minimax-m2.5-free: mapped=(none) tokens=17,093,708 msgs=186
- opencode/gemini-3.1-pro: mapped=google/gemini-3.1-pro tokens=7,355,327 msgs=93
- ... (9 more)

If not tested on current production OpenCode, explain why

No response

capyBearista avatar May 01 '26 16:05 capyBearista

@capyBearista Was it working on v3.4.0 (asking since your /quota_status shows v3.4.0)?

If so sorry for the regression

slkiser avatar May 01 '26 23:05 slkiser

I (think) fixed in v3.6.0

slkiser avatar May 02 '26 19:05 slkiser