> 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は公開されません。インストール方法についてはInstallationを参照してください。
{% endhint %}

### Unslothのインストール

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

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

1. **インストールまたは更新** [**Unsloth Studio**](/docs/jp/xin-zhe/studio.md)**.** 以前のバージョンでは外部APIは公開されません。Installationを参照してください。
2. **Unslothを起動します。** 起動時のポート番号は通常 `8000` または `8888`です。ターミナル出力とブラウザのURL（`http://localhost:PORT`).
3. **モデルを読み込みます。** クリック **New Chat**を選び、モデル（GGUF）を選択または検索して、読み込みが完了するのを待ちます。
4. **APIキーを作成します。** Unslothで、左下の **Unsloth** アバターをクリック → **Settings** → **API Keys** → キー名を入力 → **Create**。次をコピーします。 `sk-unsloth-…` 表示された値です。Unslothでは一度しか表示されません。
5. **クライアントをUnslothに向けます。** 次を使用します `http://localhost:PORT` をベースURLとして、また `sk-unsloth-…` 認証用のキーを使用します。以下のツール向け手順に進んでください。

### 🔑 APIキーの作成

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

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

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

すべてのキーは `sk-unsloth-` というプレフィックスで始まります。キーは同じページからいつでも取り消せます。取り消されたキーで行われたリクエストは次で失敗します `401 Unauthorized`.

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

### OpenClawへの接続

OpenClawは設定を次から読み込みます `~/.openclaw/openclaw.json`。次の `models` ブロックを追加（またはマージ）し、 `unsloth` プロバイダーを追加して、UnslothのAnthropic Messages APIを指すようにします。

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