google provider not working as expected #250

Closed
opened 2026-02-16 17:25:56 -05:00 by yindo · 11 comments
Owner

Originally created by @homanp on GitHub (Jun 24, 2025).

Originally assigned to: @thdxr on GitHub.

Command:

opencode run --model google/gemini-2.5-pro --print-logs "Read the README file"

Error:


Update: INFO  2025-06-24T07:45:33 +1ms service=app name=provider registering service

Update: INFO  2025-06-24T07:45:33 +2ms service=models.dev refreshing

Update: INFO  2025-06-24T07:45:33 +4ms service=provider init

Update: INFO  2025-06-24T07:45:33 +3ms service=provider providerID=openai found

Update: INFO  2025-06-24T07:45:33 +0ms service=provider providerID=google modelID=gemini-2.5-pro getModel

Update: ERROR 2025-06-24T07:45:33 +6ms service=default providerID=google modelID=gemini-2.5-pro name=ProviderModelNotFoundError message=ProviderModelNotFoundError fatal

I'm running the latest version according to docs.

Originally created by @homanp on GitHub (Jun 24, 2025). Originally assigned to: @thdxr on GitHub. Command: ``` opencode run --model google/gemini-2.5-pro --print-logs "Read the README file" ``` Error: ``` Update: INFO 2025-06-24T07:45:33 +1ms service=app name=provider registering service Update: INFO 2025-06-24T07:45:33 +2ms service=models.dev refreshing Update: INFO 2025-06-24T07:45:33 +4ms service=provider init Update: INFO 2025-06-24T07:45:33 +3ms service=provider providerID=openai found Update: INFO 2025-06-24T07:45:33 +0ms service=provider providerID=google modelID=gemini-2.5-pro getModel Update: ERROR 2025-06-24T07:45:33 +6ms service=default providerID=google modelID=gemini-2.5-pro name=ProviderModelNotFoundError message=ProviderModelNotFoundError fatal ``` I'm running the latest version according to docs.
yindo closed this issue 2026-02-16 17:25:56 -05:00
Author
Owner

@thdxr commented on GitHub (Jun 24, 2025):

that exact line worked for me - can you try clearing ~/.cache/opencode

@thdxr commented on GitHub (Jun 24, 2025): that exact line worked for me - can you try clearing `~/.cache/opencode`
Author
Owner

@homanp commented on GitHub (Jun 24, 2025):

that exact line worked for me - can you try clearing ~/.cache/opencode

will check

@homanp commented on GitHub (Jun 24, 2025): > that exact line worked for me - can you try clearing `~/.cache/opencode` will check
Author
Owner

@homanp commented on GitHub (Jun 24, 2025):

Image

@thdxr still getting the same even after removing cache. Do I need to any other config before running command? OpenAI and Anthropic models work, but not Google.

@homanp commented on GitHub (Jun 24, 2025): <img width="984" alt="Image" src="https://github.com/user-attachments/assets/1fd10110-18d2-4c51-804b-f56858a78824" /> @thdxr still getting the same even after removing cache. Do I need to any other config before running command? OpenAI and Anthropic models work, but not Google.
Author
Owner

@rajivraghu commented on GitHub (Jun 24, 2025):

@homanp @thdxr looks like the auth is not set properly..
opencode run --model anthropic/claude-sonnet-4-20250514 --print-logs "create test.txt file with some summy text"
This failed .. providerModelNotFound

When i explicitly set the key , it worked

{
  "provider-id": {
    "type": "api",
    "key": "YOUR_API_KEY"
  }
}

cat ~/.local/share/opencode/auth.json

{
  "anthropic": {
    "type": "api",
    "key": "***"
  }
}

anthropic works!!
google is failing 👎

@rajivraghu commented on GitHub (Jun 24, 2025): @homanp @thdxr looks like the auth is not set properly.. opencode run --model anthropic/claude-sonnet-4-20250514 --print-logs "create test.txt file with some summy text" This failed .. providerModelNotFound When i explicitly set the key , it worked ``` { "provider-id": { "type": "api", "key": "YOUR_API_KEY" } } ``` ``` cat ~/.local/share/opencode/auth.json { "anthropic": { "type": "api", "key": "***" } } ``` anthropic works!! google is failing 👎
Author
Owner

@rajivraghu commented on GitHub (Jun 24, 2025):

@thdxr if i manually set opencode auth login via cli by selecting stuff it works..

@rajivraghu commented on GitHub (Jun 24, 2025): @thdxr if i manually set opencode auth login via cli by selecting stuff it works..
Author
Owner

@daemonfire300 commented on GitHub (Jul 10, 2025):

I have this issue with OpenRouter (any model so far), double checked the auth.json, the api key is correct, I even tried copy & pasting the openrouter example from the docs and tried exactly that model: Same error.

Was still on 0.2.13
Upgraded to 0.2.20

Testing again. Will report back.

@daemonfire300 commented on GitHub (Jul 10, 2025): I have this issue with OpenRouter (any model so far), double checked the auth.json, the api key is correct, I even tried copy & pasting the openrouter example from the docs and tried exactly that model: Same error. Was still on 0.2.13 Upgraded to 0.2.20 Testing again. Will report back.
Author
Owner

@daemonfire300 commented on GitHub (Jul 10, 2025):

