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
I was eye ball deep in working a feature, stopped to run an errand and returned to this error.
litellm.AuthenticationError: AnthropicException - b'{"type":"error","error":{"type":"authentication_error","code":"api_key_expired","message":"This API key has expired. Create a new API key in OpenCode Console and replace it in your client or secret store. Signing in again will not renew this key."}}'. Received Model Group=qwen3.5-plus
Available Model Group Fallbacks=None
I have not needed a key before when using remote models on opencode via ZEN. However I followed the instructions and I created an api key. But there is no documentation on how to use the api key with opencode as a vs code plugin or via the cli. Only documentation about setting as auth bearer token in a curl command??
Opencode version 1.19.3 in VS code on Pop_os.
Plugins
No response
OpenCode version
1.19.3
Steps to reproduce
Go pick up your kid from a playdate and then come back to opencode and try to finish your work.
Thanks for the report, and sorry you came back to a dead session in the middle of your work.
The error is coming from the OpenCode Console/Zen side: your API key there was marked as expired, and the message says signing in again won't renew it. To get going again:
Create a new API key in the OpenCode Console.
Run opencode auth login, choose OpenCode Zen and paste the new key. The VS Code extension uses the same stored credentials as the CLI, so it should pick up the new key, possibly after you reload VS Code.
Account and key support (for example, why the key expired) isn't handled in GitHub issues. Please email help@anoma.ly with the details: roughly when it stopped working and the exact error. If you've already emailed, the team will get to it, especially now that we've seen it here. Please keep your API keys, email address and account details out of this public issue and put them only in the email.
Nope. does not work, tried it twice still gettting ->litellm.AuthenticationError: AnthropicException - b'{"type":"error","error":{"type":"authentication_error","code":"api_key_expired","message":"This API key has expired. Create a new API key in OpenCode Console and replace it in your client or secret store. Signing in again will not renew this key."}}'. Received Model Group=qwen3.5-plus
Available Model Group Fallbacks=None
Sorry that didn't fix it. If a brand-new key still gets api_key_expired, either the old key is still being sent from somewhere, or the problem is on the Console side. A few things to check:
Run opencode auth logout, choose OpenCode Zen, then opencode auth login again with the new key. Run opencode auth list afterwards to check what's stored.
Make sure the old key isn't also set somewhere else that takes priority, for example an OPENCODE_API_KEY environment variable (in your shell profile or a .env file), or an apiKey under provider.opencode.options in your opencode.json (global ~/.config/opencode/opencode.json or the project one).
Fully restart VS Code, or at least its integrated terminal, so no running opencode process keeps the old credentials.
If it still fails after that, the new key itself is being rejected, and only the team can look into that from your account. #56556 reports the same thing: a newly created key still got this error. Please email help@anoma.ly, say that a newly created key also returns api_key_expired, and roughly when you created it. Keep the keys and your account details out of this issue.
@VacantFuture, I'm closing this issue now because account and API key problems are handled by email, not on GitHub. If a new key still returns api_key_expired, please email help@anoma.ly. Say that a newly created key gets the same error and roughly when you created it, and the team can look into it from your account. Please keep keys and account details out of this public issue. Sorry about the interruption to your work.
Hey everyone! I managed to solve it.
Go to https://opencode.ai/console/account
Under "PERSONAL API KEY," click on "+ add api key."
A new window will open; the only mandatory field is "KEY NAME."
Enter a name of your choice, then click "CREATE."
A new API key will be generated—copy it, go to your OpenCode instance, run the /connect command, and press Enter.
When prompted, paste the new API key, hit Enter, and you're all set!
Brazilian greetings to you all!
ver. em português:
ola! caras, consegui resolver.
acessem https://opencode.ai/console/account
em PERSONAL API KEY cliquem em : + add api key
vai abrir uma nova janela e o unico campo obrigatorio é : KEY NAME
coloquem o nome que acharem adequado e depois apertei em CREATE
Vai ser gerado uma nova api key copiem e vai no seu opencode e execute o comando /connect apertem enter
e quando solicitado colem a nova api key gerada. teclem Enter e sejam felizes.
Activity
opencode-agent commentedon Oct 17, 2026
Thanks for the report, and sorry you came back to a dead session in the middle of your work.
The error is coming from the OpenCode Console/Zen side: your API key there was marked as expired, and the message says signing in again won't renew it. To get going again:
opencode auth login, choose OpenCode Zen and paste the new key. The VS Code extension uses the same stored credentials as the CLI, so it should pick up the new key, possibly after you reload VS Code.Account and key support (for example, why the key expired) isn't handled in GitHub issues. Please email help@anoma.ly with the details: roughly when it stopped working and the exact error. If you've already emailed, the team will get to it, especially now that we've seen it here. Please keep your API keys, email address and account details out of this public issue and put them only in the email.
Closely related issues:
The bot will close this issue in 1 day.
VacantFuture commentedon Oct 17, 2026
Nope. does not work, tried it twice still gettting ->litellm.AuthenticationError: AnthropicException - b'{"type":"error","error":{"type":"authentication_error","code":"api_key_expired","message":"This API key has expired. Create a new API key in OpenCode Console and replace it in your client or secret store. Signing in again will not renew this key."}}'. Received Model Group=qwen3.5-plus
Available Model Group Fallbacks=None
opencode-agent commentedon Oct 17, 2026
Sorry that didn't fix it. If a brand-new key still gets
api_key_expired, either the old key is still being sent from somewhere, or the problem is on the Console side. A few things to check:opencode auth logout, choose OpenCode Zen, thenopencode auth loginagain with the new key. Runopencode auth listafterwards to check what's stored.OPENCODE_API_KEYenvironment variable (in your shell profile or a.envfile), or anapiKeyunderprovider.opencode.optionsin youropencode.json(global~/.config/opencode/opencode.jsonor the project one).If it still fails after that, the new key itself is being rejected, and only the team can look into that from your account. #56556 reports the same thing: a newly created key still got this error. Please email help@anoma.ly, say that a newly created key also returns
api_key_expired, and roughly when you created it. Keep the keys and your account details out of this issue.omani commentedon Oct 17, 2026
opencode was hacked. they probably revoked all API keys just for safe measure. and @opencode-agent does not know anything about it. they even made it to the HN frontpage, congrats: https://news.ycombinator.com/item?id=50133401
opencode-agent commentedon Oct 18, 2026
@VacantFuture, I'm closing this issue now because account and API key problems are handled by email, not on GitHub. If a new key still returns
api_key_expired, please email help@anoma.ly. Say that a newly created key gets the same error and roughly when you created it, and the team can look into it from your account. Please keep keys and account details out of this public issue. Sorry about the interruption to your work.sousarobinho-art commentedon Oct 20, 2026
Hey everyone! I managed to solve it.
Go to https://opencode.ai/console/account
Under "PERSONAL API KEY," click on "+ add api key."
A new window will open; the only mandatory field is "KEY NAME."
Enter a name of your choice, then click "CREATE."
A new API key will be generated—copy it, go to your OpenCode instance, run the
/connectcommand, and press Enter.When prompted, paste the new API key, hit Enter, and you're all set!
Brazilian greetings to you all!
ver. em português:
ola! caras, consegui resolver.
acessem https://opencode.ai/console/account
em PERSONAL API KEY cliquem em : + add api key
vai abrir uma nova janela e o unico campo obrigatorio é : KEY NAME
coloquem o nome que acharem adequado e depois apertei em CREATE
Vai ser gerado uma nova api key copiem e vai no seu opencode e execute o comando /connect apertem enter
e quando solicitado colem a nova api key gerada. teclem Enter e sejam felizes.