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

# CurlとHTTPをUnslothに接続する

curl（または任意の HTTP クライアント）で Unsloth の API を叩くためのガイド。各エンドポイントと機能に対してコピペ可能なレシピ付きです。

Unsloth は、Unsloth が起動したポートの同一ベース URL で、OpenAI/Anthropic 互換のワイヤ形式を 3 種類公開します。いずれも次のものを受け取ります： `Authorization: Bearer sk-unsloth-…` ヘッダーを受け取り、設定内容に応じて JSON または SSE を返します `stream`.

このページでは、レシピをエンドポイント別に分類し（`/v1/chat/completions`, `/v1/messages`, `/v1/responses`, `/v1/models`, `/v1/embeddings`, `/v1/systemone`）、最後に Unsloth 組み込みの共通セクションを掲載します **サーバーサイドツール**。これらはすべてのチャットエンドポイントで動作します。

{% hint style="info" %}
使用する URL、キー、モデル名がわからない場合は、まず API 概要をお読みください。Unsloth の起動、モデルの読み込み、および次の作成手順を説明しています： `sk-unsloth-…` キー。
{% endhint %}

### 🔑 認証

すべてのリクエストには次のものが必要です： `Authorization` ヘッダー：

```
Authorization: Bearer sk-unsloth-xxxxxxxxxxxx
```

キーがシェル履歴に残らないよう、一度だけキーをエクスポートし、環境変数を参照してください：

```bash
export UNSLOTH_STUDIO_AUTH_TOKEN=sk-unsloth-xxxxxxxxxxxx
```

以下のスニペットでは、わかりやすさのためキーを次のように直接記述しています： `sk-unsloth-xxxxxxxxxxxx` 。実際には、次のものに置き換えてください： `$UNSLOTH_STUDIO_AUTH_TOKEN`.

### 📋 読み込み済みモデルの一覧

```bash
curl http://localhost:8888/v1/models \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx"
```

レスポンス：

```json
{
  "object": "list",
  "data": [
    {"id": "unsloth/gemma-3-27b-it-GGUF", "object": "model", "owned_by": "local"}
  ]
}
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FgVC1VPkCkUQBVg0HScEc%2FScreenshot%202026-04-22%20at%203.06.57%E2%80%AFAM.png?alt=media&amp;token=6f77cc78-bd0e-4141-b555-b232df1036dc" alt=""><figcaption></figcaption></figure>

次のものを使用してください： `id` リクエストで次のものが必要になる場合のフィールド： `"model"` 値（または opencode などのクライアントが次のものを要求する場合）： **モデル ID**).

### 💬 チャット補完（`/v1/chat/completions`)

OpenAI Chat Completions 方言です。最も幅広い互換性を備えています。OpenAI SDK、opencode、Cursor、Continue、Cline、Open WebUI、SillyTavern、および大半の OpenAI 互換ツールで動作します。

#### 基本リクエスト

```bash
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "messages": [{"role": "user", "content": "こんにちは"}]
  }'
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fvy9TyeJZljKrMJAath0L%2FScreenshot%202026-04-22%20at%203.40.35%E2%80%AFAM.png?alt=media&amp;token=98f8d622-83c0-4f55-aa37-d3571f0a38cd" alt=""><figcaption></figcaption></figure>

#### ストリーミング

次を追加します： `"stream": true` 。するとレスポンスは Server-Sent Events（`text/event-stream`）に切り替わります。次のように指定してください： `curl` 受信したバイトを随時フラッシュするには、次を指定します： `--no-buffer` (`-N`):

```bash
curl -N http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "messages": [{"role": "user", "content": "ローカルで実行する LLM について俳句を書いてください。"}],
    "stream": true
  }'
```

