---
title: runs batches
description: プロンプト実行バッチを作成する。
canonical_url: https://orchestor.io/docs/cli/run
markdown_url: https://orchestor.io/docs/cli/run.md
contentType: reference
---

# runs batches

`orc run` は `orc runs batches create` の短縮形で、複数のプロンプト実行requestを非同期バッチとして作成します。引数、flag、本文、非同期動作は同じです。1〜10,000件の `requests` を指定し、各 `custom_id` はバッチ内で一意にします。

異なるプロンプトやチャネルは別requestにします。作成の受理は計測の完了を意味しません。返されたbatch IDで [`orc runs`](https://orchestor.io/docs/cli/runs.md) のstatusと結果を確認します。

## 使い方

```bash title="terminal"
orc run --stdin < batch.json
```

*JSONのrequestをバッチとして送信します。*

## サブコマンド

### `create`

実行期限は作成時から既定24時間で、`--completion-window 48h` にすると長い期限を選べます。期限切れ数はexpiredになったrequest数であり、成功数ではありません。

```bash title="terminal"
orc runs batches create [options]
```

#### 固有のオプション

##### `--idempotency-key`

Retry identity for operations that support idempotency. Use a unique key for each new operation, and reuse it only when retrying the same HTTP method, path, query values and exact request body. JSON whitespace changes can count as a different body. Keys contain 1–255 characters after trimming and expire after 24 hours. A completed JSON response is replayed without repeating the operation. A different request using the same key returns 409 idempotency_error. An in-progress request returns 409 idempotency_in_progress with Retry-After: 2. Whether this header is required depends on the operation.

型: `string`。任意。

```bash title="terminal"
orc runs batches create --idempotency-key <value>
```

##### `--requests`

(required) One to 10,000 execution requests. Every custom_id must be unique within this batch. Use separate requests for different prompts or channels.; JSON array of objects (use --stdin for large resources)

型: `string`。任意。

```bash title="terminal"
orc runs batches create --requests <value>
```

##### `--metadata`

Optional client metadata stored with the batch. Omit or use null for no supplied metadata.; (JSON object, e.g. '{"custom_id":"x"}'); (use "null" or "reset" to clear)

型: `string`。任意。

```bash title="terminal"
orc runs batches create --metadata <value>
```

##### `--completion-window`

Requested execution window, starting at creation. Defaults to 24h; 48h allows a longer deadline. The expiry count reports requests marked expired, not successful completion.; enum: 24h|48h

型: `string`。任意。

```bash title="terminal"
orc runs batches create --completion-window <value>
```

## 使用例

### バッチの入力を用意します。

```json title="batch.json"
{
  "requests": [
    {
      "custom_id": "measurement-1",
      "params": {
        "prompt_id": "<prompt-id>",
        "model_channel_id": "chatgpt-ui"
      }
    }
  ],
  "completion_window": "24h"
}
```

*バッチの入力を用意します。*

### 完了を待ちます。

```bash title="terminal"
orc run --stdin < batch.json --wait --timeout 5m
```

*完了を待ちます。*

## 再試行

再試行には同じmethod・path・query・正確な本文と `--idempotency-key` を使います。keyはtrim後1〜255文字で24時間保持します。本文のJSON空白変更も別の本文になり得ます。完了応答は再実行せず返し、異なるrequestとの再利用は `409 idempotency_error`、処理中は `409 idempotency_in_progress` と `Retry-After: 2` を返します。

## 必要な権限

認証し、対象Workspaceを選択して実行します。対象Workspaceへのアクセスが必要です。

## グローバルオプション

`orc runs batches` では、次の[グローバルオプション](https://orchestor.io/docs/cli/global-flags.md)を使用できます。

- [`--help`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%98%E3%83%AB%E3%83%97)
- [`--workspace`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%B9%E3%83%9A%E3%83%BC%E3%82%B9)
- [`--json`](https://orchestor.io/docs/cli/global-flags.md#json-%E5%87%BA%E5%8A%9B)
- [`--pretty`](https://orchestor.io/docs/cli/global-flags.md#json-%E5%87%BA%E5%8A%9B)
- [`--format`](https://orchestor.io/docs/cli/global-flags.md#%E5%87%BA%E5%8A%9B%E5%BD%A2%E5%BC%8F)
- [`--field`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89%E3%81%AE%E6%8A%BD%E5%87%BA)
- [`--fields`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89%E3%81%AE%E6%8A%BD%E5%87%BA)
- [`--raw`](https://orchestor.io/docs/cli/global-flags.md#%E5%80%A4%E3%81%A0%E3%81%91%E3%82%92%E5%87%BA%E5%8A%9B)
- [`--output`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%B8%E3%81%AE%E5%87%BA%E5%8A%9B)
- [`--no-pager`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%9A%E3%83%BC%E3%82%B8%E9%80%81%E3%82%8A)
- [`--dry-run`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E3%81%AE%E4%BA%8B%E5%89%8D%E7%A2%BA%E8%AA%8D)
- [`--yes`](https://orchestor.io/docs/cli/global-flags.md#%E7%A2%BA%E8%AA%8D%E3%81%AE%E7%9C%81%E7%95%A5)
- [`--stdin`](https://orchestor.io/docs/cli/global-flags.md#%E6%A8%99%E6%BA%96%E5%85%A5%E5%8A%9B)
- [`--from-stdin`](https://orchestor.io/docs/cli/global-flags.md#%E6%A8%99%E6%BA%96%E5%85%A5%E5%8A%9B)
- [`--page-all`](https://orchestor.io/docs/cli/global-flags.md#%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E3%83%9A%E3%83%BC%E3%82%B8%E3%82%92%E5%8F%96%E5%BE%97)
- [`--timing`](https://orchestor.io/docs/cli/global-flags.md#%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E6%99%82%E9%96%93)
- [`--wait`](https://orchestor.io/docs/cli/global-flags.md)
- [`--timeout`](https://orchestor.io/docs/cli/global-flags.md)
- [`--poll-interval`](https://orchestor.io/docs/cli/global-flags.md)
- [`--readonly`](https://orchestor.io/docs/cli/global-flags.md#%E8%AA%AD%E3%81%BF%E5%8F%96%E3%82%8A%E5%B0%82%E7%94%A8%E3%83%A2%E3%83%BC%E3%83%89)
- [`--wrap-untrusted`](https://orchestor.io/docs/cli/global-flags.md#%E5%A4%96%E9%83%A8%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%81%AE%E7%9B%AE%E5%8D%B0%E4%BB%98%E3%81%91)

各オプションの詳細と使用例は、[グローバルオプション](https://orchestor.io/docs/cli/global-flags.md)を参照してください。

---

[Documentation index](https://orchestor.io/docs/llms.txt)
