OpenCode Setup with Custom OpenAI-Compatible Provider

Prerequisites

Set the following environment variables (same ones used by aider):

export OPENAI_API_KEY=sk-rc-your-api-key-here
export OPENAI_API_BASE=https://chat.catholic-u.ai/api/v1

Add these to your shell profile (e.g., ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish) to persist them.

Configuration

The opencode.json in this project configures a custom OpenAI-compatible provider with two models:

  • Qwen3 Coder Next (RedHatAI/Qwen3-Coder-Next-NVFP4) - set as default
  • Qwen3.5 35B A3B (Sehyo/Qwen3.5-35B-A3B-NVFP4)

Usage

Run with the default model

opencode

This uses the model specified in the "model" field of opencode.json (currently custom/RedHatAI/Qwen3-Coder-Next-NVFP4).

Run with a specific model

opencode --model custom/RedHatAI/Qwen3-Coder-Next-NVFP4
opencode --model custom/Sehyo/Qwen3.5-35B-A3B-NVFP4

Change the default model

Edit the "model" field in opencode.json:

"model": "custom/Sehyo/Qwen3.5-35B-A3B-NVFP4"

Equivalent aider commands

These models can also be used with aider:

aider --model openai/RedHatAI/Qwen3-Coder-Next-NVFP4
aider --model openai/Sehyo/Qwen3.5-35B-A3B-NVFP4

Troubleshooting

  • If opencode cannot connect, verify your environment variables are set: echo $OPENAI_API_KEY
  • If {env:VARIABLE} syntax doesn't work, hardcode the values directly in opencode.json under options.baseURL and options.apiKey