Skip to content

google provider not working as expected #352

Closed

Description

@homanp

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.

Activity

  1. self-assigned this
    on Jun 24, 2025
  2. thdxr commented on Jun 24, 2025

    @thdxr
    Member

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

  3. homanp commented on Jun 24, 2025

    @homanp
    Author

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

    will check

  4. homanp commented on Jun 24, 2025

    @homanp
    Author
    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.

  5. rajivraghu commented on Jun 25, 2025

    @rajivraghu

    @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 👎

  6. rajivraghu commented on Jun 25, 2025

    @rajivraghu

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

  7. daemonfire300 commented on Jul 10, 2025

    @daemonfire300

    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.

  8. daemonfire300 commented on Jul 10, 2025

    @daemonfire300

    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
    
  9. daemonfire300 commented on Jul 10, 2025

    @daemonfire300

    Fix is described here: #758 (comment)

  10. homanp commented on Jul 10, 2025

    @homanp
    Author

    Fix is described here: #758 (comment)

    What was the fix?

  11. daemonfire300 commented on Jul 11, 2025

    @daemonfire300

    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.

  12. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

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

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