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

# P Image Ideogram を Comfy Router で使用する

> Comfy Router 経由で ideogram/p-image-ideogram を呼び出す方法: エンドポイント、リクエストの形状、Router が返すレスポンスについて説明します。

`ideogram/p-image-ideogram` の API リファレンスです。Comfy Router が Ideogram から提供しています。

## クイックスタート

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

**モデル ID:** `ideogram/p-image-ideogram`

**エンドポイント:** `POST https://api.comfy.org/v2/models/ideogram/p-image-ideogram`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "ideogram/p-image-ideogram",
              {
                  "prompt": "A beautiful mountain landscape",
              },
          )

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      const { data } = await comfy.models.run("ideogram/p-image-ideogram", {
        prompt: "A beautiful mountain landscape",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/ideogram/p-image-ideogram \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A beautiful mountain landscape\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "ideogram/p-image-ideogram",
              {
                  "prompt": "A beautiful mountain landscape",
              },
          )
          print("request_id:", handle.request_id)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      const handle = await comfy.models.submit("ideogram/p-image-ideogram", {
        prompt: "A beautiful mountain landscape",
      });
      console.log("requestId:", handle.requestId); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      const result = await handle.get();

      console.log(result.data);
      ```

      ```bash cURL theme={null}
      # 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/ideogram/p-image-ideogram/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A beautiful mountain landscape\"}"

      # 2. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/ideogram/p-image-ideogram/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/ideogram/p-image-ideogram/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="aspect_ratio" type="string">
  WxH 形式のアスペクト比。サポートされる値: 1x3、3x1、1x2、2x1、9x16、16x9、10x16、16x10、2x3、3x2、3x4、4x3、4x5、5x4、1x1。デフォルトは 1x1。
</ParamField>

<ParamField body="enable_copyright_detection" type="boolean">
  生成後の著作権検出（Hive による類似性およびロゴのチェック）をオプトインします。
</ParamField>

<ParamField body="prompt" type="string" required>
  画像生成用のプロンプト。自然言語、または Ideogram 4.0 の JSON 構造化プロンプトのいずれかです。
</ParamField>

<ParamField body="prompt_upsampling" type="string">
  プロンプトのアップサンプリングモード。サポートされる値は AUTO、ON、OFF です。デフォルトは AUTO。
</ParamField>

<ParamField body="quality" type="string">
  生成品質レベル。サポートされる値は VERY\_LOW、LOW、MEDIUM、HIGH です。デフォルトは MEDIUM。
</ParamField>

<ParamField body="resolution" type="string">
  出力解像度。サポートされる値は 1K と 2K です。デフォルトは 1K。
</ParamField>

<ParamField body="seed" type="integer">
  再現可能な生成のためのシード値
</ParamField>

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

### 出力

<ResponseField name="created" type="string (date-time)">
  生成が作成されたタイムスタンプ。

  形式: `date-time`
</ResponseField>

<ResponseField name="data" type="object[]">
  生成済み画像情報の配列。
</ResponseField>

<ResponseField name="data[].is_image_safe" type="boolean">
  画像が安全であると見なされるかどうかを示します。
</ResponseField>

<ResponseField name="data[].prompt" type="string">
  この画像の生成に使用されたプロンプト。
</ResponseField>

<ResponseField name="data[].resolution" type="string">
  生成済み画像の解像度（例: '1024x1024'）。
</ResponseField>

<ResponseField name="data[].seed" type="integer">
  この生成に使用されたシード値。
</ResponseField>

<ResponseField name="data[].style_type" type="string">
  生成に使用されたスタイルタイプ（例: 'REALISTIC'、'ANIME'）。
</ResponseField>

<ResponseField name="data[].url" type="string">
  生成済み画像への URL。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "prompt": "A beautiful mountain landscape"
}
```

### 出力

```json theme={null}
{
  "created": "2026-01-01T00:00:00Z",
  "data": [
    {
      "is_image_safe": true,
      "prompt": "A poster for a jazz festival, bold typography, warm colours",
      "resolution": "1024x1024",
      "seed": 918273645,
      "style_type": "REALISTIC",
      "url": "https://example.invalid/ideogram/p-image-ideogram/generated.png"
    }
  ]
}
```

## 出荷前の確認

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

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

<CardGroup cols={3}>
  <Card title="ヘッダー" icon="list" href="/ja/development/comfy-router/quickstart">
    認証、冪等性、リクエスト ID、エラー分類、リトライ間隔、支出上限。
  </Card>

  <Card title="Router API の利用" icon="code" href="/ja/development/comfy-router/quickstart">
    モデルの検出、バリデーションエラー、リトライ、課金。
  </Card>

  <Card title="制限事項" icon="triangle-exclamation" href="/ja/development/comfy-router/limitations">
    Router が現在対応していないことと、代替手段。
  </Card>
</CardGroup>
