Use Redline in OpenCode

OpenCode defines providers in opencode.json using the AI SDK provider packages. Add Redline with the openai-compatible package and point it at the /v1 base URL.

Add a provider in opencode.json

In ~/.config/opencode/opencode.json or a project opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "redline": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Redline",
      "options": {
        "baseURL": "https://redline-gateway.pages.dev/v1",
        "apiKey": "{env:REDLINE_API_KEY}"
      },
      "models": {
        "deepseek/deepseek-chat-v3.1": {
          "name": "DeepSeek Chat v3.1",
          "limit": { "context": 163840, "output": 8192 }
        }
      }
    }
  },
  "model": "redline/deepseek/deepseek-chat-v3.1",
  "small_model": "redline/deepseek/deepseek-chat-v3.1"
}

Set the real context and output limits from the model's catalogue page. For an agent that edits files, choose a tool-capable model. You can also run /connect in OpenCode, choose Other, and paste the key against a provider id of redline.

Related guides