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

# OpenCode

> Use ModelStack with OpenCode - terminal AI coding assistant

## 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 theme={null}
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 theme={null}
{
  "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)

***

*Last verified: 2026-03-07*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.