レスポンスの各行は次のようになります： `data: {"choices":[{"delta":{"content":"..."}}]}`。最後は次で終わります： `data: [DONE]`.

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FsazSu4RpyiEa6HeamYbj%2FScreenshot%202026-04-22%20at%203.42.05%E2%80%AFAM.png?alt=media&amp;token=f62cf129-74cd-4e8e-986a-1755eeb0e048" alt=""><figcaption></figcaption></figure>

#### 画像（ビジョン）

ユーザーメッセージ内の次のものとして画像を添付します： `image_url` コンテンツパート。URL には HTTPS または base64 の `data:` URI:

```bash
# ローカルファイルを base64 として埋め込む（簡潔にするため省略）
IMG=$(base64 -w 0 test.jpg)

cat > /tmp/request.json <<EOF
{
  "model":"default",
  "messages":[{"role":"user","content":[
    {"type":"text","text":"画像を説明してください。"},
    {"type":"image_url","image_url":{"url":"data:image/jpeg;base64,$IMG"}}
  ]}],
  "max_tokens":200,
  "stream":false
}
EOF

curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d @/tmp/request.json
```

{% hint style="info" %}
読み込むモデルはマルチモーダルである必要があります。テキスト専用モデルを読み込んだ場合、リクエストの構造上は成功しますが、モデルは画像を処理しません。
{% endhint %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F9yO7ersnyaIj3X8UkD5q%2FScreenshot%202026-04-22%20at%203.59.30%E2%80%AFAM.png?alt=media&amp;token=9e0af9e5-d565-4acd-8b4a-020c02d74cd8" alt=""><figcaption></figcaption></figure>

#### 関数呼び出し（OpenAI ツール）

OpenAI 形式の次のものを渡します： `tools` および（任意で） `tool_choice`。クライアントは各ツール呼び出しを実行し、次のターンで結果を返します。

```bash
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"default",
    "messages":[{"role":"user","content":"パリの天気は？"}],
    "tools":[{
      "type":"function",
      "function":{
        "name":"get_weather",
        "description":"都市の現在の天気を取得します。",
        "parameters":{
          "type":"object",
          "properties":{"city":{"type":"string"}},
          "required":["city"]
        }
      }
    }],
    "tool_choice":"required"
  }' | jq '.choices[0].message, .usage'
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F39CDJk0Z1WhG5JyaJIfV%2Ftests_codex_pr_2.png?alt=media&amp;token=c3f01286-7dc9-47dd-b7f9-9ee8c2d3cb2f" alt=""><figcaption></figcaption></figure>

### 📨 Anthropic Messages（`/v1/messages`)

Claude Code、Anthropic SDK、OpenClaw、および Messages API を話すあらゆるクライアントで使用される、Unsloth の Anthropic 互換方言です。

#### 基本リクエスト

```bash
curl http://localhost:8888/v1/messages \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "こんにちは"}]
  }'
```

{% hint style="warning" %}
`max_tokens` は次の場合に必須です： `/v1/messages` （次の場合は任意です： `/v1/chat/completions`).
{% endhint %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FOz7xeC4dRnDjO5GDAsmC%2FScreenshot%202026-04-22%20at%204.01.52%E2%80%AFAM.png?alt=media&amp;token=b7025ce1-e3a8-46ad-91fa-e87b96a22d6b" alt=""><figcaption></figcaption></figure>

#### ストリーミング

```bash
curl -N http://localhost:8888/v1/messages \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "LoRA について 2 文で説明してください。"}],
    "stream": true
  }'
```

イベントは Anthropic の SSE 形式に従います： `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta`, `message_stop`、および Unsloth 独自の `tool_result` イベント（サーバーサイドツール出力用）。

#### 画像（ビジョン）

Anthropic 形式の画像コンテンツでは、次のものを使用します： `source` base64 データを含むブロック：

```bash
IMG=$(base64 -w 0 test.jpg)

cat > /tmp/request.json <<EOF
{
  "messages":[{"role":"user","content":[
    {"type":"text","text":"画像を説明してください。"},
    {"type":"image","source":{"type":"base64","media_type":"image/jpeg","data":"$IMG"}}
  ]}],
  "max_tokens":200,
  "stream":true
}
EOF

