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

# OpenCode CLI installation

> Install OpenCode CLI

OpenCode CLI requires Node.js and npm. After installation, run `opencode` at least once to confirm OpenCode starts correctly.

## 1. Check Node.js

```bash theme={null}
node --version
npm --version
```

If version numbers appear, Node.js and npm are installed.

If Node.js is not installed, refer to the [Node.js installation guide](https://www.runoob.com/nodejs/nodejs-install-setup.html), then run the checks again.

## 2. Install OpenCode CLI

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

Check the installed version:

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

## 3. Initialize OpenCode

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

If the OpenCode chat UI, model information, or command hints appear, the installation succeeded.

<img src="https://mintcdn.com/duiapi/v5s4WtHrXMbWmd21/images/opencode-cli-started.svg?fit=max&auto=format&n=v5s4WtHrXMbWmd21&q=85&s=58bf6275349e7e82c081b391fbaefbf7" alt="OpenCode started successfully" width="980" height="520" data-path="images/opencode-cli-started.svg" />
