Skip to main content

Opencode Desktop configuration

#

Setting up OpenCode Desktop (Windows) with the ElettraGateway provider

Step-by-step instructions to configure **OpenCode Desktop**Desktop on Windows to use the **ElettraGateway**ElettraGateway LLM gateway (`https://llm-api-gw.elettra.eu/v1`v1) and its models.

**Prerequisites**

Prerequisites

-
  • Windows 10/11 with **OpenCode Desktop**Desktop installed (v2.x)
- An **ElettraGateway API key**key (`sk-...`) - A plain-text editor (Notepad, Notepad++, VS Code…) >

All steps below are for your Windows user account. ``<you> means your Windows > user name, e.g. `C:\Users\francesco.guzzi\name.surname\...`.

---
##

Step 1 — Create the configuration file `opencode.jsonc`jsonc

OpenCode reads its **global configuration**configuration from:

```
C:\Users\<you>\.config\opencode\opencode.jsonc
```

Create the folder and the file if they do not exist yet:

![The .config\opencode folder containing opencode.jsonc](screenshots/01-config-folder.png)

Paste the following content into `opencode.jsonc`jsonc and save it:

```jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "elettragateway": {
      "name": "ElettraGateway",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://llm-api-gw.elettra.eu/v1"
      },
      "models": { "ds4": { "name": "ds4", "limit": { "context": 384000, "input": 384000, "output": 100000 } }, "qwen38": { "name": "qwen38", "limit": { "context": 262144, "input": 262144, "output": 100000 } }, "qwen38dgx": { "name": "qwen38dgx", "limit": { "context": 262144, "input": 262144, "output": 100000 }, "modalities": { "input": ["text", "image"] } },
        "balanced": {
          "name": "balanced",
          "limit": {
            "context": 262144,
            "input": 262144,
            "output": 100000
          },
          "modalities": {
            "input": ["text", "image"]
          }
        },
        "top": {
          "name": "top",
          "limit": {
            "context": 1000000,
            "input": 1000000,
            "output": 100000
          },
          "modalities": {
            "input": ["text", "image"]
          }
        },
        "fast": {
          "name": "fast",
          "limit": {
            "context": 131000,
            "input": 131000,
            "output": 100000
          }
        }
      }
    }
  }
}
```
![opencode.jsonc open in the editor](screenshots/02-opencode-jsonc.png) **

What this does**does

-
  • Registers a custom, OpenAI-compatible provider named `ElettraGateway`ElettraGateway pointing at the gateway URL.
- Declares the available models and their context limits (`limit.context`context, `limit.input`input, `limit.output`output) — this is what OpenCode uses for context accounting. - `modalities.input: ["text", "image"]` marks the models that accept images. > **

Tip:** keep the API key **out**out of this file (see Step 2). If you prefer a > single file, you can instead put it under `options`options as > `"apiKey": "sk-..."`,.

or
use
`"apiKey": "{env:ELETTRA_API_KEY}"` and set that > environment variable. --- ##

Step 2 — Register your API key

```
C:\Users\<you>\.local\share\opencode\auth.json
```

Create it with this content (replace the key with your own):

```json
{
  "elettragateway": {
    "type": "api",
    "key": "sk-YOUR-KEY-HERE"
  }
}
```
![auth.json
template open in the editor](screenshots/03-auth-json.png) The key is stored outside your configuration, so `opencode.jsonc` stays safe to share or commit to version control. --- ##

Step 3 — Start (or reload) OpenCode Desktop

Launch **OpenCode Desktop**Desktop.

- OpenCode watches the configuration and applies changes live — if

If the app was already running while you edited `opencode.jsonc`jsonc, noplease restart isit.

needed.
- If the new provider does not appear, type `/reload` in the prompt, or close and reopen the app. --- ##

Step 4 — Make the models visible in the model picker

The desktop app keeps its **own list of which models appear in the model picker**picker. Models that are not enabled there are hidden, even when they are correctly configuredconfigured.

—
aClick frequent cause of *"I only see 3 models"*. 1. Open Settings with **Ctrl+,** (oron the command"three paletterows →icon" *Open(see settings*).screenshot), 2.select File -> Settings. Go to **Models**Providers — *"Choose which models appear in model picker"*. 3.Settings → Providers: verify that ElettraGateway is listed Go to Models — "Choose which models appear in model picker". Switch off everything not belonging to ElettraGateway, switch on the ElettraGateway models you(top, want (`ds4`balanced, `qwen38`, `qwen38dgx`, `balanced`, `top`, `fast`)fast), or use **Enable all models**models. ![Settings →

Settings → Models: enable the models that appear in the picker

Models:
enable the models that appear in the picker](screenshots/04-settings-models.png) --- ##

Step 5 — Select a model and verify

1.
  1. Open the model chooser with **Ctrl+'** (or click the model name in the composer).
2. Pick one of the ElettraGateway models, e.g. `top`top or `balanced`balanced. 3. Send a test prompt and check that a reply arrives. ![Model picker

Model picker showing the ElettraGateway models

showing the ElettraGateway models](screenshots/05-model-picker.png)

You can also mark models as favourites and use the *Manage models*models dialog to hide models you never use (for example the free `opencode/*` models).

---
##

Troubleshooting

Troubleshooting
| Symptom | Cause / fix | | ---|--- | | Only some models appear in the picker | Step 4: the model is disabled in **Settings → Models**Models (models not listed there are hidden by default). | | No `ElettraGateway`ElettraGateway provider at all | `opencode.jsonc`jsonc not found or not valid JSON/JSONC. Check the path from Step 1 and validate the syntax (a missing `}` or a trailing comma breaks the whole file). | |`401`401 / "API key required" errors | The key is missing or wrong — re-check `auth.json`json (Step 2) or the `apiKey`apiKey field. | | Changes to `opencode.jsonc`jsonc seem ignored | Use `/reload`reload in the app, or restart it. Config is merged from the global file plus any `opencode.json(c)` in the project folder. | | Still stuck | Inspect the logs: `C:\Users\<you>\.local\share\opencode\log\opencode.log`log (background service) and `C:\Users\<you>\AppData\Roaming\ai.opencode.desktop\logs\` (app). Look for `configuration normalization diagnostic`diagnostic warnings — they point to malformed config. | --- ##

Appendix — where things live

|
What |Path Path | |---| --- | | Global configuration (providers, models) | `C:\Users\<you>\.config\opencode\opencode.jsonc`jsonc | | CLI/TUI settings (not used by the desktop) | `C:\Users\<you>\.config\opencode\cli.json`json | | API keys / credentials | `C:\Users\<you>\.local\share\opencode\auth.json`json | | Sessions database | `C:\Users\<you>\.local\share\opencode\opencode.db`db | | Service log | `C:\Users\<you>\.local\share\opencode\log\opencode.log`log | | Desktop app GUI settings (model visibility, layout, tabs) | `C:\Users\<you>\AppData\Roaming\ai.opencode.desktop\drafts.sqlite`sqlite | | Desktop app logs | `C:\Users\<you>\AppData\Roaming\ai.opencode.desktop\logs\` | ##

Appendix — useful keyboard shortcuts

|
Action |Shortcut Shortcut | |---| --- | | Open settings | `Ctrl+,` | | Choose model | `Ctrl+'` | | New session | `Ctrl+T`T / `Ctrl+N`N | | Open project |Ctrl+O `Ctrl+O` || Toggle terminal | `Ctrl+\`` | | Command palette | search everything (Settings → *Search everything*everything) |