GuidesHosting choices

OpenCode "Upstream request failed: Invalid credential": the fix

OpenCode's own gateway refusing a stored Console (Zen) or Go key, often one retired in the console migration. How to replace it, on a server too.

November 17, 2026The Everpod team
The short answer

“Upstream request failed: Invalid credential” is OpenCode’s own service refusing the OpenCode key or sign-in that OpenCode has stored, the one for OpenCode Console (Zen) or OpenCode Go, not a key for Anthropic, OpenAI or another provider. A maintainer’s explanation on the tracker: “This happens when your stored OpenCode API key has expired. Several older keys stopped working after the console migration.” The fix is to replace what is stored: run opencode auth login (or /connect) and sign in to OpenCode again, or create a new API key in the OpenCode Console and connect that one. The key is the problem, not the install, so reinstalling or switching models does not help.

Which credential it means

OpenCode sends requests for its own models, the opencode/… and opencode-go/… ones, through OpenCode’s gateway, and “upstream” is that gateway. When it does not accept the key, OpenCode prints the gateway’s answer:

Error: Upstream request failed: Invalid credential
Copied

On a report where a key failed the same way inside Docker and outside it, the maintainer put it plainly: “Invalid credential means the gateway doesn’t recognize the key itself, so it isn’t the container.” The causes named there were a revoked key, a key copied incompletely, and a deleted workspace or service account, and the issue was closed as “key-specific rather than an OpenCode bug”. A key from Anthropic or OpenRouter that has gone bad produces that provider’s own error, not this one.

As of November 17, 2026, a search of OpenCode’s issue tracker for “Invalid credential” returned 47 issues and pull requests, from October 12 to November 16, several of them from people who had just paid for Go or topped up the Console and found nothing worked.

Replace the stored key

Start by seeing what OpenCode holds:

opencode auth list
Copied

Then sign in again, and from the list choose OpenCode (the Console, Zen) or OpenCode Go, pasting a key from the Console for Go:

opencode auth login
Copied

In the TUI, /connect does the same: OpenCode’s Go docs say “Run /connect in the TUI, select OpenCode Go, and paste your API key.” Choosing a provider you have already connected opens its list of saved accounts, where the old one can be deleted, and per the providers docs “The newest account becomes active” either way. To remove the old entry from the command line, opencode auth logout opens a picker.

Where signing in is not enough, make a new key. The maintainer’s steps: in the Console, Account, then Personal API keys, create a key in the workspace that holds your credit or your Go subscription, and copy it at once, because “it’s only shown once.” Connect it as above. If a new key from that workspace still fails, OpenCode’s maintainers ask for an email to help@anoma.ly with your account email and workspace name.

On a server

The week it hit everyone

From October 12 to 14, 2026, the message also reached people with no key at all, on the free models. OpenCode’s triage bot, on the main issue, said OpenCode’s model list had moved its provider to a new endpoint that rejected signed-out requests, and some users pointed the opencode provider back at https://opencode.ai/zen/v1 in opencode.json to get going. Users then reported the service side fixed and the override itself breaking the free models. If your config still has that baseURL line, remove it; the free-tier refusal’s guide covers the message it now tends to cause.

Messages that sit next to it

Run OpenCode on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.