> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/jp/tong-he/connections/vllm.md).

# ローカルチャット推論のためにvLLMをUnslothに接続

接続方法を学ぶ **vLLM を** [**Unsloth**](https://github.com/unslothai/unsloth) vLLM の **OpenAI 互換 API を使って** オープンソースの UI チャットインターフェース内で、モデルを提供し、ローカルでそれらとチャットできるようにします。このガイドでは、vLLM のインストール、ローカル vLLM サーバーの起動、API ベース URL の設定、利用可能なモデル ID の読み込み、ホストされた vLLM モデルの選択までを説明します。

最後まで進めると、vLLM で提供されるモデルがローカルモデルと並んで表示され、UI チャットインターフェースから外部 LLM 推論を高速かつ柔軟に実行できるようになります。

### セットアップ

{% stepper %}
{% step %}

#### vLLM をインストールする

まず vLLM をインストールして、 `vllm serve` コマンドを実行できるようにします。公式の [vLLM インストールガイド](https://docs.vllm.ai/en/stable/getting_started/installation/) を、お使いのプラットフォームとハードウェアに合わせて参照してください。

インストール後、ターミナルで vLLM が動作することを確認します: `vllm --help`
{% endstep %}

{% step %}

#### モデルを選択する

vLLM は Hugging Face のモデルを提供します。

たとえば、Unsloth モデルで vLLM サーバーを起動します:

```bash
vllm serve unsloth/gemma-4-26B-A4B-it 
\ --dtype auto
```

これにより、次の API エンドポイントが公開されます:

`http://localhost:8000/v1`

API キーを必須にするには、次を追加します:

```bash
--api-key token-abc123
```

{% endstep %}

{% step %}

#### vLLM を Unsloth に接続する

開く **設定 → 接続**、次にクリック **接続を追加**.

選択 **vLLM**を選択し、サーバー情報を入力します。

<figure><img src="/files/151e0d981670443b19b0a057c336d0f13362292a" alt=""><figcaption></figcaption></figure>

vLLM サーバーの詳細を入力してください:

* **API キー:** vLLM を --api-key 付きで起動していない限り空欄のままにします
* **ベース URL:** 例: <http://localhost:8000/v1>
* **推論モデル:** 提供されるモデルが思考をサポートしている場合はこれを有効にします
* **モデル ID:** クリック **モデルを読み込む**、またはカスタム ID を手動で入力します

をクリックすると **接続を追加**、有効にしたモデルが次の下に表示されます **接続** の下にある OpenRouter モデルを選択します。
{% endstep %}

{% step %}

#### チャットの準備完了

接続を保存すると、vLLM モデルが次の下に表示されます **接続済み** モデルのドロップダウンで。選択すると、vLLM サーバー経由でチャットを開始できます。

<figure><img src="/files/49d86cce901730ce1c33e4485bf50cf00c5d575c" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
vLLM サーバーの応答が遅い場合（特にモデルの読み込み中）は、タイムアウトを調整できます:

```bash
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST=30
```

{% endhint %}
{% endstep %}
{% endstepper %}

### 一般的な vLLM 引数

上の例では、基本的な提供設定を使用しています。モデルやハードウェアに応じて、さらに vllm serve 引数を追加できます。

一般的なオプションには次が含まれます:

```bash
vllm serve unsloth/gemma-4-26B-A4B-it \
  --dtype auto \
  --host 0.0.0.0 \
  --port 8000 \
  --api-key token-abc123 \
  --max-model-len 8192 \
  --gpu-memory-utilization 0.9
```

vLLM サーバー引数の完全な一覧については、公式の vLLM の [OpenAI 互換サーバー](https://docs.vllm.ai/en/stable/serving/openai_compatible_server/) ドキュメントを参照してください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://unsloth.ai/docs/jp/tong-he/connections/vllm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
