Opencode

Connect Opencode to aivene for terminal-based AI coding.

Opencode is a terminal-based AI coding agent. Write, edit, and refactor code with natural language. Supports custom providers and multi-model workflows.

Setup

The fastest way to set up Opencode with aivene is through the Integrations page. Use the one-click setup script to configure everything automatically.

Manual setup

If you prefer manual configuration:

1. Install Opencode

# macOS / Linux
curl -fsSL https://opencode.ai/install | bash

# Windows (PowerShell)
irm https://opencode.ai/install.ps1 | iex

2. Configure aivene provider

Edit your global config at ~/.config/opencode/opencode.json (on Windows: %USERPROFILE%\.config\opencode\opencode.json) and add aivene under provider:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "aivene": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "aivene",
      "options": {
        "baseURL": "https://api.aivene.com/v1",
        "apiKey": "isk-your-api-key"
      },
      "models": {
        "gpt-5.5": {
          "name": "GPT-5.5"
        }
      }
    }
  },
  "model": "aivene/gpt-5.5"
}
  • Each key under models is an aivene model ID. Add one entry per model you want to use.
  • model is the default model, written as aivene/<model-id>.
  • If the file already has other settings or providers, merge the aivene entry into the existing provider object instead of replacing the file.

3. Run Opencode

cd your-project
opencode

Troubleshooting

"Configuration is invalid ... got "custom" provider"

Older versions of this guide used a config format that current Opencode no longer accepts:

{
  "provider": "custom",
  "providers": { "custom": { "baseUrl": "https://api.aivene.com/v1" } }
}

Opencode rejects the whole config when it finds it, so no provider works. To fix it, either:

  • run the setup script from the Integrations page again (it removes the old format and keeps a .aivene-backup copy of every file it changes), or
  • open ~/.config/opencode/config.json, delete the "provider": "custom" and "providers" entries, and configure aivene in opencode.json as shown above.

Model selection

You can use any compatible model available on aivene. Check the Models page for the full list.