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

# Unsloth Start を使ってローカル LLM でコーディングエージェントを実行する

Unsloth を使えば接続できます [Claude Code](/docs/jp/ji-chu/claude-code.md), [Codex](/docs/jp/ji-chu/codex.md)、Hermes、OpenCode、その他のコーディングエージェントを、ローカルモデルに接続できます。接続には `unsloth start` コマンドを使います。ワークフロー全体を自分のハードウェア上でオフライン実行できます。 [Unsloth](/docs/jp/desktop.md) は起動のたびに、エンドポイント、API キー、プロバイダー、モデル、コンテキスト長を自動で設定するため、変更せずに好みのエージェントを使えます。このガイドでは、オフライン利用のためにコマンドラインからモデルを起動し、Unsloth に接続する方法を紹介します。

{% columns %}
{% column width="58.333333333333336%" %}

### クイックスタート

まず、 [Unsloth がインストール済みである](/docs/jp/xin-zhe/studio/install.md)ことを確認してください。次に Unsloth を開いてモデルを読み込み、プロジェクトフォルダへ移動し、ターミナルで次のコマンドを実行します:

```bash
unsloth start claude
```

次のいずれかのエージェントに `claude` を置き換えられます:
{% endcolumn %}

{% column width="41.666666666666664%" %}

<figure><img src="/files/c7759bdcfceef3f51b87d20f4c8b15da1a3a0ab1" alt=""><figcaption><p>Qwen3.5 を使ってローカルで動作している Claude Code。</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

| エージェント                                                             | コマンド                     |
| ------------------------------------------------------------------ | ------------------------ |
| <i class="fa-claude">:claude:</i> Claude Code                      | `unsloth start claude`   |
| <i class="fa-openai">:openai:</i> OpenAI Codex                     | `unsloth start codex`    |
| <i class="fa-caduceus">:caduceus:</i> Hermes エージェント                | `unsloth start hermes`   |
| <i class="fa-lobster">:lobster:</i> OpenClaw                       | `unsloth start openclaw` |
| <i class="fa-rectangle-vertical">:rectangle-vertical:</i> OpenCode | `unsloth start opencode` |

Unsloth は一時的またはセッション限定のプロバイダー設定を使います。エージェントの通常の設定ファイルに Unsloth プロバイダーを追加することはありません。

{% hint style="info" %}
Codex では現在、次を通じて提供される GGUF モデルが必要です: `llama-server` バックエンド。
{% endhint %}

### エージェントガイド

<table data-column-title-hidden data-view="cards"><thead><tr><th>タイトル</th><th data-hidden data-card-cover data-type="image">カバー画像</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Claude Code</td><td><a href="/files/7ef4baa9756f0d0eba90f1b0962117d2aea0cde5">/files/7ef4baa9756f0d0eba90f1b0962117d2aea0cde5</a></td><td><a href="/pages/ee610b22aa43d29d8415fd27eb7de15ba88f7385">/pages/ee610b22aa43d29d8415fd27eb7de15ba88f7385</a></td></tr><tr><td>Codex</td><td><a href="/files/dd7f63ba7d07d39bc79371593b82582ebfb426f8">/files/dd7f63ba7d07d39bc79371593b82582ebfb426f8</a></td><td><a href="/pages/c87896ff7159620f4c01bb39fe9df1fd1a55274e">/pages/c87896ff7159620f4c01bb39fe9df1fd1a55274e</a></td></tr><tr><td>Hermes エージェント</td><td><a href="/files/7078b5788c811f368a3a4ec2620b2d0e1fcdcf9c">/files/7078b5788c811f368a3a4ec2620b2d0e1fcdcf9c</a></td><td><a href="/pages/a624ad2fe3b378ac0bbfee74cfdda2550bac8b5d">/pages/a624ad2fe3b378ac0bbfee74cfdda2550bac8b5d</a></td></tr><tr><td>OpenClaw</td><td><a href="/files/1202a08b7239964706e5dc2fd64d2d91724c1515">/files/1202a08b7239964706e5dc2fd64d2d91724c1515</a></td><td><a href="/pages/1040e353b555381fe4f250e6417f1e51602685b2">/pages/1040e353b555381fe4f250e6417f1e51602685b2</a></td></tr><tr><td>OpenCode</td><td><a href="/files/daee6bca3e6575290d2f6ab7e408c2b847e5db75">/files/daee6bca3e6575290d2f6ab7e408c2b847e5db75</a></td><td><a href="/pages/3864bcb37ba6a47277fdce43a7f1d4bc977d7edb">/pages/3864bcb37ba6a47277fdce43a7f1d4bc977d7edb</a></td></tr><tr><td>Unsloth API</td><td><a href="/files/3dd856b45237ca244d802e9e4692647d86e01397">/files/3dd856b45237ca244d802e9e4692647d86e01397</a></td><td><a href="/pages/664bab64c0c5cdbe1a11fa3ba21ffe4c16cf0f52">/pages/664bab64c0c5cdbe1a11fa3ba21ffe4c16cf0f52</a></td></tr></tbody></table>

