Skip to content

OpenCode — API Integration Guide

This document explains how to integrate OpenCode with third-party API providers compatible with the OpenAI protocol.

Install

bash
pnpm install -g @opencode/cli

Configure

Edit opencode.json under your config directory (e.g., ~/.config/opencode/opencode.json) with a provider entry pointing to your baseURL and models.

Example snippet:

json
{
  "provider": {
    "local": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://api.gpt.ge/v1" },
      "models": { "gpt-4o": { "name": "gpt-4o" } }
    }
  }
}

Restart OpenCode to load changes.