BeansAI
ModelsPricingDocs
Sign inSign up
ModelsPricingDocs
Sign inSign up

Quickstart

  • Overview

Clients

  • Claude Code
  • CC Switch
  • OpenClaw
  • Roo Code
  • OpenCode
  • Codex CLI
  • GPT Image 2
  • Seedance 2.0
  • SkyReels V4
  • Mureka Song
  • Cursor
  • Cherry Studio

Reference

  • Raw API
← Back to Docs

OpenCode

Open-source Go-based terminal coding assistant. Configure BeansAI as a custom provider.

Overview

OpenCode is a fully open-source terminal coding tool with a TUI built on Bubble Tea. It reads a opencode.json config file that lets you define custom AI providers — point it at BeansAI to access Claude, GPT, and every other model in the catalog from your terminal.

Installation

Choose the method that suits your platform:

macOS / Linux (install script)
curl -fsSL https://opencode.ai/install | bash
All platforms via npm (recommended for Windows)
npm i -g opencode-ai@latest
macOS via Homebrew
brew install --cask opencode-desktop

Configuration

Step 1 — Register BeansAI as a provider. Run the auth command and select other from the list:

shell
# Select "other" from the provider list when prompted
opencode auth login

When prompted, enter: Provider ID: beansai (must match the key in the config file below) and your BeansAI API key.

Step 2 — Write the config file. Create or edit ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json):

~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "beansai": {
      "npm": "@ai-sdk/anthropic",
      "name": "BeansAI",
      "options": {
        "baseURL": "https://api.beansai.dev/v1"
      },
      "models": {
        "claude-opus-4-7": {
          "name": "Claude Opus 4.7"
        },
        "claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6"
        },
        "claude-haiku-4-5-20251001": {
          "name": "Claude Haiku 4.5"
        }
      }
    }
  }
}

The provider key ("beansai") in the JSON must exactly match the Provider ID you entered during opencode auth login. baseURL must end with /v1.

Basic usage

shell
cd your-project
opencode

Use /models inside the TUI to list configured providers and switch models. Type requests in natural language — OpenCode reads your project files and applies changes directly.

Tips

  • Add more models to the models block in the config — any model ID from the BeansAI catalog works.
  • To access GPT models alongside Claude, add a second provider block using "npm": "@ai-sdk/openai" with a separate API key.
  • OpenCode has LSP integration — it sees type errors and diagnostics from your editor and can auto-fix them.
  • Use session management (/sessions) to save and restore conversations per project.