> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Jst 2 Scene View を Comfy Router で使用する

> Comfy Router を通じて viggle/jst-2-scene-view を呼び出します: エンドポイント、リクエスト形状、Router が返すレスポンス。

`viggle/jst-2-scene-view` の API リファレンスです。Comfy Router が Viggle から提供します。

**入力:** 3D · **出力:** 画像

## クイックスタート

[Comfy ワークスペース](https://platform.comfy.org/profile/api-keys?onboarding=router)でキーを作成し、`COMFY_API_KEY` としてエクスポートします。Python と TypeScript のスニペットは Comfy SDK(`pip install comfy-sdk` と `npm install @comfyorg/sdk`)を使用しています。cURL のスニペットは同じ呼び出しを生の HTTP で行うものです。

**モデル ID:** `viggle/jst-2-scene-view`

**エンドポイント:** `POST https://api.comfy.org/v2/models/viggle/jst-2-scene-view`

> [tab] 結果を待つ
>
> ```python Python theme={null}
> from comfy_sdk import Comfy
>
> # 環境変数から COMFY_API_KEY を読み取ります。
> # SDK は冪等性キーを自動的に作成し、自動リトライで再利用します。
> with Comfy() as client:
>     result = client.models.run(
>         "viggle/jst-2-scene-view",
>         {
>             "projection": "perspective",
>             "referenceBatchIds": ["3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f"],
>             "sessionId": "replace-with-a-new-random-id",
>             "targetPosition": {
>                 "pitch": 0,
>                 "position": [0.3, 0, 0],
>                 "yaw": 30,
>             },
>         },
>     )
>
> print(result)
> ```
>
> ```typescript TypeScript theme={null}
> import { comfy } from "@comfyorg/sdk";
>
> // 環境変数から COMFY_API_KEY を読み取ります。
> // SDK は冪等性キーを自動的に作成し、自動リトライで再利用します。
> const { data } = await comfy.models.run("viggle/jst-2-scene-view", {
>   projection: "perspective",
>   referenceBatchIds: ["3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f"],
>   sessionId: "replace-with-a-new-random-id",
>   targetPosition: {
>     pitch: 0,
>     position: [0.3, 0, 0],
>     yaw: 30,
>   },
> });
>
> console.log(data);
> ```
>
> ```bash cURL theme={null}
> curl https://api.comfy.org/v2/models/viggle/jst-2-scene-view \
>   -H "X-API-Key: $COMFY_API_KEY" \
>   -H "Idempotency-Key: $(uuidgen)" \
>   -H "Content-Type: application/json" \
>   -d "{\"projection\": \"perspective\", \"referenceBatchIds\": [\"3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f\"], \"sessionId\": \"replace-with-a-new-random-id\", \"targetPosition\": {\"pitch\":0,\"position\":[0.3,0,0],\"yaw\":30}}"
> ```

> [tab] キューに送信して後で取得
>
> 同じボディを `POST https://api.comfy.org/v2/models/viggle/jst-2-scene-view/requests` に送信します。Router は実行が受理されるとすぐに `request_id` とともに `201` を返し、結果は準備ができ次第、このプロセスまたは別のプロセスから取得できます。[キュー配信](https://docs.comfy.org/ja/development/comfy-router/queue.md)では、ステータス、キャンセル、取得の流れを順に説明しています。
>
> ```python Python theme={null}
> import asyncio
> from comfy_sdk import AsyncComfy
>
> # 環境変数から COMFY_API_KEY を読み取ります。
> # 各 submit() 呼び出しは独自の Idempotency-Key を生成し、自動リトライで再利用します。
> async def main():
>     async with AsyncComfy() as client:
>         handle = await client.models.submit(
>             "viggle/jst-2-scene-view",
>             {
>                 "projection": "perspective",
>                 "referenceBatchIds": ["3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f"],
>                 "sessionId": "replace-with-a-new-random-id",
>                 "targetPosition": {
>                     "pitch": 0,
>                     "position": [0.3, 0, 0],
>                     "yaw": 30,
>                 },
>             },
>         )
>         print("request_id:", handle.request_id)  # モデル ID と合わせて、別のプロセスが必要とするすべての情報
>
>         # リクエストが完了するまでポーリングし、サーバーが指定する Retry-After の時間だけ待機します。
>         async for update in handle.iter_events():
>             print(update.status, update.queue_position)
>
>         # プロバイダー自身のペイロードで、models.run() が返すのと同じ値です。
>         # 失敗またはキャンセル済みのリクエストは、ここで型付きの Router エラーを発生させます。
>         result = await handle.get()
>
>     print(result)
>
> asyncio.run(main())
> ```
>
> ```typescript TypeScript theme={null}
> import { comfy } from "@comfyorg/sdk";
>
> // 環境変数から COMFY_API_KEY を読み取ります。
> // 各 submit() 呼び出しは独自の Idempotency-Key を生成し、自動リトライで再利用します。
> const handle = await comfy.models.submit("viggle/jst-2-scene-view", {
>   projection: "perspective",
>   referenceBatchIds: ["3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f"],
>   sessionId: "replace-with-a-new-random-id",
>   targetPosition: {
>     pitch: 0,
>     position: [0.3, 0, 0],
>     yaw: 30,
>   },
> });
> console.log("requestId:", handle.requestId); // モデル ID と合わせて、別のプロセスが必要とするすべての情報
>
> // リクエストが完了するまでポーリングし、サーバーが指定する Retry-After の時間だけ待機します。
> for await (const update of handle.events()) {
>   console.log(update.status, update.queuePosition);
> }
>
> // models.run() が返すのと同じ結果です。失敗またはキャンセル済みのリクエストは、ここで reject されます。
> const result = await handle.get();
>
> console.log(result.data);
> ```
>
> ```bash cURL theme={null}
> # 1. 送信します。Router は request_id、status_url、response_url、cancel_url とともに 201 を返します。
> curl https://api.comfy.org/v2/models/viggle/jst-2-scene-view/requests \
>   -H "X-API-Key: $COMFY_API_KEY" \
>   -H "Idempotency-Key: $(uuidgen)" \
>   -H "Content-Type: application/json" \
>   -d "{\"projection\": \"perspective\", \"referenceBatchIds\": [\"3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f\"], \"sessionId\": \"replace-with-a-new-random-id\", \"targetPosition\": {\"pitch\":0,\"position\":[0.3,0,0],\"yaw\":30}}"
>
> # 2. ステータスが COMPLETED になるまでポーリングし、各レスポンスが指定する Retry-After 秒だけ待機します。
> REQUEST_ID="<request_id from the 201 body>"
> curl -i https://api.comfy.org/v2/models/viggle/jst-2-scene-view/requests/$REQUEST_ID/status \
>   -H "X-API-Key: $COMFY_API_KEY"
>
> # 3. 取得します。モデル固有の出力とともに 200、まだ実行中の場合はステータスボディとともに 202 を返します。
> curl https://api.comfy.org/v2/models/viggle/jst-2-scene-view/requests/$REQUEST_ID \
>   -H "X-API-Key: $COMFY_API_KEY"
> ```

## スキーマ

### 入力

**fov** `number`

視野角 (FOV) を度で指定します。20 から 140 の範囲です。

**projection** `string`

perspective (デフォルト、1 ビュー) または pano (360° パノラマ、6 ビュー) を指定します。

**referenceBatchIds** `string[]` *required*

セッションの 1 から 35 個のバッチ ID を指定します。`result.outputBatch.batchId` から取得します。

**seed** `integer`

生成のシード。

形式: `int64`

**sessionId** `string` *required*

シーンのセッション。

**targetPosition** `object` *required*

位置と 2 つの角度で表すカメラ。

**targetPosition.pitch** `number`

上下方向の角度 (度) で、-90 から 90 の範囲です。正の値は上を向きます。

**targetPosition.position** `number[]` *required*

カメラの位置 `[x, y, z]`。

**targetPosition.yaw** `number`

ワールド座標の +Y 軸周りの角度 (度) です。正の値は左に回転します。

スキーマは Router が `GET /v2/models/viggle/jst-2-scene-view/openapi.json` で提供するものから生成されており、リクエストがプロバイダーに到達する前に呼び出しを検証する際に使用するドキュメントと同じです。

### 出力

**completedAt** `integer`

形式: `int64`

**createdAt** `integer`

形式: `int64`

**credits** `number`

タスクに課金される Viggle クレジット。完了せずに ready にならなかったタスクは返金されると 0 になります。

**error** `object`

ジョブが失敗したときに設定される Viggle のエラーオブジェクト。

**error.code** `string`

**error.message** `string`

**error.request\_id** `string`

**error.retryable** `boolean`

**id** `string`

シーンタスク ID (`scn_` プレフィックス)。

**operation** `string`

タスクの種類: pano、generate、reconstruct。

**queuePosition** `integer`

キュー中にこのタスクより前に並んでいるタスク数。

**result** `object`

シーンの出力。タスクが ready の場合にのみ設定されます。

**result.newViewCount** `integer`

**result.operation** `string`

**result.outputBatch** `object`

タスクがセッションに追加した画像バッチ。

**result.outputBatch.batchId** `string`

**result.outputBatch.createdAt** `number`

**result.outputBatch.kind** `string`

**result.outputBatch.manifest** `object`

**result.outputBatch.manifest.url** `string`

ダウンロード URL。3 時間有効です。

**result.outputBatch.views** `object[]`

**result.outputBatch.views\[].c2w** `number[][]`

4 × 4 のカメラからワールドへの変換行列。

**result.outputBatch.views\[].index** `integer`

**result.outputBatch.views\[].intrinsic** `number[]`

カメラの内部パラメータ。

**result.outputBatch.views\[].url** `string`

ビュー画像のダウンロード URL。3 時間有効です。

**result.panorama** `object`

**result.panorama.url** `string`

ダウンロード URL。3 時間有効です。

**result.preview** `object`

**result.preview\.url** `string`

ダウンロード URL。3 時間有効です。

**result.referenceViewCount** `integer`

**result.sessionId** `string`

**result.spz** `object`

**result.spz.url** `string`

ダウンロード URL。3 時間有効です。

**sessionId** `string`

**status** `string`

ステータス: queued、processing、ready、failed、cancelled。

## 例

### 入力

```json theme={null}
{
  "projection": "perspective",
  "referenceBatchIds": [
    "3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f"
  ],
  "sessionId": "replace-with-a-new-random-id",
  "targetPosition": {
    "pitch": 0,
    "position": [
      0.3,
      0,
      0
    ],
    "yaw": 30
  }
}
```

### 出力

```json theme={null}
{
  "credits": 6,
  "error": null,
  "id": "scn_0199f0c2-6a1e-7c3d-9b2a-4f5e6d7c8b9a.replace-with-a-new-random-id",
  "operation": "pano",
  "result": {
    "newViewCount": 6,
    "operation": "pano",
    "outputBatch": {
      "batchId": "3f0a6c1e-8d2b-4b7a-9e5c-1a2b3c4d5e6f",
      "kind": "initial",
      "views": [
        {
          "index": 0,
          "url": "https://example.invalid/viggle/view-0.png"
        }
      ]
    },
    "panorama": {
      "url": "https://example.invalid/viggle/panorama.png"
    },
    "referenceViewCount": 0,
    "sessionId": "replace-with-a-new-random-id",
    "spz": {
      "url": "https://example.invalid/viggle/scene.spz"
    }
  },
  "sessionId": "replace-with-a-new-random-id",
  "status": "ready"
}
```

## 出荷前の確認

SDK は `Idempotency-Key` を生成し、自動リトライで再利用します。手動リトライでは元のキーを再利用してください。Router は最大 10 分間接続を保持できます。

リクエストが失敗すると、Router は理由を説明する `X-Comfy-Error-Type` レスポンスヘッダーを送信します。`422` は、プロバイダーを呼び出す前に Router が入力を拒否したことを意味し、`413` はリクエスト本文が Router の受け入れ可能なサイズを超えていたことを意味します。生成されたアセットは [結果 URL の有効期限](https://docs.comfy.org/ja/development/comfy-router/reference.md#結果アセット) があるため、早めにダウンロードしてください。

上記のフィールド説明に記載されているサイズ制限は、プロバイダーの仕様から引用した、そのフィールドに対するプロバイダー自身の上限です。Router はリクエスト本文全体に対して別の上限を適用し、base64 エンコードされたメディアもこれにカウントされます。[リクエスト本文のサイズ](https://docs.comfy.org/ja/development/comfy-router/limitations.md) を参照してください。

このページは、Comfy Router 経由で呼び出す 1 つのパートナーモデルについて説明しています。同じ `comfy-sdk` / `@comfyorg/sdk` パッケージには、Comfy Cloud 上で ComfyUI のワークフローグラフ全体を実行するための 2 つ目のクライアントも含まれています: `Comfy(api_key=...)` / `new Comfy({ apiKey })`、および `client.workflows`、`client.assets`、`client.jobs`。[Comfy SDKs](https://docs.comfy.org/ja/development/api-development/sdks.md) を参照してください。

> [card] [ヘッダー](https://docs.comfy.org/ja/development/comfy-router/headers.md)
>
> 認証、冪等性、リクエスト ID、エラー分類、リトライ間隔、支出上限。

> [card] [Router API の利用](https://docs.comfy.org/ja/development/comfy-router/api.md)
>
> モデルの検出、バリデーションエラー、リトライ、課金。

> [card] [制限事項](https://docs.comfy.org/ja/development/comfy-router/limitations.md)
>
> Router が現在対応していないことと、代替手段。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.