---
title: クイックスタート
description: 画像生成を送信し、完成した画像を取得します。
canonical_url: https://orchestor.io/ja/docs/quickstart
markdown_url: https://orchestor.io/ja/docs/quickstart.md
related:
  - https://orchestor.io/ja/docs/concepts/polling
  - https://orchestor.io/ja/docs/client
  - https://orchestor.io/ja/docs/concepts/requests
  - https://orchestor.io/ja/docs/models/image/gpt-image-2
  - https://orchestor.io/ja/docs/models/video/seedance-2.5
contentType: guide
---

# クイックスタート

REST API を使って、受付から結果取得までの流れを確認します。

## 用意するもの

- ワークスペースで利用できる API キーと生成用の残高
- `curl` と `jq`
- 利用可能なモデル ID（例では `gpt-image-2`）

> **API キーを保護する**
> 
> API キーは残高を使用できる認証情報です。サーバー側で保管し、ソース管理に含めないでください。

## 1. 認証情報を設定する

```bash
export ORCHESTOR_API_KEY="YOUR_API_KEY"
export IDEMPOTENCY_KEY="$(uuidgen)"
```

## 2. 生成を送信する

```bash
RESPONSE=$(curl --silent --show-error --fail-with-body \
  --request POST https://api.orchestor.io/v1/image-router/generate \
  --header "Authorization: Bearer $ORCHESTOR_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $IDEMPOTENCY_KEY" \
  --data '{"model":"gpt-image-2","prompt":"朝の光が差し込む木製テーブルの上の陶器","aspect_ratio":"1:1","mode":"async"}')
printf '%s' "$RESPONSE" | jq
JOB_ID=$(printf '%s' "$RESPONSE" | jq -er '.data.job.id')
```

受付時の応答から、ジョブ ID と状態確認先を保存します。以下は必要な項目の抜粋です。

```json
{
  "data": {
    "job": { "id": "job_example", "status": "queued" },
    "status_url": "https://api.orchestor.io/v1/jobs/job_example/status",
    "result_url": "https://api.orchestor.io/v1/jobs/job_example/result"
  }
}
```

通信が切れ、受付結果が分からないときは同じ入力と冪等性キーで再試行してください。

## 3. 結果を確認する

```bash
STATUS=$(curl --silent --show-error --fail-with-body \
  "https://api.orchestor.io/v1/jobs/$JOB_ID/status" \
  --header "Authorization: Bearer $ORCHESTOR_API_KEY")
printf '%s' "$STATUS" | jq '.data | {status, terminal, result_ready, next_poll_after_seconds}'
```

`terminal` が false なら、`next_poll_after_seconds` 秒待ってから再取得します。`terminal` が true でも、失敗・取消の場合は結果がありません。自動的な待機は[ポーリング](https://orchestor.io/ja/docs/concepts/polling.md)を参照してください。

完了時の状態応答の抜粋です。

```json
{
  "data": {
    "status": "COMPLETED",
    "orchestor_status": "completed",
    "terminal": true,
    "result_ready": true,
    "next_action": "fetch_result",
    "next_poll_after_seconds": null
  }
}
```

`FAILED` と `CANCELED` も終端状態です。成功時だけ、次の結果取得へ進みます。

`result_ready` が true のときに実行します。

```bash
RESULT=$(curl --silent --show-error --fail-with-body \
  "https://api.orchestor.io/v1/jobs/$JOB_ID/result" \
  --header "Authorization: Bearer $ORCHESTOR_API_KEY")
printf '%s' "$RESULT" | jq '.data.result.artifacts'
IMAGE_URL=$(printf '%s' "$RESULT" | jq -er '.data.result.artifacts[0].url')
curl --fail --location "$IMAGE_URL" --output image.png
```

結果の `data.result.artifacts` には、次のように成果物が入ります（抜粋）。

```json
{
  "data": {
    "result": {
      "artifacts": [{ "type": "image", "url": "https://example.com/generated-image.png", "content_type": "image/png" }]
    }
  }
}
```

## 次のステップ

- **[クライアントから接続する](https://orchestor.io/ja/docs/client.md)**
  Python・Node.js で送信から完了まで待機します。

- **[本番運用に備える](https://orchestor.io/ja/docs/concepts/requests.md)**
  タイムアウト、再試行、終端状態、完了通知を確認します。

## 関連ページ

- [GPT Image 2](https://orchestor.io/ja/docs/models/image/gpt-image-2.md)
- [Seedance 2.5](https://orchestor.io/ja/docs/models/video/seedance-2.5.md)
- [Grok Imagine Video 1.5](https://orchestor.io/ja/docs/models/video/grok-imagine-video-1.5.md)
- [Hailuo 2.3](https://orchestor.io/ja/docs/models/video/hailuo-2.3.md)

---

- [Documentation index](https://orchestor.io/ja/docs/llms.txt)
- [Documentation sitemap](https://orchestor.io/docs/sitemap.md)
