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

# OpenClawでローカルAIモデルを実行する方法

このガイドでは、ローカルでオープンLLMを使う方法を **Unsloth に接続して OpenClaw で行う方法を紹介します。**。OpenClaw は **オープンソースのAIエージェント** インターフェースで、モデルに接続してプロジェクト全体のタスクを実行します。OpenClaw は、 **Unsloth の OpenAI 互換 API**を通じて接続することで、DeepSeek、Qwen、Gemma など、あらゆるローカルモデルと連携できます。

OpenClaw はクライアントとして動作し、Unsloth は **ローカルAPI**経由でモデルを読み込み、提供します。セットアップ後は、OpenClaw が Unsloth を通じてローカルモデルに対して実行され、直接 **AIエージェント** このチュートリアルでは、 [Qwen3.6](/docs/jp/moderu/qwen3.6.md).

<a href="/pages/1040e353b555381fe4f250e6417f1e51602685b2#connecting-to-openclaw" class="button primary" data-icon="lobster">OpenClaw への接続</a><a href="/pages/1040e353b555381fe4f250e6417f1e51602685b2#quickstart" class="button primary">クイックスタート</a>

{% hint style="info" %}
&#x20;このチュートリアルでは、 `unsloth/Qwen3.6-27B-GGUF` を Unsloth で読み込み、OpenClaw からアクセスします。別のモデルを使いたい場合は、Unsloth でそのモデルを読み込み、設定を更新してください。
{% endhint %}

### OpenClaw のインストール

{% tabs %}
{% tab title="macOS、Linux、WSL" %}
公式インストーラーを使って OpenClaw をインストールします:

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

これで OpenClaw がセットアップされ、初期設定を案内されます。
{% endtab %}

{% tab title="Windows（PowerShell）" %}
公式インストーラーを使って OpenClaw をインストールします:

`iwr -useb https://openclaw.ai/install.ps1 | iex`

これで OpenClaw がセットアップされ、初期設定を案内されます。
{% endtab %}
{% endtabs %}

### ⚡ クイックスタート

OpenClaw をインストールしたら、OpenClaw がローカルモデルの推論を提供して実行できるようにするため、Unsloth Studio をインストールする必要があります。

1. **インストールまたは更新** [**Unsloth Studio**](/docs/jp/xin-zhe/studio.md)**.** 旧バージョンでは外部APIが公開されません。インストールを参照してください。
2. **Unsloth を起動します。** 起動するポートは通常 `8000` または `8888`です。ターミナル出力とブラウザの URL（`http://localhost:PORT`).
3. **モデルを読み込みます。** クリック **New Chat**をクリックし、モデル（GGUF）を選択または検索して、読み込みが完了するまで待ちます。
4. **OpenClaw を接続します。** 実行します `unsloth start openclaw` を実行すると、読み込まれた Unsloth モデルを別の管理された環境で使って OpenClaw を起動できます。通常の OpenClaw の設定は変更されません。

### ⚙️ OpenClaw を起動するには `unsloth start`

OpenClaw は、Unsloth Studio ですでに実行中のモデルに接続することも、Unsloth が実行されていない場合に自動的に起動することもできます。

実行中の Unsloth インスタンスに接続する

Unsloth Studio にモデルが読み込まれたら、次を実行します:

```bash
unsloth start openclaw
```

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

Unsloth は、別の管理された環境内で、Unsloth プロバイダー、モデル、コンテキスト長を設定したローカル TUI モードで OpenClaw を起動します。通常の OpenClaw のセットアップは変更されません。

OpenClaw が開いたら、次のようなタスクを与えます:

```
このリポジトリを調べて、1文で要約してください: https://github.com/unslothai/unsloth
```

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

#### モデルを自動的に起動する

Unsloth Studio がまだ実行されていない場合は、モデルIDを指定します:

```bash
unsloth start openclaw --model unsloth/Qwen3.6-27B-GGUF
```

Unsloth がモデルを起動し、OpenClaw を立ち上げ、終了時に一時サーバーを停止します。\
\
OpenClaw の状態を保持して後で同じセッションに戻るには、 `--persist` を追加し、セッションキーを選択します:

```bash
unsloth start openclaw \
  --model unsloth/Qwen3.6-27B-GGUF \
  --persist \
  agent --local \
  --session-key my-session \
  --message "このリポジトリを調べてください"
```

同じセッションキーを使って後で続行します:

```bash
unsloth start openclaw \
  --model unsloth/Qwen3.6-27B-GGUF \
  --persist \
  agent --local \
  --session-key my-session \
  --message "続行"
```