curl -s http://localhost/v1/messages \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d @/tmp/request.json
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FMkzYMtkw9dt0V7cbqduU%2FScreenshot%202026-04-22%20at%204.03.28%E2%80%AFAM.png?alt=media&amp;token=de854c5a-b399-4736-83bb-23ffe26981e2" alt=""><figcaption></figcaption></figure>

#### ツール呼び出し（Anthropic ツール）

```bash
curl http://localhost:8888/v1/messages \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "東京の天気は？"}],
    "tools": [
      {
        "name": "get_weather",
        "description": "都市の現在の天気を取得します",
        "input_schema": {
          "type": "object",
          "properties": {
            "city": {"type": "string"}
          },
          "required": ["city"]
        }
      }
    ],
    "tool_choice": {"type": "auto"}
  }'
```

`tool_choice` 値は OpenAI 方言では次のように対応します：Anthropic `auto` → OpenAI `auto`、Anthropic `any` → OpenAI `required`、Anthropic `{type: "tool", name: "x"}` → OpenAI `{type: "function", function: {name: "x"}}`、Anthropic `none` → OpenAI `none`.

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fqb37JN1ffgBFBKyd1uWD%2FScreenshot%202026-04-22%20at%204.07.43%E2%80%AFAM.png?alt=media&amp;token=1fb7ec5d-8326-4e9f-b752-2d5d7e830a39" alt=""><figcaption></figcaption></figure>

### 🧬 Responses（`/v1/responses`)

Unsloth は、より新しい次のものにも対応しています： **OpenAI Responses API**, 。これは Codex やその他の最近の OpenAI クライアントが移行しているプロトコルです。

```bash
curl http://localhost:8888/v1/responses \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "input": "1 文の挨拶を書いてください。"
  }'
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhmyMSCTgdD1NYiLUdYNZ%2Fopenai_responses.png?alt=media&amp;token=dd56bd52-71db-46f3-8f6c-1499df8e443c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FZ3MEH4vV2RjxhLe0DsWJ%2Fresponses_function_calling.png?alt=media&amp;token=a8637d5a-51d2-47f5-9658-add9cdb757e3" alt=""><figcaption></figcaption></figure>

ストリーミングの場合は次を追加します： `"stream": true` および次を使用します： `curl -N`。Responses ストリームでは、次のような名前付きイベントを使用します： `response.output_text.delta`。Chat Completions のチャンクとは異なります。

会話履歴全体を次の項目で送信してください： `input` 各リクエストで送信します。Unsloth は次をサポートしていません： `previous_response_id` または `conversation` （サーバー管理の履歴用）。

#### 埋め込み（`/v1/embeddings`)

読み込まれた埋め込み GGUF または Unsloth で設定された埋め込みモデルを使用して、テキストから埋め込みベクトルを生成します。

次を使用する場合： `"model": "default"`、Unsloth は利用可能な場合は常駐する埋め込み GGUF を使用し、それ以外の場合は設定済みの埋め込みモデルを使用します。

```bash
curl http://localhost:8888/v1/embeddings \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "input": [
      "Unsloth はローカルモデルを実行します。",
      "各テキストのベクトルを生成してください。"
    ],
    "encoding_format": "float"
  }'
```

レスポンスには次のものが含まれます： `data` 配列。そこには次のものがあります： `embedding` ベクトルと `index` （各入力ごと）。移植性のためテキスト入力を使用してください。トークン配列入力のサポートは、埋め込みバックエンドに依存します。

#### Decision API（`/v1/systemone`)

次を有効にします： **Decision API** 次の場所で： **設定 → API** 。まず決定モデルを選択してください。このエンドポイントは次を返します： `404` （Decision API が無効の場合）。

リクエストには次のものが含まれます： `state` および名前付きの `questions`。サポートされる質問タイプは次のとおりです：

* `noul`：はい／いいえの決定。
* `choice`：次の項目で提供される名前付き選択肢からの決定： `criteria`.
* `score`：次の項目で提供される順序付き基準レベルに基づくスコア： `criteria`.

次を使用します： `"model": "default"` 設定済みの決定モデルを選択するには。

```bash
curl http://localhost:8888/v1/systemone \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "state": "顧客は注文品が破損した状態で届いたと述べ、返金を要求しています。",
    "questions": {
      "refund_requested": {
        "type": "noul",
        "instructions": "顧客は返金を要求していますか？"
      }
    }
  }'
