Apertis Docs

Integrations

OpenCode

OpenCode is an AI coding agent that provides both CLI and IDE integration capabilities for AI-powered development tasks.

Updated
Reading time
3 min

On this page

Features

  • CLI Access: Run AI coding tasks directly from terminal
  • IDE Integration: Works with VS Code, Cursor, and compatible editors
  • GitHub Integration: Interact with issues and PRs via comments
  • Conversation Sharing: Share coding sessions with others
  • MCP Support: Enhanced functionality through MCP servers

Installation

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

Method 2: NPM

npm install -g opencode-ai

Configuration for Apertis API

Create or edit the configuration file at ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apertis": {
      "name": "Apertis AI",
      "npm": "@apertis/ai-sdk-provider",
      "options": {
        "apiKey": "your_apertis_api_key"
      },
      "models": {
        "claude-opus-4-8-thinking": {
          "name": "Claude Opus 4.8 (Thinking)"
        },
        "claude-opus-4-8": {
          "name": "Claude Opus 4.8"
        },
        "claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6"
        },
        "claude-haiku-4-5": {
          "name": "Claude Haiku 4.5"
        },
        "gemini-3.1-pro-preview": {
          "name": "Gemini 3.1 Pro Preview"
        },
        "gemini-3.1-flash-lite-preview": {
          "name": "Gemini 3.1 Flash Lite Preview"
        }
      }
    }
  },
  "model": "apertis/claude-opus-4-8"
}

Option 2: Without SDK (OpenAI-Compatible)

If you prefer not to use the Apertis SDK, you can use the built-in OpenAI-compatible mode by specifying baseURL:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apertis": {
      "name": "Apertis AI",
      "options": {
        "baseURL": "https://api.apertis.ai/v1",
        "apiKey": "your_apertis_api_key"
      },
      "models": {
        "claude-opus-4-8": {
          "name": "Claude Opus 4.8"
        },
        "claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6"
        }
      }
    }
  },
  "model": "apertis/claude-opus-4-8"
}

Replace your_apertis_api_key with your actual API key from Apertis Dashboard.

Configuration Fields

Field Description
provider.apertis.npm Apertis SDK package. Use @apertis/ai-sdk-provider for automatic setup.
provider.apertis.options.baseURL Apertis API endpoint. Only needed without the SDK.
provider.apertis.options.apiKey Your API key from Apertis Dashboard.
provider.apertis.models Available models to use. Add or remove as needed.
model Default model on launch. Format: apertis/<model-id>.

Available Model IDs

Model ID Description
claude-opus-4-8-thinking Claude Opus 4.8 with extended thinking
claude-opus-4-8 Claude Opus 4.8 — most capable
claude-sonnet-4-6 Claude Sonnet 4.6 — balanced speed and capability
claude-haiku-4-5 Claude Haiku 4.5 — fastest
gemini-3.1-pro-preview Gemini 3.1 Pro Preview
gemini-3.1-flash-lite-preview Gemini 3.1 Flash Lite Preview

For the full list of available models, check the Model List.

Launch OpenCode

opencode

Use the /models command within OpenCode to switch models.

IDE Integration

OpenCode works with VS Code, Cursor, and compatible terminals.

Keyboard Shortcuts

Action macOS Windows/Linux
Quick Launch Cmd+Esc Ctrl+Esc
New Session Cmd+Shift+Esc Ctrl+Shift+Esc
File References Cmd+Option+K Alt+Ctrl+K

Commands

Command Description
/models Select AI model
/share Create public conversation link
/unshare Remove public access
/help Show available commands

GitHub Integration

Interact with OpenCode directly in GitHub issues and pull requests.

Setup

Run this command in your GitHub repository:

opencode github install

Usage

Comment with /opencode or /oc in GitHub issues/PRs to:

  • Explain Issues: Get AI explanations for bug reports
  • Fix Bugs: Generate fixes for reported issues
  • Implement Features: Create code for feature requests
  • Review PRs: Get AI-powered code reviews

MCP Server Support

OpenCode supports Model Context Protocol servers:

  • Vision Server: Analyze images and screenshots
  • Web Search Server: Search the web for information
  • Web Reader Server: Extract content from web pages

Troubleshooting

Connection Issues

  • Verify your API key at Apertis Dashboard
  • Ensure the Base URL is set correctly
  • Check environment variables are exported

Authentication Problems

Reset authentication and reconfigure:

opencode auth logout
opencode auth login