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

# OpenCode

> OpenCode Integration Guide: Multi-model programming assistant via MixRoute.

## Introduction

OpenCode is an open-source AI programming assistant supporting 75+ models and local deployment. With **MixRoute API**, you can use various mainstream and latest models (GPT, Claude, Gemini, etc.) in OpenCode with custom provider and model configuration.

**Download**: [https://opencode.ai/](https://opencode.ai/)

## Quick Configuration

### 1. Get API Key

Create and copy your API key from [MixRoute Console](https://api.mixroute.ai/).

### 2. Configure Custom Provider in OpenCode

<Steps>
  <Step title="Open Settings">
    Open OpenCode, go to **Server / Provider** settings

    <Frame>
      <img src="https://mintcdn.com/personal-a5418d9f/XrkadTrCIIPrxSRP/images/integrations/open-code1.png?fit=max&auto=format&n=XrkadTrCIIPrxSRP&q=85&s=190387f5869cf2bb40af9b5afc1d951b" alt="OpenCode Provider Settings" width="1920" height="1140" data-path="images/integrations/open-code1.png" />
    </Frame>
  </Step>

  <Step title="Add Provider">
    Add **Custom Provider** (Configure an OpenAI compatible provider)

    <Frame>
      <img src="https://mintcdn.com/personal-a5418d9f/XrkadTrCIIPrxSRP/images/integrations/open-code2.png?fit=max&auto=format&n=XrkadTrCIIPrxSRP&q=85&s=b13df4ffba289fc4955a8971feadd49b" alt="Add Custom Provider" width="795" height="526" data-path="images/integrations/open-code2.png" />
    </Frame>
  </Step>

  <Step title="Fill Configuration">
    <AccordionGroup>
      <Accordion title="Smart Routing Node">
        <Tip>
          [Smart Routing](https://console.mixroute.ai/smart-route) is an intelligent model routing capability that automatically distributes requests to the most suitable model based on task complexity, reducing API costs while enhancing efficiency.

          See [here](/en/smart-routing) for constraints and usage guide.
        </Tip>

        * **Provider ID**: e.g., `mixroute-route` (lowercase, numbers, hyphens or underscores)
        * **Display Name**: e.g., `Mixroute Api Route`
        * **Base URL**: `https://api.mixroute.ai/v1` (must end with `/v1`)
        * **API Key**: Paste your Mixroute Api Smart Routing node key

        <Info>
          Note that Smart Routing node keys are independent and not shared with traditional API keys.
        </Info>
      </Accordion>

      <Accordion title="Traditional API Node">
        * **Provider ID**: e.g., `mixroute` (lowercase, numbers, hyphens or underscores)
        * **Display Name**: e.g., `Mixroute Api`
        * **Base URL**: `https://api.mixroute.ai/v1` (must end with `/v1`)
        * **API Key**: Paste your Mixroute Api key
      </Accordion>
    </AccordionGroup>
  </Step>

  <Step title="Add Models">
    Add models you need (e.g., `gpt-5.5`, `claude-opus-4-8`)
  </Step>

  <Step title="Save and Use">
    Use **ProviderID/ModelID** format (e.g., `mixroute/gpt-5.5`)
  </Step>
</Steps>

### 3. Switch Models

Select configured provider and model in chat or settings (e.g., `mixroute/gpt-5.5`).

## Models Requiring Responses API

Some models require **Responses API** instead of Chat Completions. If you see this error:

> The chatCompletion operation does not work with the specified model

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/XrkadTrCIIPrxSRP/images/integrations/open-code3.png?fit=max&auto=format&n=XrkadTrCIIPrxSRP&q=85&s=e14eb8f6d6277b9b9758b5de8ca96923" alt="Error Example" width="784" height="379" data-path="images/integrations/open-code3.png" />
</Frame>

Add `"apiCompatibility": "responses"` in your config file:

```jsonc theme={null}
{
  "provider": {
    "mixroute": {
      "models": {
        "gpt-5.1-codex": {
          "name": "gpt-5.1-codex",
          "apiCompatibility": "responses"
        }
      },
      "options": {
        "baseURL": "https://api.mixroute.ai/v1"
      }
    }
  }
}
```

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/XrkadTrCIIPrxSRP/images/integrations/open-code5.png?fit=max&auto=format&n=XrkadTrCIIPrxSRP&q=85&s=1f6f42e43dc65cf364ae1fb25355aee8" alt="Config File Location" width="929" height="375" data-path="images/integrations/open-code5.png" />
</Frame>

<Frame caption="Configuration Success Example">
  <img src="https://mintcdn.com/personal-a5418d9f/XrkadTrCIIPrxSRP/images/integrations/open-code6.png?fit=max&auto=format&n=XrkadTrCIIPrxSRP&q=85&s=4af2581a5b4b6e9a5a22f640ca5648f8" alt="Configuration Success" width="1920" height="1109" data-path="images/integrations/open-code6.png" />
</Frame>

## Configuration Success Example

Below is an example of normal conversation using Mixroute Api in OpenCode:

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/XrkadTrCIIPrxSRP/images/integrations/open-code7.png?fit=max&auto=format&n=XrkadTrCIIPrxSRP&q=85&s=daff8834357384838a4cdf22ef227f3d" alt="OpenCode Conversation Example" width="1920" height="1140" data-path="images/integrations/open-code7.png" />
</Frame>