完全な [unsloth start](/docs/jp/tong-he/unsloth-start.md) 名前付きセッション、モデル読み込み、リモート Unsloth サーバー、詳細オプションのリファレンスを参照してください。

このガイドの残りでは、OpenClaw プロバイダーの手動設定を説明します。

### OpenClaw プロバイダーの手動設定

### 🔑 APIキーの作成

キーは次から作成します **Unsloth → Settings → API Keys**.

1. サイドバーを開き、左下の **Unsloth** アバターをクリックします。
2. 移動します **設定** → **API Keys**.
3. わかりやすい名前を入力します（例： `claude-code-macbook`).
4. *（任意）* 有効期限を設定します。
5. クリック **作成**.
6. **キーはすぐにコピーしてください。** Unslothはハッシュのみを保存するため、再表示はできません。

<div data-with-frame="true"><figure><img src="/files/56897ad32966d1081797ea8ccf97a7df82f0a550" alt="" width="375"><figcaption></figcaption></figure></div>

すべてのキーは次の接頭辞で始まります： `sk-unsloth-` です。同じページからいつでもキーを無効化できます。無効化されたキーでのリクエストは `401 Unauthorized`.

### OpenClaw への接続

OpenClaw は設定を次から読み込みます `~/.openclaw/openclaw.json`。 `モデル` ブロックを追加（またはマージ）し、 `unsloth` Unsloth の Anthropic Messages API を指す provider を設定します。

<div data-with-frame="true"><figure><img src="/files/6588de3e9a6a888cfa2c27c6b7d4df77a7d9627d" alt="" width="375"><figcaption></figcaption></figure></div>

{% code title="\~/.openclaw/openclaw\.json" %}

```json
{
  "models": {
    "mode": "merge",
    "providers": {
      "unsloth": {
        "baseUrl": "http://localhost:8888",
        "apiKey": "sk-unsloth-xxxxxxxxxxxx",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "unsloth/Qwen3.6-27B-GGUF",
            "name": "unsloth/Qwen3.6-27B-GGUF"
          }
        ],
        "authHeader": true
      }
    }
  }
}
```

{% endcode %}

**注意:**

* `baseUrl` は、パスを含まない Unsloth のオリジンです。OpenClaw は Anthropic Messages API を介して Unsloth と通信し、Anthropic SDK が `/v1/messages` を自動で付加するため、ここに `/v1` を追加しないでください（末尾の `/v1` だとリクエストが `/v1/v1/messages`).
* `api: "anthropic-messages"` は、OpenClaw に Unsloth の `/v1/messages` エンドポイントと通信するよう指示します。
* `authHeader: true` は、キーを `Authorization: Bearer …`.
* として送信します。 `id` と `各モデルの` name
* を、Unsloth でモデルを読み込むときに選んだ名前に設定します。 `localhost:8888` をそのマシンのアドレスに置き換えます（例: `http://10.0.0.42:8888`).

### 任意: モデルの挙動を設定する

OpenClaw は Unsloth で実行されているモデル経由で接続します。ランタイム設定はサーバー起動時に構成できます。

```bash
# デフォルトの生成動作を設定（--disable-tools は OpenClaw 独自のツールをそのまま通します）
unsloth run \\
  --model unsloth/gemma-4-26B-A4B-it-GGUF \
  --disable-tools \
  --reasoning off \
  --temp 0.6
```

{% hint style="warning" %}
使用 `--disable-tools` OpenClaw（または任意の外部コーディングエージェント）を動かすときに使います。既定では、Unsloth Studio は独自のサーバー側ツールを実行するため、エージェントのツール呼び出しは吸収され、OpenClaw は応答しますがファイルは編集しません。 `--disable-tools` をパススルーに切り替えるので、OpenClaw 独自のツールが使われます。
{% endhint %}

使用 `--reasoning off` で思考をオフにするか、 `--reasoning on` で、推論に対応したモデルで思考をオンにします。

```bash
# 他のデバイスからの接続を許可する
unsloth run \\
  --model unsloth/gemma-4-26B-A4B-it-GGUF \
  -H 0.0.0.0 \\
  -p 8888
```

これによりサーバーは `0.0.0.0:8888`で起動し、ローカルネットワーク上の他のデバイスが接続できるようになります。

より高度なランタイム設定については、メインの [API tuning](https://unsloth.ai/docs/basics/api#unsloth-run-command) セクションを参照してください。


---

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