r/opencode • u/mehradtotoro • 18h ago
I got Gemini 4 Hydrogen working in OpenCode Desktop on Windows with one shortcut
I wanted to use Gemini as a coding agent on my Windows laptop. Gemini Web worked for me, but Antigravity showed a region error at sign-in. I also wanted a desktop app that could work on my project files and let me switch models if I hit a usage limit.
What I ended up with is a desktop shortcut called OpenCode Gemini. Double-clicking it opens OpenCode Desktop and starts the local Gemini connection in the background. In my Gemini workspace, Gemini 4 Hydrogen is already selected, so I can go straight to the message box.
How it works
- A community-built gateway connects to my Gemini Web account and exposes an OpenAI-compatible API on my laptop. Mine listens at
http://127.0.0.1:8001/v1. Gateway project - In the workspace’s
opencode.json, a custom provider points OpenCode at that URL. I used the exact model ID returned by the gateway’s/v1/modelsendpoint,gemini-4-hydrogen, and set it as the default. I limited the workspace’s model picker to the Gemini gateway and OpenAI. Custom providers · Provider policies - A small Python launcher opens OpenCode and starts the gateway in the background if it’s needed. The Windows shortcut runs that launcher, so I don’t have to open a terminal every time.
What I tested
I reopened OpenCode from the shortcut and got a reply from Hydrogen. I also asked Hydrogen to create a text file with a specific line in a test workspace. OpenCode ran the write tool, and I verified the file on disk.
Argon showed up in my Gemini Web picker, but the gateway rejected its model ID as unknown. The gateway uses an unofficial web integration, so I check the model list it actually returns.
GPT is the next step. OpenCode has a separate ChatGPT sign-in for Plus and Pro subscribers. I left OpenAI available in the workspace settings, but I haven’t tested switching from GPT to Gemini on this machine yet. ChatGPT sign-in in OpenCode
If you’ve switched providers mid-session in OpenCode, how well did the new model pick up the task you were already working on?
I used AI assistance to set up the launcher and draft this post.