# OpenCode

OpenCode is a terminal-first AI coding assistant that enables developers to interact with large language models (LLMs) directly from the command line. It supports interactive prompting, model switching, and configuration-driven customization for advanced workflows.

OpenCode supports OpenRouter as an API provider, allowing you to access a wide range of language models, including **Arcee AI’s Trinity models**, through a single OpenAI-compatible endpoint. This simplifies setup, enables easy experimentation across models, and centralizes authentication and usage tracking.

This guide walks through how to configure OpenCode to use Trinity models via OpenRouter.

***

**Prerequisites**

* OpenRouter Account
  * If you don't have an account, set one up [here](https://openrouter.ai/).
* OpenRouter API Key
  * If you don't have an API Key, create one [here](https://openrouter.ai/settings/keys).

**Quickstart**

1. Run the `/connect` command and search for OpenRouter.
2. Enter the API key for the provider.

   ```
   ┌ API key
   │
   │
   └ enter
   ```
3. Many OpenRouter models are preloaded by default, run the `/models` command to select an Arcee Trinity model (for example, Trinity-Large) from the list.

   ```
   /models
   ```
4. Configure Models via opencode.json (optional)
   1. You can add or customize models using the OpenCode configuration file, including their provider:

```
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openrouter": {
      "models": {
        "arcee-ai/trinity-large": {
          "options": {
            "provider": {
              "order": ["openrouter"],
              "allow_fallbacks": false
            }
          }
        }
      }
    }
  }
}
```
