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/) and its models.v1`v1
Prerequisites
- Windows 10/11 with
**OpenCodeDesktop**Desktop installed (v2.x)
sk-...`)
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:
Paste the following content into `opencode. and save it:jsonc`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
}
}
}
}
}
}
```
What this does**does
- Registers a custom, OpenAI-compatible provider named
`ElettraGateway`ElettraGatewaypointing at the gateway URL.
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`optionsas>`"apiKey": "sk-..."`,.or
Step 2 — Register your API key
The recommended place for the key is the **credentials file**file:
C:\Users\<you>\.local\share\opencode\auth.json
```
Create it with this content (replace the key with your own):
{
"elettragateway": {
"type": "api",
"key": "sk-YOUR-KEY-HERE"
}
}
```
Step 3 — Start (or reload) OpenCode Desktop
Launch **OpenCode Desktop**Desktop.
If the app was already running while you edited `opencode., jsonc`jsoncnoplease restart isit.
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.
Go to Models — "Choose which models appear in model picker".
Switch off everything not belonging to ElettraGateway, switch on the ElettraGateway models top, balanced, `
Step 5 — Select a model and verify
- Open the model chooser with
**Ctrl+'**(or click the model name in the composer).
top or balanced.

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
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 / "API key required" errors
auth.json`json (Step 2) or the apiKey field.
opencode.jsonc`jsonc seem ignored
/reload`reload in the app, or restart it. Config is merged from the global file plus any opencode.json(c)` in the project folder.
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
C:\Users\<you>\.config\opencode\opencode.jsonc`jsonc
C:\Users\<you>\.config\opencode\cli.json`json
C:\Users\<you>\.local\share\opencode\auth.json`json
C:\Users\<you>\.local\share\opencode\opencode.db`db
C:\Users\<you>\.local\share\opencode\log\opencode.log`log
C:\Users\<you>\AppData\Roaming\ai.opencode.desktop\drafts.sqlite`sqlite
C:\Users\<you>\AppData\Roaming\ai.opencode.desktop\logs\`
Appendix — useful keyboard shortcuts
Ctrl+,`
Ctrl+'`
Ctrl+T`T / Ctrl+N`N
Ctrl+O