> 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、その他のプロバイダーのモデルを、1つのローカルUIインターフェースで実行する方法を学びましょう [Unsloth](/docs/jp/desktop.md)、LLMを実行・学習するためのオープンソースリポジトリです。ChatGPT/CodexサブスクリプションをUnslothに直接接続することもできます。

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

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

Unslothは独自にサポートしています [プロンプトキャッシュ](#prompt-caching) （精度を落とさずに大量のトークンを節約しつつ）、OpenAIに組み込まれた機能など、プロバイダー固有の機能へのアクセスも維持します [web search](#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/llamacppwounslothnisuru-llama-serverdeggufwosuru.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="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FPTauJusYHSZXfrRVPRRF%2Funsloth_openai_api.gif?alt=media&amp;token=54ae6d0f-57d8-41c5-b40d-168fad73482a" 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="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fcw5I5BX3fx8Kf5LDUwl0%2Funsloth_cloud_provider_setup.gif?alt=media&amp;token=8babf957-7486-4a8d-ab5e-6d3b36a2b3ba" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

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

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

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FgKCJ3zsZzZuDqBAigsfG%2FScreenshot%202026-05-26%20at%201.31.03%E2%80%AFAM.png?alt=media&amp;token=c8df4285-ba69-4091-8978-e4197f6a12d2" alt="" width="563"><figcaption></figcaption></figure>

Unslothは、異なるモデルに対して互換性のある推論レベルと生成コントロールを動的に表示します。
{% endstep %}
{% endstepper %}

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

以下の場合はこの手順を使用します [**llama.cpp**](/docs/jp/tong-he/connections/llamacppwounslothnisuru-llama-serverdeggufwosuru.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="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F4PC8ybPZgdcdhOWkduFR%2Fimage.png?alt=media&amp;token=00956d7e-4d26-462d-b5a4-17cfb9717aaf" alt="" width="375"><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

クリックします **モデルを読み込む** 利用可能なモデルIDを取得します。サーバーが公開していない場合は、モデルIDを手動で入力してください `/models`.

その後、 **プロバイダーを追加** 有効にしたモデルは、以下の **外部** の **モデルを選択** ドロップダウンに表示されます。

### コード実行

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

<div data-with-frame="true"><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F4W9Zq684jCgJy9kGvrkk%2FScreenshot%202026-05-26%20at%206.10.12%E2%80%AFAM.png?alt=media&amp;token=c7b6a106-1a22-4120-a22d-f9ad8a9471c7" alt="" width="563"><figcaption></figcaption></figure></div>

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

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

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fq4csmTX5rS9isMkNkhTX%2FPrompt%20Caching%20Diagram%20(1).png?alt=media&amp;token=ade433bf-5eaf-4146-a266-525a85a6c98d" 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="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FC0Ed4kzN9h6c0ogEn6NT%2Fwebsearch%20api.png?alt=media&amp;token=d3335222-1d9e-4021-9bf9-734c6acf1fc0" alt="" width="563"><figcaption></figcaption></figure></div>

### 画像生成

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

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F5ZLU2BY19MN4yiYLx2Br%2FScreenshot%202026-05-26%20at%206.04.34%E2%80%AFAM.png?alt=media&amp;token=44327a8f-c14d-4541-9a02-f19f375b4326" alt=""><figcaption></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FDQ1bJ5KF8CiyItrfOrIt%2FScreenshot%202026-05-26%20at%206.06.07%E2%80%AFAM.png?alt=media&amp;token=ff6b00bc-0a2f-4375-a454-49429cf839f2" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
