> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evolink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode

> Connect OpenCode to EvoLink.AI

## Overview

<img src="https://mintcdn.com/muyutechnology/K_Zw7kcC-XNOjX6V/images/opencode_image/f9f7fa98-62b6-4d46-af43-a9f07e4afb07.png?fit=max&auto=format&n=K_Zw7kcC-XNOjX6V&q=85&s=bc0908a7443bc9f45e06d6917437d1e4" alt="OpenCode Interface" width="1748" height="1452" data-path="images/opencode_image/f9f7fa98-62b6-4d46-af43-a9f07e4afb07.png" />

OpenCode is a Go-based open-source command-line programming tool (CLI) that provides powerful AI assistance for developers. It offers an intuitive Terminal User Interface (TUI) and supports multiple LLM providers including OpenAI, Anthropic, Gemini, and more.

By integrating OpenCode with **EvoLink API**, you can access top-tier AI models including **Claude**, **GPT**, and **Gemini** series, enabling unified key multi-model access.

## Prerequisites

Before configuring, make sure you have:

### 1. Terminal Emulator

OpenCode requires a modern terminal emulator. Recommended options:

* **WezTerm** (cross-platform)
* **Alacritty** (cross-platform)
* **Ghostty** (Linux and macOS)
* **Kitty** (Linux and macOS)

Windows users can also use PowerShell or Windows Terminal.

macOS users can use the built-in Terminal.app or iTerm2.

Linux users can use the built-in terminal or GNOME Terminal, Konsole, etc.

### 2. Get EvoLink API Key

