From bfb6bfba5903b1d09c4f8f60858f9306985d18ce Mon Sep 17 00:00:00 2001 From: hmo Date: Sun, 19 Jul 2026 20:22:04 +0800 Subject: [PATCH] fix: OCG collector skips non-opencode_go provider accounts (key7 Kimi was leaking into OCG section) --- gateway/scripts/usage_collector.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gateway/scripts/usage_collector.py b/gateway/scripts/usage_collector.py index 49b3c86..93c255f 100644 --- a/gateway/scripts/usage_collector.py +++ b/gateway/scripts/usage_collector.py @@ -607,12 +607,16 @@ def collect_all(cdp_only=False): collected_count = 0 cdp_key_id = None - # ── PRIMARY: HTTP collection for all accounts ── + # ── PRIMARY: HTTP collection for OpenCode Go accounts only ── if not cdp_only: for acc_cfg in accounts_cfg.get('accounts', []): key_id = acc_cfg.get('key_id', '') + provider = acc_cfg.get('provider', 'opencode_go') if not key_id: continue + # Skip non-OCG providers (Kimi etc.) + if provider != 'opencode_go': + continue result = collect_via_http(key_id, acc_cfg) merge_result_into_cache(cache, key_id, result) @@ -635,9 +639,12 @@ def collect_all(cdp_only=False): except Exception as e: log.warning(f'CDP bonus collection skipped: {e}') - # ── Build output ── + # ── Build output (OpenCode Go accounts only) ── accounts_list = [] for acc_cfg in accounts_cfg.get('accounts', []): + # Skip non-OCG providers + if acc_cfg.get('provider', 'opencode_go') != 'opencode_go': + continue kid = acc_cfg.get('key_id', acc_cfg.get('workspace_id', '?')) if kid in cache.get('accounts', {}): # Merge in account config fields