Skip to content

[Bug] OpenCode Zen dashboard only shows truncated API keys (sk-XXXX...YYYY) - full key never reaches user, API returns 401 Invalid API key #44948

Closed as duplicate

Description

@davidvacek1

Environment

Expected

After creating an API key, the full secret (sk- + 64 chars, per console key.ts: Key.create) should be shown once and/or copyable via the Copy button, so it can be used against /zen/v1 and /zen/go/v1.

Actual

  1. The dashboard (https://opencode.ai/workspace//keys) only ever displays/returns truncated keys:
    • key: "sk-hSm...oGil" (6-char prefix)
    • keyDisplay: "sk-hSmj...oGil" (7-char prefix)
  2. The Copy button copies the truncated value (verified via navigator.clipboard.readText(): "sk-hSm...oGil").
  3. Every truncated variant (6-char, 7-char, with dots, without) returns 401 JSON: {"type":"AuthError","message":"Invalid API key."} on /zen/v1/chat/completions, /zen/go/v1/chat/completions and /responses endpoints.
  4. Key.create server action returns only the keyID (e.g. key_01M...), never the plaintext secret. Key.list returns the key column but it is already truncated server-side in the observed production build.

Evidence

  • SSR serialized cache (observed in page source): key.list contains key:"sk-hSm...oGil" and keyDisplay:"sk-hSmj...oGil" - no full 67-char value anywhere on the wire.
  • curl Authorization: Bearer sk-hSm...oGil / sk-hSmj...oGil / sk-b6P8...ZRKK etc. => all Invalid API key.
  • Because the full secret is never exposed (not even momentarily in create response, which returns only the ID), it is impossible to authenticate. This blocks every API user including external tools (e.g. Hermes) pointed at https://opencode.ai/zen/go/v1.

Suggestion

Return the plaintext key at least once from Key.create (or show a one-time reveal modal client-side after creation) and have the Copy button write the full key. Truncated display is fine for listing, but the copy/API value must be the full secret.

Activity

  1. standby24x7 commented on Oct 3, 2026

    @standby24x7

    I created an account on 3rd Oct, 2026. Then I try to find API KEY on console, but I can't find the menu "API KEY".
    All I can see are "Overview, Logs, Audit, Go, Models, Providers, Members, keys Settings".
    I watched some youtube video about how to get API KEY. All video that I watched seemed to be an OLD UI, which has vertical menu "Zen, go, usage, API KEYS, Members, Billing and Settings". But current UI is holizontal menu.
    I hope you fix the issue asap.

  2. Tarquinen commented on Oct 20, 2026

    @Tarquinen
    Member

    Thanks for the report! Closing as a duplicate of #50885, which has the answer: #50885 (comment)

    In short: in OpenCode 2.0, run /connect, choose opencode, and pick the workspace that has Go when signing in. Then select a model marked as Go. To use an API key instead, create one under a service account in the console and add it with /connect → opencode go.

    If this still fails on 2.0, please open a new issue with your version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

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