```

決定モデルを探すには：

```bash
curl "http://localhost:8888/v1/models?output_modalities=decisions" \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx"
```

次のものを置き換えてください： `8888` をご自身の Unsloth ポートおよび API キーに置き換えてください。

### 🧰 Unsloth サーバーサイドツール（簡易記法）

クライアントサイドの関数呼び出しに加え、Unsloth は次を実行できます： **Python**, **bash**、および **ウェブ検索** をサーバーサイドで実行し、カスタム `tool_result` イベントとして結果をストリーミングで返します。これにより、クライアント経由でツール呼び出しを往復させることなく、Unsloth はすぐに「本物の」エージェントのように感じられます。

これらの追加フィールドを次へ渡すことで有効化します： **いずれか** `/v1/chat/completions` または `/v1/messages`:

| フィールド             | 型               | 注記                                                      |
| ----------------- | --------------- | ------------------------------------------------------- |
| `enable_thinking` | `boolean`       | `false` 思考を無効にします。 `true` デフォルトでは                       |
| `enable_tools`    | `boolean`       | `true` サーバーサイドツールの実行を有効にします。                            |
| `enabled_tools`   | `array<string>` | モデルが呼び出せるツール。次をサポートします： `python`, `bash`, `web_search`. |
| `session_id`      | `string`        | 任意。呼び出し間でツール状態（例：Python カーネル）を保持します。                    |

#### 思考モード

思考モードはデフォルトで有効です。&#x20;

```bash
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "messages": [{"role": "user", "content": "量子トンネル効果を 1 文で要約してください"}],
    "stream": false
  }'
```

モデルは回答を提供する前に思考します。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F4XHr9KJhzpFEibCGEuHF%2FScreenshot%202026-04-22%20at%2012.22.46%E2%80%AFPM.png?alt=media&amp;token=15fa68ae-0ca5-464f-af16-25cfabc84c33" alt=""><figcaption></figcaption></figure>

思考を無効にするには、次を渡します： `enable_thinking: false` をリクエストに含めます。モデルは最初に思考せず回答を提供します。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FKQR2nh8sb5G1zUc7YSs9%2FScreenshot%202026-04-22%20at%2012.25.47%E2%80%AFPM.png?alt=media&amp;token=4646a17e-2217-4f00-9e39-5362f989126f" alt=""><figcaption></figcaption></figure>

#### Python 実行

```bash
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "messages": [{"role": "user", "content": "123 * 456 はいくつですか？コードを使って計算してください。"}],
    "stream": false,
    "enable_tools": true,
    "enabled_tools": ["python"],
    "session_id": "my-session"
  }'
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FVGbYtwBfSoqgZov5ivMA%2FScreenshot%202026-04-22%20at%204.16.13%E2%80%AFAM.png?alt=media&amp;token=28b83469-24fb-412d-9489-a0c6b92dd8b5" alt=""><figcaption></figcaption></figure>

#### ウェブ検索 + Python（ストリーミング）

