## Overview

OpenCode is a terminal-first AI coding tool. It supports configurable providers, including OpenAI-compatible endpoints like ModelStack.

## Prerequisites

- OpenCode installed
- ModelStack API key from [dashboard](https://modelstack.cc/dashboard/api-keys)

## Installation

Use the official installer:

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

## Configure ModelStack

Set your provider in OpenCode config with:

- **Base URL**: `https://api.modelstack.cc/v1`
- **API key**: your ModelStack key
- **Model**: e.g. `claude-sonnet-4-6`

Example provider config (shape may vary by OpenCode version):

```json
{
  "provider": {
    "id": "modelstack",
    "type": "openai",
    "options": {
      "apiKey": "YOUR_MODELSTACK_API_KEY",
      "baseURL": "https://api.modelstack.cc/v1"
    }
  }
}
```

## Troubleshooting

- Confirm your API key is active
- Confirm base URL is exact (no extra path)
- Confirm model name exists in [supported models](/models/supported-models)

---
