テーマ
言語

OpenCode

~/.config/opencode/opencode.json を使用して GetVibe API で OpenCode を設定します。baseURL が getvibeapi.com/v1 の OpenAI互換プロバイダーです。

OpenCode はターミナル上でエージェント型コーディングを行うための npm パッケージです。プロバイダーは ~/.config/opencode/opencode.json で設定します。

すべてのモデルを含む既成の設定

OpenCode は /v1/models からコンテキストサイズを読み込みません。手動で追加したモデルはコンテキストが 0 と表示され、履歴は適切に圧縮されません。数値を手入力する代わりに、生成された設定をダウンロードしてください。これは当社のカタログから構築されており、公開されているすべてのモデルについて名前、コンテキスト、出力上限、画像 / 推論 / ツールのフラグが含まれています。キーは含まれず、{env:GETVIBE_API_KEY} の参照のみです。

# macOS / Linux — a fresh config with every model and its context
mkdir -p ~/.config/opencode
curl -fsSL https://getvibeapi.com/api/integrations/opencode.json -o ~/.config/opencode/opencode.json
# Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.config\opencode" | Out-Null
Invoke-WebRequest https://getvibeapi.com/api/integrations/opencode.json -OutFile "$HOME\.config\opencode\opencode.json"

opencode.json がすでにカスタマイズされている場合は、上書きしないでください — provider ブロックのみを置き換え、残りはそのままにします:

# Already have an opencode.json — replace only the provider block (needs jq)
cd ~/.config/opencode && cp opencode.json opencode.json.bak
curl -fsSL https://getvibeapi.com/api/integrations/opencode.json -o provider.json
jq --slurpfile pv provider.json '.provider = ((.provider // {}) + $pv[0].provider)' opencode.json.bak > opencode.json
# Only the models you need (comma-separated IDs); ?variants=1 adds pinned channels too
curl -fsSL "https://getvibeapi.com/api/integrations/opencode.json?models=claude-opus-5.5,openai/gpt-6.1-sol"
カタログは変化します。新しいモデルが現れたら、同じコマンドをもう一度実行してください。手入力したモデルエントリは削除してください。そうしないと、ピッカーにコンテキスト 0 の重複が表示されます。

opencode.jsonを手動で編集

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "getvibe": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "GetVibe",
      "options": {
        "baseURL": "https://getvibeapi.com/v1",
        "apiKey": "{env:GETVIBE_API_KEY}"
      },
      "models": {
        "gpt-6.1-sol": {
          "name": "GPT-6.1 Sol",
          "attachment": true,
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          }
        },
        "claude-opus-5.5": {
          "name": "Claude Opus 5.5",
          "attachment": true,
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          }
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash",
          "attachment": true,
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          }
        },
        "kimi-k3.1-pro": {
          "name": "Kimi K3.1 Pro",
          "attachment": false,
          "modalities": {
            "input": [
              "text"
            ],
            "output": [
              "text"
            ]
          }
        }
      }
    }
  },
  "model": "getvibe/gpt-6.1-sol"
}

OpenCode を起動する前に GETVIBE_API_KEY を設定し、同じウィンドウから起動してください。macOS/Linux では export GETVIBE_API_KEY="sk-pv-…"、Windows では setx GETVIBE_API_KEY "sk-pv-…" を実行して新しい PowerShell ウィンドウを開きます。この変数がないと、OpenCode は空のキーを送信し、401「invalid API key」が返されます。変数を使いたくない場合は、apiKey フィールドの {env:GETVIBE_API_KEY} をキーそのものに置き換えてください。

models には、必要な公開モデル ID のみを列挙します。完全なリストは カタログ にあります。通常の使用では、:suffix を付けずにベア名を記述してください。サフィックスを付けると1つのチャネルに固定され、正常なチャネルへの自動切り替えが無効になります。
画像には "attachment": true が必要です。OpenCode はモデル機能を models.dev レジストリから取得しますが、このレジストリに GetVibe は掲載されていないため、空の {} として宣言されたモデルは添付ファイルを受け付けないものとして扱われ、OpenCode は画像なしでリクエストを送信します。するとモデルは、実際にはビジョンを持っているにもかかわらず、画像が見えないと正直に答えます。カタログ で画像入力を示すすべてのモデルに対して attachment と modalities を追加してください。他の公開されている連携も確認しました。Cline、Cursor、Roo Code、Kilo Code、Aider、Continue のサンプルにはモデル機能の個別マップが存在しないため、この OpenCode 固有の設定がそれらの設定に欠けているわけではありません。
OpenCode + GetVibe API — opencode.json プロバイダー | GetVibe API