```bash
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer sk-unsloth-xxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "messages": [{"role": "user", "content": "Python 3.13 の機能を検索してください"}],
    "stream": true,
    "enable_tools": true,
    "enabled_tools": ["web_search", "python"],
    "session_id": "my-session"
  }'
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FzSFyzwXtJ0Hgvqq7gZcV%2FScreenshot%202026-04-22%20at%204.25.13%E2%80%AFAM.png?alt=media&amp;token=a8fc5908-cb11-4ec9-85c6-77a6b5c2e205" alt=""><figcaption></figcaption></figure>

#### 次の場合： `/v1/messages`

同じ簡易記法は Anthropic Messages エンドポイントでも機能します：

```bash
curl http://localhost:8888/v1/messages \
  -H "Authorization: Bearer sk-unsloth-xxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-local",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Python 3.13 の機能を検索してください"}],
    "stream": true,
    "enable_tools": true,
    "enabled_tools": ["web_search", "python"],
    "session_id": "my-session"
  }'
```

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FPpJxE60f2J59T5o85tQ1%2FScreenshot%202026-04-22%20at%204.28.43%E2%80%AFAM.png?alt=media&amp;token=870d74cb-dd8e-42c1-adeb-287807b22e16" alt=""><figcaption></figcaption></figure>

Unsloth は独自の次のものをストリーミングします： `tool_result` 標準の Anthropic / OpenAI イベントタイプに加えた SSE イベントです。モデルは次のターンで各ツールの出力を確認します。

### ❔ トラブルシューティング

**`401 Unauthorized`** **-** 次のものが `Authorization` ヘッダーが存在しないか、キーが間違っています。以下を再確認してください： `Authorization: Bearer sk-unsloth-…`.

**`curl` ストリーミングリクエストでハングする -** 次を追加します： `-N` （次と同じ： `--no-buffer`）。これがない場合、 `curl` が SSE ストリームをバッファリングするため、終了するまで何も表示されません。

**Base64 エンコーディングは OS によって異なります** **-** Linux の `base64` はデフォルトで行を折り返しますが、macOS / BSD では折り返しません。Linux では次を使用してください： `base64 -w 0` 、macOS では、 `base64` 、または出力を次のコマンドにパイプしてください： `tr -d '\n'`.

**シェルでの JSON エスケープ** **-** ヒアドキュメント（`-d @file.json`）は、ボディが複雑になった場合、インライン文字列よりも見やすくなります。例： `curl ... -d @body.json`.

**`max_tokens` でエラーが発生する場合： `/v1/messages`** **-** Anthropic 方言ではこれが必須です。次を追加してください： `"max_tokens": 1024` （または任意の上限）。

エンドポイントレベルの問題（モデルが読み込まれない、接続が切断される、ポートが間違っている）については、API 概要ページを参照してください。

### 任意：サーバーのデフォルト設定を調整する

サーバーの起動時に次を使用して、デフォルトの動作をカスタマイズできます： `unsloth run`.

```bash
# カスタムデフォルトでサーバーを起動する
unsloth run \
  --model unsloth/Qwen3-1.7B-GGUF \
  --reasoning off \
  --temp 0.6 \
  -p 8888
```

次を使用します： `--reasoning off` 思考をオフにするには、または `--reasoning on` 推論をサポートするモデルでは、これをオンにします。

```bash
# ローカルネットワーク上にAPIを公開する
unsloth run \
  --model unsloth/Qwen3-1.7B-GGUF \
  -H 0.0.0.0 \
  -p 8888
```

これによりサーバーが起動し `0.0.0.0:8888`、ローカルネットワーク上の他のデバイスが接続できるようになります。

#### リクエストごとに設定を上書きする

APIリクエストごとに、生成設定を直接上書きすることもできます。

```bash
curl http://localhost:8888/v1/chat/completions \
  -H "Authorization: Bearer $UNSLOTH_STUDIO_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "messages": [
      {
        "role": "user",
        "content": "ローカルAIについて短い詩を書いてください。"
      }
    ],
    "temperature": 0.8,
    "top_p": 0.9,
    "max_tokens": 512
  }'
```

次のようなリクエスト単位の値： `temperature`, `top_p`, `max_tokens`、および `stream` は、そのリクエストに対するサーバーのデフォルト設定を上書きします。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
