Skip to main content

Opencode Configuration

Opencode

Official guide: https://opencode.ai/v2/docs

CLI Version

Linux & macOS

Download cli version:
curl -fsSL https://opencode.ai/v2/install | bash

    open the application on the terminal with the command:
    opencode

      Then exit from the application with the command \quit or by pressing Ctrl+C

      the on

      Open the terminal/file explorer open theconfiguration file  ~/.config/opencode/opencode.jsonc in your file explorer and substitutereplace its contents with the filenew with:
      settings below.
      {
        "$schema": "https://opencode.ai/config.json",
        "provider": {
          "elettragateway": {
            "name": "ElettraGateway",
            "npm": "@ai-sdk/openai-compatible",
            "options": {
              "baseURL": "https://llm-api-gw.elettra.eu/v1",
              "apiKey": "sk_ePkBU....."
            },
            "models": {
              "top": { "name": "top", "modalities": { "input": ["text", "image"] } },
            }
          }
        }
      }

      Now

      onIn a terminal, navigate to the terminal,navigate till the folderdirectory of the project you want to work with,on.  Launch Opencode in that directory and launchtype opencode/models, then choose top.
      You’ll now have access to everything you need within the project.

      Windows

      We suggest you to use the Windows Subsystem for Linux (WSL)
      After activating it, use the same procedure as described in Linux & macOS to install and use it!

      DESKTOP Version

        Download the folder,correct digitinstaller for your operating system from
        https:/models/opencode.ai/v2/docs#desktop
        and choosecomplete the installation.

         

        topEdit the configuration file!
        Then 

          On Linux/macOS: ~/.config/opencode/opencode.jsonc  On Windows: C:\Users\<YourUser>\.config\opencode\opencode.jsonc

          Replace its contents with the settings you canneed access(ensure whateverthe file is valid JSONC).

           

          Launch Opencode from a terminal or by double‑clicking the application icon.

           

          In Opencode, go to File → Settings → Models.

            Enable the top model. Disable any other models that are listed.  

            In the prompt bar, select the model you wantprefer on (the project!one you just enabled).
            You’re now ready to use it.

            Windows