Same issue.

Normal Anthropic works, except that every request is an Overload but that's on anthropics side.

Still, cannot get OpenRouter to work.

I think this seems to get my one step further and then I end up with:

opencode run -m 'openrouter/mistralai/devstral-small' --print-logs 'Say test'
ERROR 2025-07-10T14:11:29 +1ms service=default providerID=openrouter name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/Users/REDACTED/.cache/opencode/node_modules/@openrouter/ai-sdk-provider' from '/$bunfs/root/opencode'

Then running rm -rf ~/.cache/opencode again

Then running opencode run -m 'openrouter/mistralai/devstral-small' --print-logs 'Say test' again now gives me:

INFO  2025-07-10T14:13:40 +0ms service=provider status=started providerID=openrouter getSDK
INFO  2025-07-10T14:13:40 +0ms service=bun cmd=/opt/homebrew/Cellar/opencode/0.2.20/bin/opencode,install,--cwd,/Users/julius/.cache/opencode,--registry=https://registry.npmjs.org cwd=/Users/REDACTED/.cache/opencode running
INFO  2025-07-10T14:13:41 +34ms service=lsp initialized
INFO  2025-07-10T14:13:41 +83ms service=bun code=1 stdout=bun install v1.2.17 (282dda62)
 stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
error: Package "@openrouter/ai-sdk-provider" with tag "beta" not found, but package exists
error: @openrouter/ai-sdk-provider@beta failed to resolve
 done
INFO  2025-07-10T14:13:41 +0ms service=provider status=completed duration=117 providerID=openrouter getSDK
INFO  2025-07-10T14:13:41 +1ms service=app name=lsp shutdown
INFO  2025-07-10T14:13:41 +0ms service=app name=session shutdown
ERROR 2025-07-10T14:13:41 +2ms service=default providerID=openrouter name=ProviderInitError message=ProviderInitError cause=BunInstallFailedError: BunInstallFailedError fatal
@daemonfire300 commented on GitHub (Jul 10, 2025): Same issue. Normal Anthropic works, except that every request is an `Overload` but that's on anthropics side. Still, cannot get OpenRouter to work. I think this seems to get my one step further and then I end up with: ``` opencode run -m 'openrouter/mistralai/devstral-small' --print-logs 'Say test' ERROR 2025-07-10T14:11:29 +1ms service=default providerID=openrouter name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/Users/REDACTED/.cache/opencode/node_modules/@openrouter/ai-sdk-provider' from '/$bunfs/root/opencode' ``` Then running `rm -rf ~/.cache/opencode` again Then running `opencode run -m 'openrouter/mistralai/devstral-small' --print-logs 'Say test'` again now gives me: ``` INFO 2025-07-10T14:13:40 +0ms service=provider status=started providerID=openrouter getSDK INFO 2025-07-10T14:13:40 +0ms service=bun cmd=/opt/homebrew/Cellar/opencode/0.2.20/bin/opencode,install,--cwd,/Users/julius/.cache/opencode,--registry=https://registry.npmjs.org cwd=/Users/REDACTED/.cache/opencode running INFO 2025-07-10T14:13:41 +34ms service=lsp initialized INFO 2025-07-10T14:13:41 +83ms service=bun code=1 stdout=bun install v1.2.17 (282dda62) stderr=Resolving dependencies Resolved, downloaded and extracted [1] error: Package "@openrouter/ai-sdk-provider" with tag "beta" not found, but package exists error: @openrouter/ai-sdk-provider@beta failed to resolve done INFO 2025-07-10T14:13:41 +0ms service=provider status=completed duration=117 providerID=openrouter getSDK INFO 2025-07-10T14:13:41 +1ms service=app name=lsp shutdown INFO 2025-07-10T14:13:41 +0ms service=app name=session shutdown ERROR 2025-07-10T14:13:41 +2ms service=default providerID=openrouter name=ProviderInitError message=ProviderInitError cause=BunInstallFailedError: BunInstallFailedError fatal ```
Author
Owner

@daemonfire300 commented on GitHub (Jul 10, 2025):

Fix is described here: https://github.com/sst/opencode/issues/758#issuecomment-3057673624

@daemonfire300 commented on GitHub (Jul 10, 2025): Fix is described here: https://github.com/sst/opencode/issues/758#issuecomment-3057673624
Author
Owner

@homanp commented on GitHub (Jul 10, 2025):

Fix is described here: https://github.com/sst/opencode/issues/758#issuecomment-3057673624

What was the fix?

@homanp commented on GitHub (Jul 10, 2025): > Fix is described here: https://github.com/sst/opencode/issues/758#issuecomment-3057673624 > What was the fix?
Author
Owner

@daemonfire300 commented on GitHub (Jul 11, 2025):

Fix is described here: #758 (comment)

What was the fix?

It’s written there. Remove the npm entry from the documentation sample there, clear the cache, run open code again. This should re install the cache with the correct packages.

@daemonfire300 commented on GitHub (Jul 11, 2025): > > Fix is described here: [#758 (comment)](https://github.com/sst/opencode/issues/758#issuecomment-3057673624) > > What was the fix? It’s written there. Remove the npm entry from the documentation sample there, clear the cache, run open code again. This should re install the cache with the correct packages.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#250