> ## 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.

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

> Comfy Router 経由で viggle/jst-2-scene を呼び出します。エンドポイント、リクエストの形状、Router が返すレスポンスについて説明します。

`viggle/jst-2-scene` の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`

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

> [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",
>         {
>             "prompt": "a sunlit atrium with tall plants and a stone floor",
>             "quality": "low",
>             "sessionId": "replace-with-a-new-random-id",
>         },
>     )
>
> 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", {
>   prompt: "a sunlit atrium with tall plants and a stone floor",
>   quality: "low",
>   sessionId: "replace-with-a-new-random-id",
> });
>
> console.log(data);
> ```
>
> ```bash cURL theme={null}
> curl https://api.comfy.org/v2/models/viggle/jst-2-scene \
>   -H "X-API-Key: $COMFY_API_KEY" \
>   -H "Idempotency-Key: $(uuidgen)" \
>   -H "Content-Type: application/json" \
>   -d "{\"prompt\": \"a sunlit atrium with tall plants and a stone floor\", \"quality\": \"low\", \"sessionId\": \"replace-with-a-new-random-id\"}"
> ```

> [tab] キューに送信して後で収集
>
> 同じボディを `POST https://api.comfy.org/v2/models/viggle/jst-2-scene/requests` に送信します。Router は実行が受け付けられるとすぐに `201` と `request_id` を返し、結果は準備ができ次第、このプロセスまたは別のプロセスから収集されます。[キューの配信](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",
>             {
>                 "prompt": "a sunlit atrium with tall plants and a stone floor",
>                 "quality": "low",
>                 "sessionId": "replace-with-a-new-random-id",
>             },
>         )
>         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", {
>   prompt: "a sunlit atrium with tall plants and a stone floor",
>   quality: "low",
>   sessionId: "replace-with-a-new-random-id",
> });
> 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/requests \
>   -H "X-API-Key: $COMFY_API_KEY" \
>   -H "Idempotency-Key: $(uuidgen)" \
>   -H "Content-Type: application/json" \
>   -d "{\"prompt\": \"a sunlit atrium with tall plants and a stone floor\", \"quality\": \"low\", \"sessionId\": \"replace-with-a-new-random-id\"}"
>
> # 2. ステータスが COMPLETED になるまでポーリングし、各レスポンスが指定する Retry-After 秒だけ待機します。
> REQUEST_ID="<request_id from the 201 body>"
> curl -i https://api.comfy.org/v2/models/viggle/jst-2-scene/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/requests/$REQUEST_ID \
>   -H "X-API-Key: $COMFY_API_KEY"
> ```

## スキーマ

### 入力

**panoramaUri** `string`

シーンの構築元となる 360° パノラマの http(s) URL。

**prompt** `string`

シーンの説明。最大 1,000 文字。

**quality** `string`

パノラマの品質: low（デフォルト）、medium、high。`prompt` を指定した場合のみ有効。

**referenceImages** `string[]`

パノラマを誘導する http(s) 画像 URL。最大 8 件。`prompt` を指定した場合のみ有効。

**sessionId** `string` *required*

シーンを保持するセッション: 1〜128 文字の英字、数字、`_` または `-`。シーンごとに新しいランダム値を使用してください。

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

### 出力

**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}
{
  "prompt": "a sunlit atrium with tall plants and a stone floor",
  "quality": "low",
  "sessionId": "replace-with-a-new-random-id"
}
```

### 出力

```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.