> ## 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連携ガイド：MixRoute経由で利用するマルチモデルのプログラミングアシスタント。

## はじめに

OpenCodeは、75以上のモデルとローカルデプロイに対応するオープンソースのAIプログラミングアシスタントです。**MixRoute API**を使うと、プロバイダーとモデルを独自に設定して、さまざまな主要モデルや最新モデル（GPT、Claude、Geminiなど）をOpenCodeで利用できます。

**ダウンロード**：[https://opencode.ai/](https://opencode.ai/)

## クイック設定

### 1. APIキーを取得

[MixRouteコンソール](https://api.mixroute.ai/)でAPIキーを作成し、コピーしてください。

### 2. OpenCodeでカスタムプロバイダーを設定する

<Steps>
  <Step title="設定を開く">
    OpenCodeを開き、**サーバー / プロバイダー**の設定に移動します

    <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 英語版 1" width="3120" height="2008" data-path="images/oc-en-1.png" />
    </Frame>
  </Step>

  <Step title="プロバイダーを追加">
    **カスタムプロバイダー**を追加（OpenAI互換プロバイダーを設定）

    <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="OpenCode英語版2 1" width="2216" height="1357" data-path="images/oc-en-2-1.png" />
    </Frame>
  </Step>

  <Step title="設定を入力">
    <AccordionGroup>
      <Accordion title="スマートルーティングノード">
        <Tip>
          [スマートルーティング](https://console.mixroute.ai/smart-route)は、タスクの複雑さに基づいてリクエストを最適なモデルに自動的に振り分け、効率を高めながらAPIコストを削減するインテリジェントなモデルルーティング機能です。

          制約と利用ガイドについては、[こちら](/ja/api-reference/smart-routing)を参照してください。
        </Tip>

        * **プロバイダーID**：例：`mixroute-route`（小文字、数字、ハイフン、アンダースコア）
        * **表示名**: 例: `Mixroute Api Route`
        * **ベースURL**：`https://api.mixroute.ai/v1`（末尾は`/v1`である必要があります）
        * **APIキー**: Mixroute APIのスマートルーティングノードのキーを貼り付けます

        <Info>
          スマートルーティングのノードキーは独立しており、従来のAPIキーとは共有されないことに注意してください。
        </Info>
      </Accordion>

      <Accordion title="従来のAPIノード">
        * **プロバイダーID**：例：`mixroute`（小文字、数字、ハイフン、アンダースコア）
        * **表示名**: 例: `Mixroute Api`
        * **ベースURL**：`https://api.mixroute.ai/v1`（末尾は`/v1`である必要があります）
        * **APIキー**: Mixroute APIキーを貼り付けます
      </Accordion>
    </AccordionGroup>
  </Step>

  <Step title="モデルを追加">
    必要なモデルを追加してください（例: `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 英語版4" width="1440" height="1159" data-path="images/oc-en-4.png" />
  </Step>

  <Step title="保存して使用する">
    **ProviderID/ModelID**形式（例：`mixroute/gpt-5.5`）を使用します。
  </Step>
</Steps>

### 3. モデルの切り替え

チャットまたは設定で、設定済みのプロバイダーとモデル（例：`mixroute/gpt-5.5`）を選択します。

## Responses APIが必要なモデル

一部のモデルには、Chat Completionsではなく**Responses API**が必要です。次のエラーが表示された場合:

> The chatCompletion operation does not work with the specified model

Responsesを使用するために追加のプロバイダーを登録します。

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

## 設定成功時の例

以下は、OpenCodeでMixroute APIを使用した通常の会話の例です。

<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 英語版 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.