Skip to content

auth: Go API key creation is undiscoverable in the v2 Console and docs still say "copy your API key" #56498

Closed as duplicate

Description

@lucasvidela94

Summary

opencode-go authenticates only by API key — it declares no OAuth method — but the v2 Console no longer presents a discoverable way to create that key. The Go docs still instruct users to "copy your API key", which no longer matches the UI. A Go subscriber on a fresh machine has no working path to authenticate, and the dead end is not obvious because the OAuth device flow that opencode auth login opencode offers belongs to a different integration (opencode, Console) and fails independently with 429.

Environment

  • opencode version: v2.0.29 (channel: latest)
  • OS: Linux 7.2.5-3-omarchy (linux x64)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /usr/bin/bash
  • Install/channel: release (latest)
  • Active plugins: ./plugins/jev

Reproduction

  1. Have an active OpenCode Go subscription whose API key expired or was deleted.
  2. Read the Go docs: "Sign in to the OpenCode Console, subscribe to Go or Go Plus, add your billing details, and copy your API key."
  3. Open the v2 Console. There is no Go API key visible, and the Keys page documents only service accounts minting oc_sk_ workspace keys.
  4. Run opencode auth login and pick the offered OpenCode Console account method.
  5. Observe Authentication failed / 429 POST https://opencode.ai/console/auth/device/code.

Expected Behavior

Either the v2 Console exposes a Go API key under a documented path, or the Go docs describe how to obtain one. A subscriber paying $10/month should be able to connect from a fresh install without reverse-engineering the UI.

Actual Behavior

opencode-go has no OAuth method. Verified against the running server:

{ "id": "opencode",    "methods": [ "key", "env", { "id": "device", "type": "oauth" } ] }
{ "id": "opencode-go", "methods": [ "key", "env" ] }

So the device flow is the wrong path for Go entirely, and nothing in the CLI or the docs says so. opencode auth login opencode — the path a Go subscriber is led to by the docs and by the connect picker — targets opencode, not opencode-go.

The device flow is separately rate limited, with no Retry-After:

POST https://opencode.ai/console/auth/device/code
Content-Type: application/json        (also reproduced with form-urlencoded)

HTTP 429
{"_tag":"RateLimited","message":"Too many requests, please try again later"}

Reproduced 3/3 consecutive attempts from a single client with no prior burst, over a ~30-minute window, from both a curl client and the CLI. The client_id matches the one hardcoded in packages/opencode/src/account/index.ts ("opencode-cli"), so this is not a client-id mismatch — a bad client id returns 400. Form-encoded (the shape the v2 Console API docs show) and JSON (the shape the client sends) return identical 429s, so it is not a content-type issue. packages/opencode/src/session/retry.ts derives backoff from retry-after-ms / retry-after and falls back to a guessed exponential delay when they are absent; the Console is the party that knows the reset time and does not communicate it.

The key path works once a key exists, which is what makes this an onboarding bug rather than a backend bug. opencode auth login opencode-go --method key never touches the device endpoint and succeeds. Registering the key directly also succeeds:

POST /api/integration/opencode-go/connect/key   {"key":"…"}   → HTTP 204

Immediately after, inference works end to end:

opencode run --model opencode-go/deepseek-v4.1-flash        → OK
opencode run --model opencode-go/muse-spark-1.3-contributor → OK

Additional Context

Activity

  1. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up, and for confirming that opencode auth login opencode-go --method key / POST /api/integration/opencode-go/connect/key work once you have a key.

    I think this is a duplicate of #52227: there's no discoverable way to create or copy a Go API key in the v2 Console, and the Go docs still say to "copy your API key".

    Possible duplicates and closely related issues, ordered from most to least likely:

    The device-code 429 without Retry-After and the missing disconnect/DELETE route for integrations are separate from the main problem. Feel free to open focused issues for them.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. lucasvidela94 commented on Oct 17, 2026

    @lucasvidela94
    Author

    Agreed, this is a duplicate of #52227 — I linked it in my own body, so I'd rather the discussion live there than split. Feel free to close this one.

    Before it goes, three things verified here that #52227 does not yet have, in the hope they help whoever picks up the fix:

    1. opencode-go declares no OAuth method at all. This is why the failure is so confusing. From the running server (opencode api get /api/integration):

    { "id": "opencode",    "methods": [ "key", "env", { "id": "device", "type": "oauth" } ] }
    { "id": "opencode-go", "methods": [ "key", "env" ] }

    So opencode auth login opencode — the method the docs and the connect picker steer a Go subscriber toward — targets a different integration. Nothing in the CLI or the docs says the device flow does not apply to Go. For a subscriber who only knows "I need Go," that dead end reads as a broken backend rather than a wrong path, which is probably why a lot of the reports here are people concluding Go is broken.

    2. The backend is fine — it is purely onboarding. Once a key exists, both documented and undocumented routes succeed:

    opencode auth login opencode-go --method key          # never touches the device endpoint
    POST /api/integration/opencode-go/connect/key  →  204
    

    and inference works end to end immediately after:

    opencode run --model opencode-go/deepseek-v4.1-flash        → OK
    opencode run --model opencode-go/muse-spark-1.3-contributor → OK
    

    3. Where the key actually is, per users who found it. A thread on linux.do describes the path as: open Settings, click your account name to reach a further screen, then click Create. Users there spent a long time hunting for it. Meanwhile a user on X was pointed at the Keys tab and got a workspace oc_sk_ key instead of a Go key. That split is consistent with #52243 / #51388 and is probably the concrete UI defect worth fixing.

    Smaller one: a stale opencode-go credential could not be removed through the integration API — there is no DELETE route under /api/integration/{integrationID} — and had to be removed with opencode auth logout opencode-go <credentialID>. I'm filing that and the device-code 429 without Retry-After as separate focused issues, as suggested above.

  3. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for confirming, and for the extra detail. The three points you added are useful for whoever picks this up:

    1. opencode-go declares only key/env, with no OAuth method, so the Console device flow can never connect Go.
    2. The backend works once a key exists (--method key or connect/key, and inference runs afterwards), so the gap is onboarding.
    3. The Go key is created from Settings → your account name → Create. It is not the Keys tab, which gives oc_sk_ workspace keys, as in desktop: "Connect OpenCode Go" runs Console sign-in instead of the Go API-key flow, then reports success and fails with "Invalid credential" #52243 and api key missing #51388.

    Since this issue will be closed in favour of #52227, please post a short version of these points as a comment on #52227. Otherwise they won't be on the thread people working on the fix will read. Linking the separate issues for the device-code 429 without Retry-After and the missing integration disconnect/DELETE route there would help as well.

    The bot will close this one as a duplicate of #52227 as planned.

  4. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #52227, as you agreed above. Updates on the missing Go API key in the v2 Console and the outdated "copy your API key" docs will be in #52227, so please follow that issue. If you haven't yet, posting your three findings there will help whoever works on the fix: Go has no OAuth method, the key path works end to end, and the Settings → account name → Create path for the Go key. Thanks for the thorough 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions