9
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Anthoropic, OpenAI, GithubCopilot, GoogleのサブスクでマルチプロバイダOpenCodeを利用する

Last updated at Posted at 2026-01-10

はじめに

ClaudeやOpenAI, GithubCopilotなどのコーディングエージェント(ClaudeCode, Codex, Github Copilot)を使い分けて利用するのが面倒&
Planモードを利用できるコーディングエージェントを利用したいと思い、OpenCodeでマルチプロバイダを設定し、統一的に利用する方法を調べました。

個別サブスクリプションごとのOpenCode設定方法

Anthoropic Subscriptions

1/10現在 AnthoropicがOpenCodeからのサブスクリプションアクセスを制限したため、以下のエラーが表示され、使用できません
This credential is only authorized for use with Claude Code and cannot be used for other API requests.

Claude Pro/Maxサブスクリプションを持っている場合、OAuth認証でOpenCodeを利用できます。

設定手順

  1. OpenCodeを起動し、/connect コマンドを実行
/connect
  1. プロバイダ選択画面で Anthropic を選択

  2. 認証方法で Claude Pro/Max を選択

┌ Select auth method
│
│ Claude Pro/Max
│ Create an API Key
│ Manually enter API Key
└
  1. ブラウザが開くので、Anthropicアカウントで認証

  2. /models コマンドでモデルを選択

/models

OpenAI (ChatGPT Plus/Pro) Subscriptions

ChatGPT Plus/Proサブスクリプションを持っている場合、opencode-openai-codex-auth プラグインを使用してOpenCodeからGPTモデルにアクセスできます。

設定手順

  1. プラグインをインストール
npx -y opencode-openai-codex-auth@latest
  1. OpenCodeを起動し、認証を実行
opencode auth login
  1. ブラウザが開くので、OpenAIアカウント(ChatGPT Plus/Pro)で認証

  2. /models コマンドでモデルを選択

/models

利用可能なモデル

  • GPT-5.2
  • GPT-5.2 Codex
  • GPT-5.1
  • Codex / Codex Max / Codex Mini

GitHub Copilot Subscriptions

GitHub Copilotサブスクリプションを持っている場合、デバイスフロー認証でOpenCodeを利用できます。

設定手順

  1. OpenCodeを起動し、/connect コマンドを実行
/connect
  1. プロバイダ選択画面で GitHub Copilot を選択

  2. 表示されたコードを確認

┌ Login with GitHub Copilot
│
│ https://github.com/login/device
│
│ Enter code: XXXX-XXXX
│
└ Waiting for authorization...
  1. ブラウザで https://github.com/login/device にアクセスし、表示されたコードを入力

  2. GitHubアカウントで認証を完了

  3. /models コマンドでモデルを選択

/models

Google (Gemini/Claude) Subscriptions

Google One AI PremiumやGoogle Workspaceなどのサブスクリプションを持っている場合、Antigravity認証でOpenCodeを利用できます。
このプラグインを使うと、GeminiモデルだけでなくClaude proxyモデル(gemini-claude-opus-4-5-thinkingなど)にもアクセス可能です。

設定手順

  1. プラグインを設定ファイルに追加

~/.config/opencode/config.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-google-antigravity-auth"]
}
  1. OpenCodeを起動し、認証を実行
opencode auth login
  1. プロバイダ選択画面で Google を選択

  2. 認証方法で OAuth with Google (Antigravity) を選択

┌ Select auth method
│
│ OAuth with Google (Antigravity)
│ OAuth with Google (Gemini CLI)
│ Manually enter API Key
└
  1. ブラウザが開くので、Googleアカウントで認証

  2. /models コマンドでモデルを選択

/models

プロバイダー設定例

モデルを利用するには、~/.config/opencode/opencode.json にプロバイダー設定を追加する必要があります:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-google-antigravity-auth"],
  "provider": {
    "google": {
      "npm": "@ai-sdk/google",
      "models": {
        "gemini-3-pro-preview": {
          "id": "gemini-3-pro-preview",
          "name": "3 Pro",
          "reasoning": true,
          "limit": { "context": 1000000, "output": 64000 },
          "modalities": {
            "input": ["text", "image", "video", "audio", "pdf"],
            "output": ["text"]
          },
          "variants": {
            "low": { "options": { "thinkingConfig": { "thinkingLevel": "low", "includeThoughts": true } } },
            "medium": { "options": { "thinkingConfig": { "thinkingLevel": "medium", "includeThoughts": true } } },
            "high": { "options": { "thinkingConfig": { "thinkingLevel": "high", "includeThoughts": true } } }
          }
        },
        "gemini-3-flash": {
          "id": "gemini-3-flash",
          "name": "3 Flash",
          "reasoning": true,
          "limit": { "context": 1048576, "output": 65536 },
          "modalities": {
            "input": ["text", "image", "video", "audio", "pdf"],
            "output": ["text"]
          },
          "variants": {
            "low": { "options": { "thinkingConfig": { "thinkingLevel": "low", "includeThoughts": true } } },
            "medium": { "options": { "thinkingConfig": { "thinkingLevel": "medium", "includeThoughts": true } } },
            "high": { "options": { "thinkingConfig": { "thinkingLevel": "high", "includeThoughts": true } } }
          }
        },
        "gemini-2.5-pro": {
          "id": "gemini-2.5-pro",
          "name": "2.5 Pro",
          "reasoning": true,
          "limit": { "context": 1000000, "output": 64000 },
          "modalities": {
            "input": ["text", "image", "video", "audio", "pdf"],
            "output": ["text"]
          }
        },
        "gemini-2.5-flash": {
          "id": "gemini-2.5-flash",
          "name": "2.5 Flash",
          "reasoning": true,
          "limit": { "context": 1048576, "output": 65536 },
          "modalities": {
            "input": ["text", "image", "video", "audio", "pdf"],
            "output": ["text"]
          }
        },
        "gemini-claude-sonnet-4-5-thinking": {
          "id": "gemini-claude-sonnet-4-5-thinking",
          "name": "Sonnet 4.5",
          "reasoning": true,
          "limit": { "context": 200000, "output": 64000 },
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "variants": {
            "low": { "options": { "thinkingConfig": { "thinkingBudget": 4000, "includeThoughts": true } } },
            "medium": { "options": { "thinkingConfig": { "thinkingBudget": 16000, "includeThoughts": true } } },
            "high": { "options": { "thinkingConfig": { "thinkingBudget": 32000, "includeThoughts": true } } }
          }
        },
        "gemini-claude-opus-4-5-thinking": {
          "id": "gemini-claude-opus-4-5-thinking",
          "name": "Opus 4.5",
          "reasoning": true,
          "limit": { "context": 200000, "output": 64000 },
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "variants": {
            "low": { "options": { "thinkingConfig": { "thinkingBudget": 4000, "includeThoughts": true } } },
            "medium": { "options": { "thinkingConfig": { "thinkingBudget": 16000, "includeThoughts": true } } },
            "high": { "options": { "thinkingConfig": { "thinkingBudget": 32000, "includeThoughts": true } } }
          }
        }
      }
    }
  }
}

マルチプロバイダの活用

プロバイダの切り替え

複数のプロバイダを設定した後は、/models コマンドでいつでもプロバイダやモデルを切り替えることができます。

/models

コマンド実行時の確認を無効化

デフォルトでは、OpenCodeはファイル編集やコマンド実行時にユーザーの確認を求めます。
確認なしで自動実行させるには、~/.config/opencode/opencode.json に以下を追加します:

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "*": "allow",
    "external_directory": "allow"
  }
}
設定 説明
"*": "allow" すべてのツール(bash、edit等)の確認をスキップ
"external_directory": "allow" 作業ディレクトリ外のファイル操作も確認なしで許可

この設定はセキュリティリスクを伴います。すべての操作が確認なしで実行されるため、信頼できる環境でのみ使用してください。

まとめ

Opencodeを使った複数プロバイダの統合利用についてまとめました。
複数のプロバイダを契約したけど、使い分けが面倒な自分には必要な設定ができたので、個人的には満足しています。
Anthoropicのように、サブスクリプションでどこまで使ってよいのかは流動的に変化すると思うのですが、
マルチプロバイダでも使いやすい環境が続くと良いなと思っています。

参考リンク

9
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?