### コマンドラインからモデルを読み込む

<div align="center"><figure><img src="/files/5698f1dbcd91c010b732169576825b6810e3fc4f" alt="unsloth start launching Codex with a local GGUF model in Unsloth Studio" width="563"><figcaption><p>Unsloth start はモデルを見つけるか読み込み、コーディングエージェントを設定して、現在のプロジェクトから起動します。</p></figcaption></figure></div>

エージェントを起動しながらモデルを選択して読み込むことができます:

{% hint style="success" %}
設定/サンプリングフラグが設定されていない場合、Unsloth はコンテキスト長、temperature などを含む、そのモデルに最適な推奨設定を自動で選択します。
{% endhint %}

```bash
unsloth start claude \
  --model unsloth/Qwen3.8-27B-GGUF:UD-Q4_K_XL \
  --context-length 32768 \
  --temp 1.0 \
  --top-p 0.95 \
  --top-k 20 \
  --min-p 0.0 \
  --reasoning-effort medium
```

この `:UD-Q4_K_XL` サフィックスは GGUF の量子化を選択します。

デフォルトのローカルアドレスでは、 `--model` を渡すと `unsloth start` 、Unsloth Studio がまだ起動していない場合に一時サーバーを起動できます。一時サーバーはエージェント終了時に停止します。Unsloth がすでに起動している場合は、そのサーバーに接続し、そのまま起動状態を維持します。

以下に、ローカル LLM に接続されるエージェントの例を示します:

{% columns %}
{% column width="50%" %}

<div align="left"><figure><img src="/files/4ceaf56f6e47d9b7a34e9420241dda18aedf22c7" alt=""><figcaption><p>OpenCode</p></figcaption></figure></div>

{% endcolumn %}

{% column width="50%" %}

<div align="left"><figure><img src="/files/f927130a986e0b454262f1e4747f140e156094e0" alt=""><figcaption><p>Hermes</p></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column width="33.33333333333333%" %}

<figure><img src="/files/606967d8efb60bb93109aec494909f014f54d181" alt=""><figcaption><p>Claude Code</p></figcaption></figure>
{% endcolumn %}

{% column width="33.33333333333333%" %}

<figure><img src="/files/60147ccc35c4af8d9cdd8b8ff63ea76e2258f81e" alt=""><figcaption><p>Codex</p></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/e6567f737aae9a6c4728944b0e3edf2e33a3056e" alt=""><figcaption><p>Openclaw</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### リモートの Unsloth サーバーに接続する

エージェントを起動する前に、Unsloth の URL と API キーを設定します:

```bash
export UNSLOTH_STUDIO_URL=https://studio.example.com
export UNSLOTH_API_KEY=sk-unsloth-...
unsloth start claude
```

キーは `--api-key`でも渡せます。検証済みのローカル Unsloth サーバーでは、 `unsloth start` API キーを自動で作成するか再利用します。

### フラグ + オプション

設定/サンプリングフラグが設定されていない場合、Unsloth はコンテキスト長、temperature などを含む、そのモデルに最適な推奨設定を自動で選択します。

それ以外の場合は、これらのフラグを必要に応じてカスタマイズできます:

| オプション                                        | 機能                                                                                              |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `--model`, `-m`                              | モデルを選択します。指定しない場合は、Unsloth が報告した最初のモデルを使います。                                                    |
| `--api-key`                                  | Unsloth API キーを指定します。 `UNSLOTH_API_KEY`.                                                        |
| `--launch` / `--no-launch`                   | エージェントを起動するか、生成された環境とコマンドを表示します。                                                                |
| `--serve` / `--no-serve`                     | ローカルサーバーの自動起動を許可または禁止します。                                                                       |
| `--gguf-variant`                             | GGUF の量子化バリアントを選択します。                                                                           |
| `--reasoning`                                | チャットでの推論を on、off、auto から選びます。auto はモデルのチャットテンプレートに従い、通常は on になります。                              |
| `--reasoning-effort`                         | モデルのチャットテンプレートに渡す推論強度です。例: medium。レベルはモデルごとに異なるため、そのモデルが受け付けるものを使ってください。未設定の場合はテンプレート既定値が使われます。 |
| `--context-length`, `--max-seq-length`       | モデル読み込み時に要求するコンテキスト長を設定します。                                                                     |
| `--load-in-4bit` / `--no-load-in-4bit`       | GGUF 以外の Hugging Face モデルに対する 4bit 読み込みを制御します。                                                  |
| `--tensor-parallel` / `--no-tensor-parallel` | マルチ GPU システムでの tensor-parallel GGUF 読み込みを有効または無効にします。                                           |
| `--persist` / `--no-persist`                 | 該当する場合は、Unsloth が管理するエージェントのホームを保持します。                                                          |
| `--yolo`                                     | 選択したエージェントの非プロンプトモードまたは信頼モードを使用します。                                                             |
| `-h`, `--help`                               | コマンドのヘルプを表示します。                                                                                 |

