Skip to content

v2.1.3: Console account connected (52 models in /api/v2/config) but opencode provider never registers #58335

Closed as not planned

Description

@cripperzprodigy

Summary

A connected OpenCode Console account is fully valid — the Console config endpoint returns 52 opencode models — but the opencode provider never registers: /api/provider omits it and /api/model contains zero opencode/* models. opencode-go (served from models.dev) works.

Environment

  • opencode v2.1.3 (latest, 2026-10-23)
  • Ubuntu 24.04 (Linux x64), self-hosted opencode serve --service on 0.0.0.0:4096
  • Config: V2 providers (no legacy provider key), enterprise.url = https://opencode.ai/console
  • Service env: OPENCODE_API_KEY and OPENCODE_CONSOLE_TOKEN both set to the same oc_sk_... service key

Evidence

GET https://opencode.ai/console/api/v2/config with the same key → HTTP 200:

{ "providers": {
    "opencode":    { "name": "...", "headers": {...}, "models": { /* 52 models */ } },
    "opencode-go": { "name": "...", "headers": {...}, "models": { /* 0 models */ } }
} }

Credential + account state (from ~/.local/share/opencode/opencode.db):

  • account: [email protected], url https://opencode.ai/console, token_expiry ≈ 2026-11-19 (not expired)
  • account_state: active_account_id set, active_org_id = wrk_01KWC3KGW…
  • credential: integration opencode, active=1, key = same oc_sk_…

But the server reports:

  • GET /api/provider → ["opencode-go","nvidia","9router","byteplus-plan","agnes-paid","agnes-cripperz","muse-direct","lmstudiomac","ollamamac","tencentdb-agent-memory"] — no opencode
  • GET /api/model → 149 models, 0 with providerID: "opencode"
  • opencode models → no opencode/* entries

What I tried

  1. providers.opencode block removed entirely (let the built-in Console provider register) → still absent.
  2. providers.opencode defined in the documented V2 shape (package: @opencode/ai/providers/openai-compatible, settings.baseURL: https://opencode.ai/inference/openai/v1, settings.apiKey: {env:OPENCODE_API_KEY}, headers.x-opencode-org-id) → still absent from /api/provider (the block is present in opencode debug config).
  3. opencode service set env OPENCODE_API_KEY <key> + opencode service restart → still absent.
  4. opencode auth list shows OpenCode Console — API key (stored) + OPENCODE_API_KEY (environment).

Expected

opencode provider registered with its 52 Console models, selectable as opencode/<model>.

Notes

  • opencode-go is present with 28 models (models.dev path), so the Console gateway credential works.
  • This may be related to core: all models.dev providers disappear when the catalog fetch fails #57458 (catalog/provider registry), but here the models.dev catalog is demonstrably loaded (10 providers, 149 models); only the Console-registered provider is missing.
  • Desktop/TUI symptom: opencode/* models are simply absent from the picker.

Activity

  1. opencode-agent commented on Oct 23, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I tried to reproduce this on v2.1.3 and couldn't. I used a mock Console that returns a config shaped like yours (opencode with models, opencode-go with none), a stored opencode API-key credential, and opencode serve. I also tried each of these:

    • OPENCODE_API_KEY and OPENCODE_CONSOLE_TOKEN set to the same key as well
    • only the env var
    • enterprise.url plus custom V2 providers
    • a custom providers.opencode block like your second attempt

    In every case /api/provider listed both opencode-go and opencode, and /api/model had the opencode/* models.

    So something in your setup must be different. These would help narrow it down:

    1. Your config as shown by opencode debug config, with keys and URLs redacted. In particular, any setting that enables, disables or filters providers.
    2. The full output of opencode auth list. Your database shows an account row as well as the key credential, so do you also have a signed-in Console account (OAuth), and which credential is active?
    3. The server logs from startup with --log-level debug, especially any line containing failed to load OpenCode provider config. For the service, check the journal or run opencode serve in the foreground with the same environment.
    4. The JSON for opencode-go from GET /api/provider (its integrationID, activation and headers), and whether it still appears if you stop the service and run opencode serve directly.

    You can reply here, or edit the issue and leave a comment saying you've updated it.

  2. cripperzprodigy commented on Oct 23, 2026

    @cripperzprodigy
    Author

    Update: device-flow auth succeeded, provider still absent — plus a concrete clue

    After filing this, I completed opencode auth login "OpenCode Console" --method device successfully:

    • opencode auth list now shows OpenCode Console — Default — stored (session) alongside the API key + env entries.
    • account row unchanged ([email protected], token expiry 2026-11-19).
    • Restarted the service (opencode service restart) → /api/provider still lists 10 providers without opencode; /api/model still 0 opencode/*.

    Clue — the Console config endpoint requires x-org-id for account session tokens:

    With the account access_token (st_…):

    curl -H "Authorization: Bearer $ST" https://opencode.ai/console/api/v2/config
    # 400 {"_tag":"OrgRequired","message":"x-org-id is required","code":"org_required"}
    
    curl -H "Authorization: Bearer $ST" -H "x-org-id: wrk_01KWC3KGW22QXBV0J758AHSE7G" \
      https://opencode.ai/console/api/v2/config
    # 200 → providers: { opencode: 52 models, opencode-go: 0 models }

    Note the header name differs from the inference path: the Console config API wants x-org-id, while the OpenCode docs/examples use x-opencode-org-id for inference. If the provider-sync call sends x-opencode-org-id (or omits the org), it gets org_required and the provider is silently dropped — which would match the observed behaviour exactly.

    The service key (oc_sk_…) works without any org header (200), so the failure is specific to the account-session path.

    Repro host: v2.1.3, Ubuntu 24.04, opencode serve --service, account_state.active_org_id = wrk_01KWC3KGW….

  3. cripperzprodigy commented on Oct 23, 2026

    @cripperzprodigy
    Author

    Correction — this is not a bug; closing

    I found the actual cause on the reporting host: opencode.json contains

    "policies": [
      { "action": "provider.use", "resource": "opencode", "effect": "deny" }
    ]

    This policy deliberately disables the pay-as-you-go opencode provider (the account has no
    funds — 402 Insufficient account funds), while opencode-go remains available. The provider is
    therefore correctly absent from /api/provider and /api/model; the Console still advertising
    52 models is expected (the catalog is independent of the local policy).

    The device-flow re-auth and the x-org-id observation are still accurate data points, but they
    are not a defect. Sorry for the noise — closing as not-a-bug.

  4. opencode-agent commented on Oct 26, 2026

    @opencode-agent
    Contributor

    I'm closing this for now because we couldn't reproduce it and haven't heard back. On v2.1.3, with a Console config shaped like yours, the opencode provider and its models showed up next to opencode-go in every setup I tried: a stored key, the OPENCODE_API_KEY/OPENCODE_CONSOLE_TOKEN env vars, enterprise.url, and a custom providers.opencode block. Without your config, opencode auth list output and server logs, we can't tell what's different on your side.

    If it still happens, please reply with the details from my earlier comment and we can reopen it:

    • opencode debug config, redacted
    • opencode auth list
    • startup logs with --log-level debug, especially any failed to load OpenCode provider config line
    • whether it also happens when you run opencode serve in the foreground instead of as a service

    Thanks for the detailed report.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions