Skip to main content

Opencode Configuration

Opencode

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 the terminal/file explorer open the file  ~/.config/opencode/opencode.jsonc and substitute the file with:

{
  "$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 on the terminal,navigate till the folder of the project you want work with, and launch opencode in the folder, digit /models and choose top!
Then you can access whatever you want on the project!

Windows