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.

  1. 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.

  2. 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
  3. 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" }
          }
        }
      }
    }
  4. 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.

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.