Can't connect to Gemini API using opencode.json #836

Closed
opened 2026-02-16 17:28:30 -05:00 by yindo · 1 comment
Owner

Originally created by @vladbesson on GitHub (Jul 21, 2025).

Originally assigned to: @thdxr on GitHub.

I want to use Gemini 2.5 pro with opencode so I created ~/.config/opencode/opencode.json file with that:

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "gemini": {
      "api_key": MY_GEMINI_API_KEY
    }
  }
}

However when I run opencode, I get this error:

Error: Config file at /Users/vlad/.config/opencode/opencode.json is invalid
↳ Unrecognized key(s) in object: 'providers'

What I am doing wrong?

Originally created by @vladbesson on GitHub (Jul 21, 2025). Originally assigned to: @thdxr on GitHub. I want to use Gemini 2.5 pro with opencode so I created `~/.config/opencode/opencode.json` file with that: ``` { "$schema": "https://opencode.ai/config.json", "providers": { "gemini": { "api_key": MY_GEMINI_API_KEY } } } ``` However when I run opencode, I get this error: ``` Error: Config file at /Users/vlad/.config/opencode/opencode.json is invalid ↳ Unrecognized key(s) in object: 'providers' ``` What I am doing wrong?
yindo closed this issue 2026-02-16 17:28:30 -05:00
Author
Owner

@adamdotdevin commented on GitHub (Jul 21, 2025):

you don't need to create a config file to use gemini, just do opencode auth login and choose google, add your api key

@adamdotdevin commented on GitHub (Jul 21, 2025): you don't need to create a config file to use gemini, just do `opencode auth login` and choose google, add your api key
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#836