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

このガイドでは、ローカルでオープンLLMを使用できるようにします **OpenClaw を Unsloth に接続することで**。OpenClaw は **オープンソースの AI エージェント** であり、プロジェクト全体でタスクを実行するためにモデルへ接続するインターフェースです。

OpenClaw は、次を通して接続することで任意のローカルモデルで動作できます **Unsloth の OpenAI 互換 API**：DeepSeek、Qwen、Gemma などを含みます。OpenClaw はクライアントとして機能し、Unsloth はローカル API 経由でモデルを読み込み、提供します **ローカル 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（ベータ版）**&#x306E;一部です。最新バージョンを使っていることを確認してください。以前のビルドでは外部 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/2552df3313dace7735a365c0b734bbb215081dd4" 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/v1",
        "apiKey": "sk-unsloth-xxxxxxxxxxxx",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "unsloth/Qwen3.6-27B-GGUF",
            "name": "unsloth/Qwen3.6-27B-GGUF"
          }
        ],
        "authHeader": true
      }
    }
  }
}
```

{% endcode %}

**注意：**

* `baseUrl` は必ず `/v1`.
* `api: "anthropic-messages"` は、OpenClaw に Unsloth の `/v1/messages` エンドポイントと通信するよう指示します。
* `authHeader: true` は、キーを次の形式で送信します `Authorization: Bearer …`.
* 各モデルの `id` と `name` を、Unsloth でモデルを読み込むときに選んだ名前に設定します。
* リモートマシン上で Unsloth を実行している場合は、 `localhost:8888` をそのマシンのアドレスに置き換えてください（例： `http://10.0.0.42:8888/v1`).


---

# Agent Instructions: 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.
