> ## 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/ZfLuoc0MUZgivF8J/images/oc-en-1.png?fit=max&auto=format&n=ZfLuoc0MUZgivF8J&q=85&s=8e9833d8bc51e730ebcabfca38966fa8" alt="Oc En 1" width="3120" height="2008" data-path="images/oc-en-1.png" />
    </Frame>
  </Step>

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

    <Frame>
      <img src="https://mintcdn.com/personal-a5418d9f/ZfLuoc0MUZgivF8J/images/oc-en-2-1.png?fit=max&auto=format&n=ZfLuoc0MUZgivF8J&q=85&s=0ed94955cce342d66c517f838e5f6965" alt="Oc En 2 1" width="2216" height="1357" data-path="images/oc-en-2-1.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](/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`)

    <img src="https://mintcdn.com/personal-a5418d9f/ZfLuoc0MUZgivF8J/images/oc-en-4.png?fit=max&auto=format&n=ZfLuoc0MUZgivF8J&q=85&s=ffd5756dc65b4110be1c2157286feadb" alt="Oc En 4" width="1440" height="1159" data-path="images/oc-en-4.png" />
  </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

Add additional providers to use the response：

```jsonc theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "disabled_providers": [],
  "provider": {
    "mixroute": {
      "name": "mixroute",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.mixroute.ai/v1"
      },
      "models": {
        "gemini-3.8-flash": {
          "name": "gemini-3.8-flash"
        }
      }
    },
    "mixroute-responses": {
      "name": "mixroute-responses",
      "npm": "@ai-sdk/openai",
      "options": {
        "baseURL": "https://api.mixroute.ai/v1",
        "apiKey": "mixroute-key"
      },
      "models": {
        "gpt-5.6-luna": {
          "name": "gpt-5.6-luna"
        },
        "gpt-5.6-terra": {
          "name": "gpt-5.6-terra"
        },
        "gpt-5.6-sol": {
          "name": "gpt-5.6-sol"
        }
      }
    }
  }
}
```

## Configuration Success Example

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

<img src="https://mintcdn.com/personal-a5418d9f/ZfLuoc0MUZgivF8J/images/oc-en-6-1.png?fit=max&auto=format&n=ZfLuoc0MUZgivF8J&q=85&s=4defc77f3379febc15f7ba9f794cb662" alt="Oc En 6 1" width="1806" height="1857" data-path="images/oc-en-6-1.png" />


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