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

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

### クイックスタート

まず、次があることを確認してください [Unsloth がインストールされている](/docs/jp/shii/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>

エージェントを起動しながら、モデルを選択して読み込めます:

{% tabs %}
{% tab title="量子化サフィックス付き" %}

```bash
unsloth start codex \\
  --model unsloth/gemma-4-E2B-it-GGUF:UD-Q4_K_XL \\
  --context-length 32768
```

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

{% tab title="`--gguf-variant` を使用する場合" %}

```bash
unsloth start codex \\
  --model unsloth/gemma-4-E2B-it-GGUF \\
  --gguf-variant UD-Q4_K_XL \\
  --context-length 32768
```

明示的な `--gguf-variant` は、モデル名の後に書かれた量子化設定を上書きします。
{% endtab %}
{% endtabs %}

デフォルトのローカルアドレスでは、 `--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 キーを自動的に作成するか再利用します。

### オプション

| オプション                                        | 機能                                                     |
| -------------------------------------------- | ------------------------------------------------------ |
| `--model`, `-m`                              | モデルを選択します。指定しない場合は、Unsloth が報告する最初のモデルを使用します。          |
| `--api-key`                                  | Unsloth API キーを指定します。次も設定できます `UNSLOTH_API_KEY`.       |
| `--launch` / `--no-launch`                   | エージェントを起動するか、生成された環境とコマンドを表示します。                       |
| `--serve` / `--no-serve`                     | ローカルサーバーの自動起動を許可または禁止します。                              |
| `--gguf-variant`                             | GGUF の量子化バリアントを選択します。                                  |
| `--context-length`, `--max-seq-length`       | モデルの読み込み時に要求されるコンテキスト長を設定します。                          |
| `--load-in-4bit` / `--no-load-in-4bit`       | Hugging Face の非 GGUF モデルに対する 4 ビット読み込みを制御します。          |
| `--tensor-parallel` / `--no-tensor-parallel` | マルチ GPU システム向けの tensor-parallel GGUF 読み込みを有効または無効にします。 |
| `--persist` / `--no-persist`                 | 該当する場合は、Unsloth が管理するエージェントのホームを維持します。                 |
| `--yolo`                                     | 選択したエージェントの非プロンプトモードまたは信頼モードを使用します。                    |
| `-h`, `--help`                               | コマンドのヘルプを表示します。                                        |

Load オプションは、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 "このリポジトリを調べる"

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

{% endtab %}

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

```bash
unsloth start hermes --persist --oneshot "このリポジトリを調べる"
unsloth start hermes --persist --continue --oneshot "Continue"
```

{% endtab %}

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

```bash
unsloth start pi --persist --print "このリポジトリを調べる"
unsloth start pi --persist --continue --print "Continue"
```

{% endtab %}
{% endtabs %}

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

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

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

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

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

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