> 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エージェント。**

<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 %}

{% hint style="info" %}
APIアクセスは **Unsloth（ベータ版）**&#x306B;含まれています。最新バージョンであることを確認してください。以前のビルドでは外部APIが公開されません。インストールまたは更新については「インストール」を参照してください。
{% endhint %}

### Unslothのインストール

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

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. **APIキーを作成します。** Unslothで、左下の **Unsloth** アバターをクリックし、→ **設定** → **APIキー** →キー名を入力→ **作成**。次の `sk-unsloth-…` 値をコピーします。Unslothで表示されるのは一度だけです。
5. **クライアントをUnslothに向けます。** 次を使用します `http://localhost:PORT` をベースURLとして、さらに `sk-unsloth-…` キーを認証に使います。以下のツールの手順に進んでください。

### 🔑 APIキーの作成

キーは次の場所から作成します **Unsloth → 設定 → APIキー**.

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

<figure><img src="/files/56897ad32966d1081797ea8ccf97a7df82f0a550" alt="" width="375"><figcaption></figcaption></figure>

すべてのキーは次のプレフィックスで始まります `sk-unsloth-` 。同じページからいつでもキーを無効化できます。無効化されたキーで行ったリクエストは次のエラーで失敗します `401 Unauthorized`.

{% hint style="warning" %}
APIキーはパスワードのように扱ってください。キーとUnslothインスタンスへのネットワークアクセスを持つ人は、読み込まれたモデルにリクエストを送信できます。
{% endhint %}

### OpenClawへの接続

OpenClawは設定を次の場所から読み込みます `~/.openclaw/openclaw.json`。次の `models` ブロックを `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` はパスを含まないStudioのオリジンです。OpenClawはAnthropic Messages APIを介してStudioとやり取りし、Anthropic SDKが末尾に `/v1/messages` を自動で追加するため、次を追加しないでください `/v1` ここに（末尾の `/v1` があると、リクエストは次の宛先に送られます `/v1/v1/messages`).
* `api: "anthropic-messages"` は、OpenClawがUnslothの `/v1/messages` エンドポイントと通信するよう指示します。
* `authHeader: true` キーを次の形式で送信します `Authorization: Bearer …`.
* 各モデルの `id` と `name` を、Unslothでモデルを読み込むときに選んだ名前に設定します。
* 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調整](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:

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

The question should be specific, self-contained, and written in natural language.
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.