読み込みオプションは、Unsloth が要求されたモデルを読み込む、または整合させる必要がある場合に使用されます。

### 通常のコマンドをエージェントに渡す

Unsloth のオプションではない引数は、選択したエージェントに渡されます:

```bash
unsloth start claude --continue
unsloth start codex --persist resume --last
unsloth start opencode run --continue "Continue the previous task"
unsloth start pi --persist --continue
```

ネイティブのオプション一覧は、エージェント自身のヘルプコマンドを使って確認してください。

### セッションと `--persist`

`--persist` 管理ストレージを保持します。これ自体では会話を再開しないため、エージェントの通常の再開コマンドも渡してください。

| エージェント          | 必要ですか `--persist`?                 | 再開の例                                                             |
| --------------- | ---------------------------------- | ---------------------------------------------------------------- |
| Claude Code     | いいえ。Claude は通常のセッションストアを使います。      | `unsloth start claude --continue`                                |
| OpenAI Codex    | はい。管理される Codex のホームは既定で一時的です。      | `unsloth start codex --persist resume --last`                    |
| OpenClaw        | はい。管理される設定、ワークスペース、セッションは既定で一時的です。 | 使用 `--persist` 同じネイティブのセッション ID で。                               |
| OpenCode        | いいえ。OpenCode は通常のセッションストアを使います。    | `unsloth start opencode run --continue "Continue"`               |
| Hermes エージェント   | はい。管理される Hermes のホームは既定で一時的です。     | `unsloth start hermes --persist --continue --oneshot "Continue"` |
| Pi コーディングエージェント | はい。管理される Pi のホームは既定で一時的です。         | `unsloth start pi --persist --continue`                          |

Codex、OpenClaw、Hermes、Pi では、 `--persist` を初回起動時とセッションに戻るときに再度使用します。

{% tabs %}
{% tab title="Codex" %}

```bash
unsloth start codex --persist
unsloth start codex --persist resume --last
```

{% endtab %}

{% tab title="OpenClaw" %}
名前付きセッションには、安定したセッション ID を使います:

```bash
unsloth start openclaw --persist \
  agent --local --session-id my-session --message "Inspect this repository"

unsloth start openclaw --persist \
  agent --local --session-id my-session --message "Continue"
```

{% endtab %}

{% tab title="Hermes エージェント" %}

```bash
unsloth start hermes --persist --oneshot "Inspect this repository"
unsloth start hermes --persist --continue --oneshot "Continue"
```

{% endtab %}

{% tab title="Pi コーディングエージェント" %}

```bash
unsloth start pi --persist --print "Inspect this repository"
unsloth start pi --persist --continue --print "Continue"
```

{% endtab %}
{% endtabs %}

#### 実行せずに起動コマンドを表示する

```bash
unsloth start claude --no-launch
```

生成された環境とコマンドを表示します。出力には接続認証情報が含まれる可能性があるため、ログやスクリーンショットに公開しないでください。

### 権限バイパスモード

`--yolo` 選択したエージェントの信頼モードまたは非プロンプトモードに対応します。承認プロンプトを減らし、事前確認なしでエージェントにコマンドを実行させることができます。

{% hint style="warning" %}
エージェントの制限なしの操作が許容される環境でのみ使用してください。
{% endhint %}

#### よくある問題

<details>

<summary>Unsloth サーバーが見つかりませんでした</summary>

Unsloth を起動してモデルを読み込むか、\`--model\` を渡して Unsloth が一時的なローカルサーバーを起動できるようにしてください。

</details>

<details>

<summary>Codex が接続しません</summary>

\`llama-server\` で動作する GGUF モデルを使用してください。現在の Codex 統合は Unsloth の transformers バックエンドを使用しません。

</details>

<details>

<summary>セッションが復元されませんでした</summary>

Codex、OpenClaw、Hermes、Pi では、初回起動時および以降の起動時に \`--persist\` を使用し、その後にエージェント固有の再開オプションを渡してください。

</details>


---

# 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/unsloth-start.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.
