# 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
            }
          }
        }
      }
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arcee.ai/get-started/integration-list/opencode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
