N·04Integration guides
OpenCode
An open-source AI coding agent with a desktop app and a command line, both reading the same opencode.json; connect XylemNode in the OpenAI-compatible format.
OpenCode has an official desktop app (OpenCode Desktop). The installer brings everything it needs, so there's no command-line tool to install separately. Connecting XylemNode takes one opencode.json in your user directory: the desktop app and the command line read the same file, so one setup covers both.
- 01
Install the desktop app
Open the download page and pick your system under OpenCode Desktop: on Windows that's usually x64, or ARM64 for laptops with an ARM processor; on a Mac, Apple silicon or Intel; on Linux, .deb or .rpm. Open it once after installing and close it again, which creates the config folder in your user directory.
- 02
Open the config folder
On Windows, press Win + R, type the path below and press Enter. On a Mac, press Shift + Command + G in Finder (Go to Folder) and enter the path. The config file goes in this folder, named opencode.json: create a new file in Notepad (TextEdit on a Mac), write it as in the next step, and save it here.
- Windows
%USERPROFILE%\.config\opencode- macOS / Linux
~/.config/opencode
- 03
Write the config
Paste the whole block below into opencode.json, replace sk-your-key with your own key, and save. In Windows Notepad, choose "All files" as the file type (or you'll end up with opencode.json.txt) and UTF-8 as the encoding when saving; in TextEdit on a Mac, first choose Format → Make Plain Text, and after saving check in Finder that the name didn't gain a .txt at the end. baseURL follows the OpenAI-compatible format and includes /v1; the top-level model is what new sessions start with.
json { "$schema": "https://opencode.ai/config.json", "model": "xylemnode/gpt-6.1-sol", "provider": { "xylemnode": { "npm": "@ai-sdk/openai-compatible", "name": "XylemNode", "options": { "baseURL": "https://api.xylemnode.com/v1", "apiKey": "sk-your-key" }, "models": { "gpt-6.1-sol": { "name": "GPT-6.1 Sol" } } } } } - 04
Pick the model and test
Reopen OpenCode, add a project (any folder will do) and start a new session. In the model button above the input, check that GPT-6.1 Sol under XylemNode is selected: until a provider is set up, it suggests OpenCode's own free models, so don't pick one of those by mistake. Send "Reply with OK only"; a reply means you're connected.
- 01
Install and verify
Install with the official script or globally via npm, then print the version to confirm. These two commands install the still-maintained 1.x line; the download page and the desktop app ship OpenCode 2, and the config below works with both. On Windows, OpenCode runs best under WSL, where its config follows the Linux paths inside WSL.
terminal # Official script (macOS / Linux / WSL)
curl -fsSL https://opencode.ai/install | bash# Or via npm (all platforms)
npm install -g opencode-ai# Verify
opencode --version - 02
Find the config files
The command line can keep "provider definitions" and "keys" apart: opencode.json holds provider definitions (supports .jsonc with comments) and the key goes in auth.json; you can also put it in opencode.json as options.apiKey, as the desktop setup does. Below are the opencode.json locations; you can also place one in a project root to apply only there.
- Windows
%USERPROFILE%\.config\opencode\opencode.json- macOS / Linux
~/.config/opencode/opencode.json- Project-level
<project-root>/opencode.json
- 03
Define the provider
Add a provider in opencode.json (note it's singular provider, not providers). Use the @ai-sdk/openai-compatible adapter; baseURL follows the OpenAI-compatible format and must include /v1; list the model ids you want under models. The key is stored separately in the next step, so it doesn't go here.
json { "$schema": "https://opencode.ai/config.json", "provider": { "xylemnode": { "npm": "@ai-sdk/openai-compatible", "name": "XylemNode", "options": { "baseURL": "https://api.xylemnode.com/v1" }, "models": { "gpt-6.1-sol": {} } } } } - 04
Add the key
Put the key in a separate auth.json, using the same key name as the provider above. The easiest way is to run opencode auth login and let it write the entry; you can also edit it by hand (on macOS / Linux at ~/.local/share/opencode/auth.json, on Windows at %USERPROFILE%\.local\share\opencode\auth.json).
json { "xylemnode": { "type": "api", "key": "sk-your-key" } } - 05
Pick a model and test
Restart OpenCode, type /models to open the model list, pick gpt-6.1-sol under XylemNode, and send a message to confirm. To make new sessions start with it, add "model": "xylemnode/gpt-6.1-sol" at the top level of opencode.json.
terminal /models
Common questions
The provider is configured in OpenCode but its models never appear, or you get ProviderModelNotFoundError
Usually the provider block has npm but no models. There is a confirmed behaviour in the repository: a provider-level npm field is silently ignored unless models is configured as well — nothing errors, the provider simply does not take effect. So list the model ids you intend to use under models. And put the key where OpenCode reads it: options.apiKey in opencode.json, or auth.json via opencode auth login. Either one is enough; with neither, authentication fails.