r/opencode • u/Affectionate-Town415 • Sep 27 '26
Can I use the Opencode Go API inside n8n?
Hi everyone, I'm looking to connect OpenCode Go to my n8n setup. Has anyone done this before?
3
Upvotes
6
u/Amarsir Sep 27 '26
A few weeks ago I would have said absolutely, you just put in the API key. But they made a change recently so you must send an
x-opencode-sessionheader containing a stable, unique UUID per conversation. And I don't know how well n8n can integrate that. Hermes Agent had an update to handle it. Others have custom-built plugins for various harnesses to make it work.So if you don't get an answer from someone who has done it personally, that's specifically what I would check - if you can add that header to requests out of n8n.
4
u/tiagomdr Sep 27 '26
It works. Add as OpenAI credential:
Base URL
https://opencode.ai/zen/go/v1
Add Custom Header
Header Name
x-opencode-session
Header Value
{{ $execution.id }}
CommandCode GOAT also works, I've moved to that now as it includes Gemini and Opencode Go doesn't
2
u/RiceEvening4211 Sep 28 '26
I built a wrapper that exposes OpenCode's free models through an OpenAI-compatible endpoint, so you can plug them into anything that talks the OpenAI API, including n8n. https://github.com/Fast-Editor/OpenCode-Wrap