* Log in to [EvoLink Dashboard](https://evolink.ai/dashboard)
* Find API Keys in the dashboard, click 'Create New Key' button, then copy the generated Key
* API Key usually starts with `sk-`

## Step 1: Install OpenCode

<Note>
  **Tip:** If you don't know how to open a command line terminal, see [FAQ - How to open command line terminal](#11-how-to-open-command-line-terminal)
</Note>

<Tabs>
  <Tab title="macOS / Linux">
    The easiest way is through the install script:

    ```bash theme={null}
    curl -fsSL https://opencode.ai/install | bash
    ```

    Or using Homebrew:

    ```bash theme={null}
    brew install anomalyco/tap/opencode
    ```
  </Tab>

  <Tab title="Windows">
    Windows users should first install [Node.js](https://nodejs.org/en/download), then install via NPM:

    ```bash theme={null}
    npm i -g opencode-ai@latest
    ```

    Or using Chocolatey:

    ```bash theme={null}
    choco install opencode
    ```

    Or using Scoop:

    ```bash theme={null}
    scoop bucket add extras
    scoop install extras/opencode
    ```
  </Tab>
</Tabs>

### Verify Installation

```bash theme={null}
opencode --version
```

**Success indicator:** Shows version information.

If you prefer a graphical interface, OpenCode also offers a desktop app available at [OpenCode Download Page](https://opencode.ai/download).

## Step 2: Configure EvoLink API

### 1. Initialize Provider

After installation, run the following command in your terminal before launching OpenCode:

```bash theme={null}
opencode auth login
```

<img src="https://mintcdn.com/muyutechnology/K_Zw7kcC-XNOjX6V/images/opencode_image/37792e89-017b-407c-ac98-2331dfd38a7c.png?fit=max&auto=format&n=K_Zw7kcC-XNOjX6V&q=85&s=a2d0356f85cc9a1a242d36665f50d17c" alt="Select Provider" width="1502" height="942" data-path="images/opencode_image/37792e89-017b-407c-ac98-2331dfd38a7c.png" />

1. In the provider list, select **other** (at the bottom, you can search for it)

2. Enter **Provider ID**: type `evolink-anthropic`

<img src="https://mintcdn.com/muyutechnology/K_Zw7kcC-XNOjX6V/images/opencode_image/6dabad70-7294-4896-ae36-161d1c56ac3a.png?fit=max&auto=format&n=K_Zw7kcC-XNOjX6V&q=85&s=68582f3d5a6725ed74a34cecdc18d7e7" alt="Enter Provider ID" width="1236" height="782" data-path="images/opencode_image/6dabad70-7294-4896-ae36-161d1c56ac3a.png" />

3. Enter **API Key token**: you can enter any value (e.g., `admin`), the actual key is referenced via config file

<img src="https://mintcdn.com/muyutechnology/K_Zw7kcC-XNOjX6V/images/opencode_image/ScreenShot_2026-01-14_175225_106.png?fit=max&auto=format&n=K_Zw7kcC-XNOjX6V&q=85&s=a78a8611acf2748fccea0d8a460d67f4" alt="Enter API Key" width="2090" height="914" data-path="images/opencode_image/ScreenShot_2026-01-14_175225_106.png" />

This step registers a custom provider in OpenCode's local credential manager.

### 2. Edit Config File

Open the OpenCode config directory:

<Tabs>
  <Tab title="Windows">
    Press `Win + R`, paste the following, then press Enter:

    ```
    %userprofile%\.config\opencode
    ```
  </Tab>

  <Tab title="macOS / Linux">
    In terminal, run:

    ```bash theme={null}
    cd ~/.config/opencode
    ```

    Or access `~/.config/opencode/` in Finder/file manager
  </Tab>
</Tabs>

Create or edit `opencode.json` in this directory:

```json theme={null}
{
    "$schema": "https://opencode.ai/config.json",
    "provider": {
        "evolink-anthropic": {
            "npm": "@ai-sdk/anthropic",
            "name": "EvoLink Claude",
            "options": {
                "baseURL": "https://direct.evolink.ai/v1",
                "apiKey": "Your EvoLink API Key"
            },
            "models": {
                "claude-opus-4-7": {
                    "name": "Claude Opus 4.7"
                },
                "claude-opus-4-6": {
                    "name": "Claude Opus 4.6"
                },
                "claude-sonnet-4-6": {
                    "name": "Claude Sonnet 4.6"
                },
                "claude-opus-4-5-20251101": {
                    "name": "Claude 4.5 Opus"
                },
                "claude-sonnet-4-5-20250929": {
                    "name": "Claude 4.5 Sonnet"
                },
                "claude-haiku-4-5-20251001": {
                    "name": "Claude 4.5 Haiku"
                }
            }
        },
        "evolink-google": {
            "npm": "@ai-sdk/google",
            "name": "EvoLink Gemini",
            "options": {
                "baseURL": "https://direct.evolink.ai/v1beta",
                "apiKey": "Your EvoLink API Key"
            },
            "models": {
                "gemini-2.5-flash": {
                    "name": "Gemini 2.5 Flash"
                },
                "gemini-2.5-pro": {
                    "name": "Gemini 2.5 Pro"
                },
                "gemini-3-flash-preview": {
                    "name": "Gemini 3.0 Flash"
                },
                "gemini-3-pro-preview": {
                    "name": "Gemini 3.0 Pro"
                },
                "gemini-3.1-flash-lite-preview": {
                    "name": "Gemini 3.1 Flash Lite"
                },
                "gemini-3.1-pro-preview": {
                    "name": "Gemini 3.1 Pro"
                }
            }
        },
        "evolink-openai": {
            "npm": "@ai-sdk/openai",
            "name": "EvoLink GPT",
            "options": {
                "baseURL": "https://direct.evolink.ai/v1",
                "apiKey": "Your EvoLink API Key"
            },
            "models": {
                "gpt-5.1": {
                    "name": "GPT-5.1"
                },
                "gpt-5.2": {
                    "name": "GPT-5.2"
                },
                "gpt-5.4": {
                    "name": "GPT-5.4"
                },
                "MiniMax-M2.5": {
                    "name": "MiniMax M2.5"
                }
            }
        }
    }
}
```

**⚠️ Important:**

* Replace `"Your EvoLink API Key"` with your actual API Key
* JSON format is sensitive to symbols

## Step 3: Start Using OpenCode

### 1. Launch OpenCode

After saving the config file, restart your terminal, then navigate to your working directory:

```shell theme={null}
cd your-working-directory
```

Launch OpenCode:

```shell theme={null}
opencode
```

### 2. Verify Configuration

In the chat interface, enter the command:

```
/models
```

<img src="https://mintcdn.com/muyutechnology/K_Zw7kcC-XNOjX6V/images/opencode_image/2f257b9e-476d-4abf-98b1-0b7a54065e64.png?fit=max&auto=format&n=K_Zw7kcC-XNOjX6V&q=85&s=bfb56e79aa0c473986baefe0d119ce55" alt="OpenCode Interface and Model Selection" width="1818" height="1208" data-path="images/opencode_image/2f257b9e-476d-4abf-98b1-0b7a54065e64.png" />

You should see **EvoLink Claude**, **EvoLink Gemini**, and **EvoLink GPT** in the model list. Select one and you're ready to go!

## FAQ

### 1. What is OpenCode and what is it used for?

OpenCode is an open-source terminal AI coding assistant with a modern TUI interface. It supports code editing, file operations, and command execution, ideal for AI-assisted programming in terminal environments.

### 2. How do I verify installation and configuration on first use?

Run these steps in sequence:

* `opencode --version`: Confirm OpenCode is installed
* Launch OpenCode and enter `/models`: Confirm you can see the configured models

### 3. Where should the config file be placed?

The `opencode.json` config file should be placed at:

* Windows: `C:\Users\{username}\.config\opencode\opencode.json`
* macOS / Linux: `~/.config/opencode/opencode.json`

### 4. What models does OpenCode support?

Through EvoLink API, OpenCode supports the following models:

**Claude series:**

* **Claude Opus 4.6 / Sonnet 4.6**: Latest generation models
* **Claude 4.5 Opus / Sonnet / Haiku**: High-performance model family

**Gemini series:**

* **Gemini 2.5 Flash / Pro**: Latest generation balanced models
* **Gemini 3.0 Flash / Pro**: Next-generation high-performance models
* **Gemini 3.1 Flash Lite / Pro**: Newest generation models with enhanced capabilities

**GPT series:**

* **GPT-5.1**: Advanced reasoning model
* **GPT-5.2**: Enhanced multi-task model
* **GPT-5.4**: Latest flagship model
* **MiniMax M2.5**: MiniMax high-performance model

### 5. How do I switch models?

In the OpenCode interface, enter the `/models` command, then select your desired model from the list.

### 6. Why don't my config changes take effect?

* Restart OpenCode
* Check `opencode.json` syntax (JSON format)
* Verify config file path is correct

### 7. What causes 401/403 errors?

* **401 error**: API Key not set or invalid
* **403 error**: Insufficient permissions or expired key
* Check the `apiKey` in your config file

### 8. Will OpenCode automatically read or upload my local files and code?

OpenCode only reads file content when you explicitly authorize it. It's recommended to use it in a dedicated project folder.

### 9. Does OpenCode support Chinese input and output?

Yes, fully supported.

### 10. What scenarios is OpenCode suited for?

**Suited for:**

* Code writing, debugging, and refactoring
* AI-assisted programming in terminal environments
* File content analysis and processing
* Users who prefer modern TUI interfaces

**Not suited for:**

* Complex GUI interactions
* Users unfamiliar with terminal operations

### 11. How to open command line terminal?

<Tabs>
  <Tab title="Windows">
    * Method 1: Press `Win + R`, type `cmd` or `powershell`, then press Enter
    * Method 2: Search for "Command Prompt" or "PowerShell" in the Start menu
    * Method 3: Hold Shift and right-click in a folder, select "Open PowerShell window here"
  </Tab>

  <Tab title="macOS">
    * Method 1: Press `Command + Space` to open Spotlight, type `Terminal`, then press Enter
    * Method 2: Go to "Applications" → "Utilities" → "Terminal"
  </Tab>

  <Tab title="Linux">
    * Method 1: Press `Ctrl + Alt + T` shortcut
    * Method 2: Search for "Terminal" in the application menu
  </Tab>
</Tabs>

## Notes

<Warning>
  Run OpenCode in a dedicated project folder. Avoid running it in sensitive directories (such as system folders or directories containing credentials). OpenCode operates starting from the current working directory.
</Warning>

<Tip>
  OpenCode uses JSON format config files. Ensure your config file syntax is correct. You can use online JSON validators to check the format.
</Tip>
