> 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.md).

# APIプロバイダーとモデルサーバーをUnslothに接続

OpenAI、Anthropic、Ollama、llama.cpp、vLLM、その他のプロバイダーのモデルを、単一のローカルUIインターフェースから実行する方法を学びましょう。 [Unsloth](/docs/jp/desktop.md)は、LLMの実行と学習のためのオープンソースリポジトリです。ChatGPT/CodexのサブスクリプションをUnslothに直接接続することもできます。

モデルがUnslothの推論機能経由で実行されていても、独自のリモートOpenAI互換エンドポイントで実行されていても、Web検索、コード実行、ディープリサーチなどを含むUnslothの完全なツール群にアクセスさせることができます。

{% columns %}
{% column %}
接続すると、コード実行、ツール呼び出し、画像生成、その他の機能を、ローカルモデルとクラウドモデルの両方で使う同じUnslothチャットインターフェース内で実行できます。

Unslothは独自に [プロンプトキャッシュ](#prompt-caching) をサポートし（精度を落とさずに多くのトークンを節約できます）、OpenAIの組み込み [Web検索](#web-search-and-thinking) や [コード実行](#code-execution).
{% endcolumn %}

{% column %}
{% embed url="<https://github.com/user-attachments/assets/70456395-e016-4273-8256-35adb206267e>" %}
{% endcolumn %}
{% endcolumns %}

### 接続

接続は2つのグループに分かれます。モデルを代わりに実行するホスト済みAPIプロバイダーと、あなたが実行または管理するモデルサーバーです。

**クラウドプロバイダー -** アカウントのAPIキーを使用するホスト済みAPI:

| 接続              | 機能                    | セットアップガイド                                                       |
| --------------- | --------------------- | --------------------------------------------------------------- |
| ChatGPT / Codex | 画像、検索、コード、思考          | [OpenAI →](/docs/jp/tong-he/connections/openai.md)              |
| OpenAI          | 画像、検索、コード、思考          | [OpenAI →](/docs/jp/tong-he/connections/openai.md)              |
| Anthropic       | 画像、検索、コード、思考          | [Anthropic →](/docs/jp/tong-he/connections/anthropic-claude.md) |
| OpenRouter      | 1つのAPIキーで多数のホスト済みモデル。 | [OpenRouter →](/docs/jp/tong-he/connections/openrouter.md)      |

**モデルサーバー -** ローカル、ネットワーク上、またはリモートマシン上で実行される推論サーバー:

| サーバー      | 説明               | ガイド                                                                                    |
| --------- | ---------------- | -------------------------------------------------------------------------------------- |
| Llama.cpp | 効率的なGGUFモデル提供    | [Llama.cpp →](/docs/jp/tong-he/connections/llamacppwounslothnillama-serverdeggufwo.md) |
| vLLM      | 高スループット提供        | [vLLM →](/docs/jp/tong-he/connections/vllm.md)                                         |
| Ollama    | シンプルなローカルモデルサーバー | [Ollama →](/docs/jp/tong-he/connections/ollama.md)                                     |

### クイックスタート

外部プロバイダーのモデルを実行するには、APIキーを追加し、Unslothに表示させるモデルを選択します。この例では、 [OpenAI](https://platform.openai.com/api-keys)を使います。Anthropicや他のプロバイダーでも同じ手順で設定できます。

{% stepper %}
{% step %}

#### Unslothをセットアップ

始める最も簡単な方法は、 [Unsloth Desktop](/docs/jp/desktop.md) アプリをインストールすることです。対応環境は [MacOS](/docs/jp/meru/install/mac.md)、Linux、 [Windows](/docs/jp/meru/install/windows-installation.md), [NVIDIA](/docs/jp/meru/install/pip-install.md), [AMD](/docs/jp/meru/install/amd.md)、Intel、およびCPU構成です。

<a href="https://unsloth.ai/download" class="button primary" data-icon="down-to-bracket">Unslothをダウンロード</a>

* <i class="fa-apple">:apple:</i> [macOS用をダウンロード](https://unsloth.ai/download/mac)
* <i class="fa-windows">:windows:</i> [Windows用をダウンロード](https://unsloth.ai/download/windows)
* <i class="fa-linux">:linux:</i> [Linux用をダウンロード](https://unsloth.ai/download/linux)

または、手動インストールを希望する場合は:

**MacOS、Linux、WSL:**

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

**Windows PowerShell:**

```bash
irm https://unsloth.ai/install.ps1 | iex
```

[こちらを参照](/docs/jp/desktop.md#get-started) して、より詳しい手順を確認してください
{% endstep %}

{% step %}

#### APIを作成

プロバイダーのダッシュボードから新しいAPIキーを作成して、コピーします。

<figure><img src="/files/b461a8a3f822dfe16db3b83490cf51706282b1f5" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Unslothをセットアップ

次に、 [Unsloth](/docs/jp/shii/studio.md)をインストールしてセットアップする必要があります。これにより、UIインターフェースでクラウドモデルを実行できるようになります。 [こちらを参照](/docs/jp/shii/studio/install.md) して、より詳しい手順を確認してください。

{% endstep %}

{% step %}

#### 接続を構成

次に、プロバイダーをUnslothに接続します。

1. 開く **設定** → **接続**を開いてから、 **接続を追加**
2. をクリックします。追加したいプロバイダーを選択し、先ほどコピーしたAPIキーを貼り付けます。
3. クリック **モデルを再読み込み** して、アカウントで利用可能なモデル一覧を更新します。
4. 有効にしたいモデルを選んで、保存を押します。&#x20;

<figure><img src="/files/d41cfa82857300a506b8b393c30cb4f4534c8433" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

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

有効にしたモデルは、 **接続済み** の **モデルを選択** ドロップダウンに表示されます。

<figure><img src="/files/65e30336af1ddc159ab502cdbf8d12011abc4b99" alt="" width="563"><figcaption></figcaption></figure>

Unslothは、モデルごとに互換性のある推論レベルと生成制御を動的に公開します。
{% endstep %}
{% endstepper %}

### モデルサーバーに接続

このフローを使用するのは [**llama.cpp**](/docs/jp/tong-he/connections/llamacppwounslothnillama-serverdeggufwo.md), [**vLLM**](/docs/jp/tong-he/connections/vllm.md)、および [**Ollama**](/docs/jp/tong-he/connections/ollama.md)です。接続したいサーバーを起動するか、場所を確認してください。 &#x20;

{% tabs %}
{% tab title="llama.cpp " %}
起動 `llama-server` で、提供したいモデルを使います:

```bash
llama-server \
  --model /path/to/model.gguf \
  --host 0.0.0.0 \
  --port 8080
```

これにより、以下のAPIエンドポイントが公開されます: `http://localhost:8080/v1`

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

```bash
--api-key 1234-myapi-key
```

{% endtab %}

{% tab title="vLLM" %}
起動 `vLLM` サーバーで、提供したいモデルを使います:

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

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

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

これにより、以下のAPIエンドポイントが公開されます: `http://localhost:8000/v1`
{% endtab %}

{% tab title="Ollama" %}
起動 `Ollama`、その後、使いたいモデルを取得します:

```bash
ollama serve
ollama pull qwen3:14b
```

これにより、以下のAPIエンドポイントが公開されます: `http://localhost:11434/v1`
{% endtab %}
{% endtabs %}

{% columns %}
{% column %}
これでモデルサーバーに接続できます。 **設定 → 接続**を開いてから、 **プロバイダーを追加**.

llama.cpp、vLLM、またはOllamaを選択してから、サーバーの **ベースURL**.

* llama.cppの例: `http://localhost:8080/v1`
* Ollamaの例: `http://localhost:11434/v1`
  {% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/2e4be83196d0333412f302b40abcd40f62d682e9" alt="" width="375"><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

クリック **モデルを読み込む** をクリックして利用可能なモデルIDを取得するか、サーバーが `/models`.

を公開していない場合は、モデルIDを手動で入力します。 **その後、** 有効にしたモデルは、 **プロバイダーを追加** の **モデルを選択** ドロップダウンに表示されます。

### 外部

コード実行\
\
有効にすると、対応するOpenAIおよびAnthropicのモデルは、プロバイダーのサンドボックス内でコードを実行し、問題の解決、データ分析、ファイル操作ができます。\
\
Anthropicのモデルは、Claudeのプロバイダー側コード実行ツールを使用します。OpenAIは再利用可能なコンテナを使用し、作成、削除、 **外部** 設定から選択できます。新しいスレッドで同じコンテナを選択すると、そのファイルと状態を引き継いで続行できます。

<div data-with-frame="true"><figure><img src="/files/2cd41c9642bb54fa238bef901d5c969e39c09d30" alt="" width="563"><figcaption></figcaption></figure></div>

### プロンプトキャッシュ

プロンプトキャッシュは、同じ長いプレフィックスをリクエストで再利用する際の遅延とコストを削減します。OpenAI、Anthropic、llama.cppを含む、互換性のあるプロバイダーとサーバーでサポートされています。サイドパネルの **プロンプトキャッシュ** 設定を使って、対応する接続のキャッシュ動作を制御します。

<figure><img src="/files/5bcf6fff0534310d56b7bea1b8e416dab545b5b1" alt="" width="375"><figcaption></figcaption></figure>

llama.cppでは、プロンプトキャッシュはデフォルトで有効になっており、起動時に無効化できます `llama-server` 以下を使って:

```bash
--no-cache-prompt
```

### Web検索と推論

プロバイダー側のWeb検索は、OpenAI、Anthropic、OpenRouter、Mistral、Gemini、Kimiの対応モデルで利用できます。Think制御は選択したモデルに応じて動作を変えます。オン/オフ切り替えを使うモデルもあれば、推論努力モデルではモデル固有の思考レベルを使うものもあります。

<div data-with-frame="true"><figure><img src="/files/0dbb7389f8d19ef42407933ecd60c6ec7f8ab667" alt="" width="563"><figcaption></figcaption></figure></div>

### 画像生成

GPTやGeminiと同様に、Unslothも画像生成をサポートしています。「画像を編集」ボタンをクリックして新しいプロンプトを入力すれば、画像を直接編集して、改善または再生成できます。画像は要求時に自動生成されますが、この動作はオフに切り替えることもできます。ダウンロードボタンもあり、元のフル解像度で画像を保存できます。

<div><figure><img src="/files/608f1d427d7bb7f6bcba5b41e56c5f6f91b61e0f" alt=""><figcaption></figcaption></figure> <figure><img src="/files/d7ee45546a10e40d4cb4372b481998df41fbb90e" alt=""><figcaption></figcaption></figure></div>

### トラブルシューティング

プロバイダーへの接続に失敗した場合は、APIキーが選択したプロバイダーのものか、そして選択したモデルへのアクセス権があるかを確認してください。

をクリックした後にモデルが表示されない場合は **モデルを再読み込み**、そのモデルがアカウントで利用できない可能性があります。Unslothのデフォルトモデル一覧を使うか、別のモデルを選ぶことができます。


---

# 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.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.
