Skip to content

Quota probe for OpenCode Go is gated on the literal provider name, so additional Go providers (multi-account setups) show no quota #1924

Closed

Description

@0xtootoo29

Client or integration

OpenCodex dashboard

Area

Provider adapter

Summary

When multiple providers point at the canonical OpenCode Go base URL (https://opencode.ai/zen/go/v1) — the natural setup for balancing several Go subscriptions via combos — only the provider literally named opencode-go shows the rate-limit panel (5h / weekly / 30d). The sibling providers show no quota in the dashboard, and ocx provider quota --refresh --json returns no report rows for them. Expected: every key-auth provider on the canonical Go base URL reports quota.

Root cause: src/providers/quota.ts L2087 gates the probe on the provider name:

if ((provider.authMode ?? "key") === "key" && name === "opencode-go") {
  return fetchOpenCodeGoQuota(name, provider);
}

The Kimi branch just above (L2075) already uses the canonical-base-URL pattern instead, and fetchOpenCodeGoQuota itself re-validates isCanonicalOpenCodeGoBaseUrl(config.baseUrl) (L487), so the name check is both too narrow and redundant.

Proposed fix (verified locally on v2.14.0 — report rows went from 1 to 5, dashboard renders rate-limit bars for every sibling provider):

-    if ((provider.authMode ?? "key") === "key" && name === "opencode-go") {
+    if ((provider.authMode ?? "key") === "key" && isCanonicalOpenCodeGoBaseUrl(provider.baseUrl)) {
       return fetchOpenCodeGoQuota(name, provider);
     }

Safe against key leakage to non-canonical hosts because fetchOpenCodeGoQuota still checks the canonical URL before sending the bearer key.

Reproduction

  1. ocx provider add opencode-go --api-key sk-AAA (registry preset)
  2. ocx provider add opencode-go-2 --adapter openai-chat --base-url https://opencode.ai/zen/go/v1 --api-key sk-BBB
  3. ocx provider quota --refresh --json
  4. Only one "provider": "opencode-go" report is returned; the dashboard overview page for opencode-go-2 has no rate-limit section.

Version

v2.14.0 (repro); the gate is unchanged on current main as of 2026-08-17 (L2087)

Operating system

macOS (Darwin 25.5)

Provider and model

opencode-go (any model; the quota probe is model-independent)

Logs or error output

ocx provider quota --refresh --json before the fix returns a single opencode-go report row; after the one-line change it returns all five (opencode-go, opencode-go-2 … opencode-go-5), each with fiveHourPercent / weeklyPercent / monthlyPercent populated from https://opencode.ai/zen/go/v1/usage.

Screenshots and supporting files

No response

Redacted configuration

Providers: opencode-go (registry preset) plus opencode-go-2..5, all adapter: openai-chat, baseUrl: https://opencode.ai/zen/go/v1, authMode: key, one API key each. Keys redacted.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Aug 17, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  2. added
    bugSomething isn't working
    providerProvider adapters, OpenAI-compat presets, upstream API quirks
    on Aug 17, 2026
  3. yzxcj797 commented on Aug 18, 2026

    @yzxcj797
    Contributor

    One-line fix along your verified diff, plus regression tests:

    • the quota gate now checks isCanonicalOpenCodeGoBaseUrl(provider.baseUrl) (matching the Kimmi/A6api/CommandCode branches just above) instead of the literal provider name — every key-auth provider on the canonical Go base URL gets a report, and the bearer key still never leaves for non-canonical hosts because fetchOpenCodeGoQuota re-validates the base URL before fetching;
    • new tests in tests/opencode-go-quota.test.ts: the exact repro (a sibling provider named opencode-go-2 on the canonical URL now reports quota alongside opencode-go — previously only the literal name produced a row), and a non-canonical base URL never probes opencode.ai with the key.
  4. Ingwannu commented on Aug 18, 2026

    @Ingwannu
    Owner

    Confirmed against current dev: the literal provider-name gate is still present and is narrower than the canonical destination check already enforced inside the probe. Draft PR #2027 now targets dev; keeping this issue open until that exact-head implementation and CI are reviewed.

  5. lidge-jun commented on Aug 19, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 46 / 80

    OpenCode Go 키를 여러 프로바이더로 나눠 콤보로 묶으면, 이름이 정확히 opencode-go 인 행만 쿼터 패널이 나온다. 형제 프로바이더는 대시보드와 ocx provider quota 에 행이 없다. 옵트인 멀티키 호환이라 46이다. 기본 native 경로가 아니다.

    src/providers/quota.ts 가 키 모드에서 name === opencode-go 일 때만 fetchOpenCodeGoQuota 를 부른다. 그 함수는 이미 isCanonicalOpenCodeGoBaseUrl 로 목적지를 다시 검사한다. 이름 게이트는 좁고 중복이다. 바로 아래 a6api 분기는 이름 대신 canonical baseUrl 을 본다.

    OPENCODE_GO_BASE_URL 은 https://opencode.ai/zen/go/v1 이다. 복제 프로바이더가 이 URL과 키 모드면 프로브해야 한다. 다른 호스트에 같은 이름을 쓰는 커스텀은 fetch 함수의 canonical 가드가 키를 안 보낸다.

    이 구멍이 #2060 의 Go 풀 요청을 가로막는다. 쿼터를 못 보면 소진 전환도 못 한다. 콤보 라운드로빈은 멤버를 돌려도 대시보드 숫자는 안 나온다.

    해결방안

    이름 비교를 isCanonicalOpenCodeGoBaseUrl(provider.baseUrl) 로 바꾼다. fetchOpenCodeGoQuota 는 그대로 둔다. 키 모드만 연다. 회귀는 같은 Go URL을 쓰는 복제 프로바이더마다 쿼터 행이 나오는 것, 다른 URL은 프로브하지 않는 것이다.

    이 댓글은 grok-bot이 작성했습니다

  6. lidge-jun commented on Aug 19, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 64 / 80 · 유지

    점수 정정임. 46 → 64. Go 쿼타 프로브가 이름 opencode-go일 때만 돌아서, opencode-go-2 같은 형제 키는 대시보드/CLI에 안 나옴. fetchOpenCodeGoQuota는 이미 URL 검사함. 앞 게이트만 이름이라 잘림.

    유지함. 프로브(#1545/#2057)는 dev에 있음. 이건 그 표시를 키 여러 개로 여는 한 줄. #2060 로테이션이랑 이웃이지만 로테이션 전에 이게 있어야 함.

    해결방안: name === "opencode-go" 를 isCanonicalOpenCodeGoBaseUrl(provider.baseUrl) 로. draft #2027이 그 방향. 키는 캐논 URL일 때만 나감.

    이 댓글은 grok-bot이 작성했습니다

  7. lidge-jun commented on Aug 20, 2026

    @lidge-jun
    Owner

    Fixed on dev by #2164, merged as 31750b0.

    Verified present on the branch rather than assumed: git log origin/dev shows the merge commit above. These PRs target dev rather than main, so GitHub does not auto-close the linked issue — this closure is manual.

    It ships in the next release cut from dev. Reopen if you still see it after updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, plansbugSomething isn't workingproviderProvider adapters, OpenAI-compat presets, upstream API quirks

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions