1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude CodeをOpenAIのモデルで利用する

1
Posted at

はじめに

Claude Codeを任意のLLMで実行できる「Claude Code Router」というものの存在を知ったので、最新のOpenAI GPT-5.4で試してみた。

インストール

管理者権限でターミナルを開き、以下を実行する。

npm install -g @musistudio/claude-code-router

設定

~/.claude-code-router/config.json を作成し、以下の内容で保存する。今回はGPT-5.4を使ってみた。

{
    "Providers": [
        {
            "name": "openai",
            "api_base_url": "https://api.openai.com/v1/responses",
            "api_key": "$OPENAI_API_KEY",
            "models": [
                "gpt-5.4"
            ],
            "transformer": {
                "use": [
                    "openai-responses"
                ]
            }
        }
    ],
    "Router": {
        "default": "openai,gpt-5.4"
    }
}

使い方

実行したいフォルダで、まずサーバーを起動する。

ccr restart

その後、以下のコマンドでClaude Codeを実行するだけ。

ccr code

/status コマンドを実行し、以下のように表示されていればOK。
Claude Code Routerに接続されている。

Anthropic base URL: http://127.0.0.1:3456

この状態で実行することで、任意のLLMが利用できます。

まとめ

企業によっては、自社LLMを運営しているケースもあるだろう。
そういった場合には、この使い方で自社LLMを有効利用できるのではないだろうか。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?