You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
all models "Error: Upstream request failed: Invalid credential" #54833
Thanks for the report! The error comes from the OpenCode gateway rejecting the credential sent with your requests. Free models like opencode/mimo-v2.6-flash-free normally work without signing in, so this usually means OpenCode is sending a stored or configured key that the gateway no longer accepts. To narrow it down, could you tell us:
Is the OPENCODE_API_KEY environment variable set in your WSL shell? (Just yes or no, please don't paste the value.)
The output of opencode auth list, with any keys or emails redacted.
Does your opencode.json / opencode.jsonc (global or project) have a provider or providers entry for opencode or opencode-go, e.g. left over from v1? If so, please share it with the keys redacted.
Is it only opencode/* models that fail, or also models from other providers you've set up?
Did this work on an earlier version, and did anything change just before it started (an upgrade, signing in or out, a new API key)?
If you are signed in, does opencode auth logout followed by signing in again (or just using a free model while signed out) make any difference?
You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.
These issues look related. None of them is clearly the same problem, and they're ordered from most to least likely:
Thanks for the report! The error comes from the OpenCode gateway rejecting the credential sent with your requests. Free models like opencode/mimo-v2.6-flash-free normally work without signing in, so this usually means OpenCode is sending a stored or configured key that the gateway no longer accepts. To narrow it down, could you tell us:
Is the OPENCODE_API_KEY environment variable set in your WSL shell? (Just yes or no, please don't paste the value.)
The output of opencode auth list, with any keys or emails redacted.
Does your opencode.json / opencode.jsonc (global or project) have a provider or providers entry for opencode or opencode-go, e.g. left over from v1? If so, please share it with the keys redacted.
Is it only opencode/* models that fail, or also models from other providers you've set up?
Did this work on an earlier version, and did anything change just before it started (an upgrade, signing in or out, a new API key)?
If you are signed in, does opencode auth logout followed by signing in again (or just using a free model while signed out) make any difference?
You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.
These issues look related. None of them is clearly the same problem, and they're ordered from most to least likely:
Thanks for the details, I was able to reproduce this.
On a fresh 2.0.27 install with no auth, no config and no OPENCODE_API_KEY, opencode run --model opencode/mimo-v2.6-flash-free "say hi" fails with Upstream request failed: Invalid credential. The other free models I tried (big-pickle, nemotron-3.5-lightning-free) fail the same way, and so does 2.0.26.
It looks like this comes from a change on the service side, not from the update. The model catalog OpenCode downloads at startup now points the opencode provider at a new endpoint (https://opencode.ai/inference/v1). That endpoint rejects the anonymous key OpenCode uses when you're not signed in. The same request to the previous endpoint (https://opencode.ai/zen/v1) still works. That would explain why it worked an hour earlier.
Workaround: add this to ~/.config/opencode/opencode.json (or your project's opencode.json):
With that setting, the free models replied normally in my tests. You can remove it once this is fixed.
I couldn't check the latest dev (e41e7e9) directly, because the free tier doesn't accept builds run from source. There are no changes there to the relevant code since 2.0.27, which is still the latest release. The script below reproduces the problem and shows the workaround. I've passed this on to the maintainers.
Reproduction script (repro.sh)
#!/usr/bin/env bash# Reproduces #54833: free opencode/* models fail with# "Upstream request failed: Invalid credential" on a fresh, signed-out install.# The first run on a brand-new data dir may still work (bundled catalog snapshot, /zen/v1);# once the live models.dev catalog (api: /inference/v1) is loaded, runs fail.# Usage: ./repro.sh (uses `opencode` from PATH, e.g. @opencode/cli@2.0.27)# OC_DEV=/path/to/repo ./repro.sh (runs from a source checkout)set -u
T=$(mktemp -d)export HOME=$T/home XDG_CONFIG_HOME=$T/home/.config XDG_DATA_HOME=$T/home/.local/share \
XDG_STATE_HOME=$T/home/.local/state XDG_CACHE_HOME=$T/home/.cache
unset OPENCODE_API_KEY
mkdir -p "$HOME""$T/proj"&&cd"$T/proj"oc() {
if [ -n"${OC_DEV:-}" ];then
bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js""$OC_DEV/packages/cli/src/index.ts""$@"else opencode "$@";fi
}
echo"== models.dev catalog: opencode provider api"
curl -s https://models.dev/api.json | python3 -c 'import json,sys; print(json.load(sys.stdin)["opencode"]["api"])'echo"== 1. fresh install, no auth, no config (expected: a reply; actual: Invalid credential)"foriin 1 2 3;doecho"-- run $i"; oc run --standalone --model opencode/mimo-v2.6-flash-free "say hi"2>&1| tail -1; sleep 5;doneecho"== 2. same, but pinning the old base URL https://opencode.ai/zen/v1 (works)"echo'{"provider":{"opencode":{"options":{"baseURL":"https://opencode.ai/zen/v1"}}}}'> opencode.json
oc run --standalone --model opencode/mimo-v2.6-flash-free "say hi"2>&1| tail -2
Run it: bash repro.sh
Reacted by Chris Midgley, cado, solzer13, Dorian Niemiec, codemonstur, Nghia, onereal7, navycrow, Alexandros Georgiou, sonofluiz and 4 more
openCode OOSH anounced
opencode out of service hours. Past 17:00 is a general patch window with only minor interruptions. Major interruptions are announced separately.
7. Thanks for the details, I was able to reproduce this.
On a fresh 2.0.27 install with no auth, no config and no OPENCODE_API_KEY, opencode run --model opencode/mimo-v2.6-flash-free "say hi" fails with Upstream request failed: Invalid credential. The other free models I tried (big-pickle, nemotron-3.5-lightning-free) fail the same way, and so does 2.0.26.
It looks like this comes from a change on the service side, not from the update. The model catalog OpenCode downloads at startup now points the opencode provider at a new endpoint (https://opencode.ai/inference/v1). That endpoint rejects the anonymous key OpenCode uses when you're not signed in. The same request to the previous endpoint (https://opencode.ai/zen/v1) still works. That would explain why it worked an hour earlier. Workaround: add this to ~/.config/opencode/opencode.json (or your project's opencode.json):
{
"provider": {
"opencode": {
"options": { "baseURL": "https://opencode.ai/zen/v1" }
}
}
}
With that setting, the free models replied normally in my tests. You can remove it once this is fixed.
I couldn't check the latest `dev` ([e41e7e9](https://github.com/anomalyco/opencode/commit/e41e7e9064f1cb380f0905dd19c611756a577e79)) directly, because the free tier doesn't accept builds run from source. There are no changes there to the relevant code since 2.0.27, which is still the latest release. The script below reproduces the problem and shows the workaround. I've passed this on to the maintainers.
Reproduction script (repro.sh)
#!/usr/bin/env bash
# Reproduces #54833: free opencode/* models fail with
# "Upstream request failed: Invalid credential" on a fresh, signed-out install.
# The first run on a brand-new data dir may still work (bundled catalog snapshot, /zen/v1);
# once the live models.dev catalog (api: /inference/v1) is loaded, runs fail.
# Usage: ./repro.sh (uses `opencode` from PATH, e.g. @opencode/cli@2.0.27)
# OC_DEV=/path/to/repo ./repro.sh (runs from a source checkout)
set -u
T=$(mktemp -d)
export HOME=$T/home XDG_CONFIG_HOME=$T/home/.config XDG_DATA_HOME=$T/home/.local/share \
XDG_STATE_HOME=$T/home/.local/state XDG_CACHE_HOME=$T/home/.cache
unset OPENCODE_API_KEY
mkdir -p "$HOME" "$T/proj" && cd "$T/proj"
oc() {
if [ -n "${OC_DEV:-}" ]; then
bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js" "$OC_DEV/packages/cli/src/index.ts" "$@"
else opencode "$@"; fi
}
echo "== models.dev catalog: opencode provider api"
curl -s https://models.dev/api.json | python3 -c 'import json,sys; print(json.load(sys.stdin)["opencode"]["api"])'
echo "== 1. fresh install, no auth, no config (expected: a reply; actual: Invalid credential)"
for i in 1 2 3; do echo "-- run $i"; oc run --standalone --model opencode/mimo-v2.6-flash-free "say hi" 2>&1 | tail -1; sleep 5; done
echo "== 2. same, but pinning the old base URL https://opencode.ai/zen/v1 (works)"
echo '{"provider":{"opencode":{"options":{"baseURL":"https://opencode.ai/zen/v1"}}}}' > opencode.json
oc run --standalone --model opencode/mimo-v2.6-flash-free "say hi" 2>&1 | tail -2
Run it: `bash repro.sh`
fixes the issue for free models
Reacted by Ahmad-Qerem, Soham Kulkarni and Guilherme
The following free models all return Upstream request failed: Invalid credential:
muse-spark-1.3-contributor-free
nemotron-3.5-lightning-free
mimo-v2.6-flash-free
opencode auth list reports 0 credentials, and my OpenCode config contains only the default schema. These models previously worked for me without manual login or an API key.
Upgrading to 1.19.0 did not resolve the issue. The Windows system clock is correct.
Please let me know if further diagnostic information is needed.
Reconnected OpenCode Go and verified that opencode auth list shows both OpenCode Go and OpenCode Console as stored.
Confirmed there are no OPENCODE_API_KEY, OPENCODE_CONFIG, OPENCODE_CONFIG_DIR, or OPENCODE_DB environment variables set.
Checked global configuration; there was no legacy opencode-go provider override.
Added the suggested https://opencode.ai/zen/v1 base URL override for the built-in opencode provider, but the error persisted.
Performed a clean reinstall. Free models worked briefly, but subsequently began returning the same error again.
The error occurs across both the built-in free models and OpenCode Go models. Could you investigate whether this is related to the shared authentication/gateway issue or stale credential handling after reconnecting?
I have not included any API keys or other secrets.
@Netherquark also just got "OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building." message.
I confirm that it came back to work after removing from .config\opencode\opencode.json the entry
I have just set up opencode server as a docker container on my sandbox host, and am connecting to it's web UI from a client laptop, and I added my API key upon first use of the web UI. I added credit to my default workspace in my zen account with the intention of using paid-for models. Am I to understand that this bug affects all models and there is only currently this fix for the free models? In which case all other paid-for models are currently non functional?
This happens when your stored OpenCode API key has expired. Several older keys stopped working after the console migration. To fix it, sign in again (opencode auth login, or reconnect OpenCode / OpenCode Go in the desktop app), or create a new key in the console and replace the old one. We're tracking the confusing error message in #56586, so closing this as a duplicate. If you still see the error after signing in again, comment here with the time and your request ID and we'll reopen.
Activity
opencode-agent commentedon Oct 12, 2026
Thanks for the report! The error comes from the OpenCode gateway rejecting the credential sent with your requests. Free models like
opencode/mimo-v2.6-flash-freenormally work without signing in, so this usually means OpenCode is sending a stored or configured key that the gateway no longer accepts. To narrow it down, could you tell us:OPENCODE_API_KEYenvironment variable set in your WSL shell? (Just yes or no, please don't paste the value.)opencode auth list, with any keys or emails redacted.opencode.json/opencode.jsonc(global or project) have aproviderorprovidersentry foropencodeoropencode-go, e.g. left over from v1? If so, please share it with the keys redacted.opencode/*models that fail, or also models from other providers you've set up?opencode auth logoutfollowed by signing in again (or just using a free model while signed out) make any difference?You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.
These issues look related. None of them is clearly the same problem, and they're ordered from most to least likely:
auth login/logout, so the upstream rejects requests as invalidprovider.opencode-goblock replaced the built-in provider and causedInvalid credential/Missing API keyUpstream request failed: Invalid credentialon fresh runs (v1.18)StunAndBlock commentedon Oct 12, 2026
opencode-agent commentedon Oct 12, 2026
Thanks for the details, I was able to reproduce this.
On a fresh 2.0.27 install with no auth, no config and no
OPENCODE_API_KEY,opencode run --model opencode/mimo-v2.6-flash-free "say hi"fails withUpstream request failed: Invalid credential. The other free models I tried (big-pickle,nemotron-3.5-lightning-free) fail the same way, and so does 2.0.26.It looks like this comes from a change on the service side, not from the update. The model catalog OpenCode downloads at startup now points the
opencodeprovider at a new endpoint (https://opencode.ai/inference/v1). That endpoint rejects the anonymous key OpenCode uses when you're not signed in. The same request to the previous endpoint (https://opencode.ai/zen/v1) still works. That would explain why it worked an hour earlier.Workaround: add this to
~/.config/opencode/opencode.json(or your project'sopencode.json):{ "provider": { "opencode": { "options": { "baseURL": "https://opencode.ai/zen/v1" } } } }With that setting, the free models replied normally in my tests. You can remove it once this is fixed.
I couldn't check the latest
dev(e41e7e9) directly, because the free tier doesn't accept builds run from source. There are no changes there to the relevant code since 2.0.27, which is still the latest release. The script below reproduces the problem and shows the workaround. I've passed this on to the maintainers.Reproduction script (repro.sh)
Run it:
bash repro.shStunAndBlock commentedon Oct 12, 2026
https://status.opencode.de/
probably this is the reason
StunAndBlock commentedon Oct 12, 2026
fixes the issue for free models
IntellsGamer commentedon Oct 12, 2026
Opencode is goated
Never thought of it being able to solve and reproduce ISSUES AND FIX THEM ITSELF AUTONOMOUSLY
It fixed thproblem
Tysm
Introvert-Byte commentedon Oct 12, 2026
i have the same problem.
i was working at project on the last update it was working well , how to return to past update? , opencode fix this pls
Netherquark commentedon Oct 12, 2026
Worked for me:
RuiSilvaEnlitia commentedon Oct 12, 2026
Confirm that @Netherquark workaround solved it for me.
Introvert-Byte commentedon Oct 12, 2026
i dont have the file i only have service.json
shamnag commentedon Oct 12, 2026
Adding opencode.json worked for me
danihab1b commentedon Oct 12, 2026
Confirm that @Netherquark workaround solved it for me too.
Introvert-Byte commentedon Oct 12, 2026
thanks it worked
OpenCode: a free model's refusal is OpenCode's side, never a sign-in
0.757.0: a free model OpenCode turns away says so; a finished teammat…
vspcoderz commentedon Oct 12, 2026
~/.config/opencode/opencode.json one worked
davidwillemann commentedon Oct 12, 2026
I can confirm the same issue on Windows.
opencodeThe following free models all return
Upstream request failed: Invalid credential:muse-spark-1.3-contributor-freenemotron-3.5-lightning-freemimo-v2.6-flash-freeopencode auth listreports 0 credentials, and my OpenCode config contains only the default schema. These models previously worked for me without manual login or an API key.Upgrading to 1.19.0 did not resolve the issue. The Windows system clock is correct.
Please let me know if further diagnostic information is needed.
Amazing-Stardom commentedon Oct 12, 2026
~/.config/opencode/opencode.json
worked
Opencode ++
dkirienko commentedon Oct 12, 2026
You can create this file using text editor!
Luckz commentedon Oct 13, 2026
I had to do a
opencode console loginvedbhoskar commentedon Oct 13, 2026
Additional report: macOS, OpenCode v2.0.28 — workaround did not resolve the issue
I'm experiencing the same
Upstream request failed: Invalid credentialerror on macOS.Environment
opencode-go/gpt-6-luna,opencode/free models, including Step 5 Preview FreeTroubleshooting performed
opencode auth listshows both OpenCode Go and OpenCode Console as stored.OPENCODE_API_KEY,OPENCODE_CONFIG,OPENCODE_CONFIG_DIR, orOPENCODE_DBenvironment variables set.opencode-goprovider override.https://opencode.ai/zen/v1base URL override for the built-inopencodeprovider, but the error persisted.The error occurs across both the built-in free models and OpenCode Go models. Could you investigate whether this is related to the shared authentication/gateway issue or stale credential handling after reconnecting?
I have not included any API keys or other secrets.
Netherquark commentedon Oct 14, 2026
They've updated their server side code, this fix is redundant now, comment out / delete the JSON otherwise your free tier wont work
danihab1b commentedon Oct 14, 2026
@Netherquark also just got "OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building." message.
I confirm that it came back to work after removing from .config\opencode\opencode.json the entry
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"opencode": {
"options": { "baseURL": "https://opencode.ai/zen/v1" }
}
}
}
Thank you for updating the thread!
m477r1x commentedon Oct 19, 2026
I have just set up opencode server as a docker container on my sandbox host, and am connecting to it's web UI from a client laptop, and I added my API key upon first use of the web UI. I added credit to my default workspace in my zen account with the intention of using paid-for models. Am I to understand that this bug affects all models and there is only currently this fix for the free models? In which case all other paid-for models are currently non functional?
neriousy commentedon Oct 21, 2026
This happens when your stored OpenCode API key has expired. Several older keys stopped working after the console migration. To fix it, sign in again (
opencode auth login, or reconnect OpenCode / OpenCode Go in the desktop app), or create a new key in the console and replace the old one. We're tracking the confusing error message in #56586, so closing this as a duplicate. If you still see the error after signing in again, comment here with the time and your request ID and we'll reopen.