> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-sync-comfy-api-v2-spec.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy Router で Gemini 3.1 Flash Lite を使用する

> Comfy Router 経由で vertexai/gemini-3.1-flash-lite を呼び出します: エンドポイント、リクエストの形状、Router が返すレスポンス。

`vertexai/gemini-3.1-flash-lite` の API リファレンス。Google から Comfy Router によって提供されます。

## クイックスタート

[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:** `vertexai/gemini-3.1-flash-lite`

**エンドポイント:** `POST https://api.comfy.org/v2/models/vertexai/gemini-3.1-flash-lite`

<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(
              "vertexai/gemini-3.1-flash-lite",
              {
                  "contents": [
                      {
                          "parts": [
                              {
                                  "text": "Describe a robot learning to paint, in two sentences.",
                              },
                          ],
                          "role": "user",
                      },
                  ],
              },
          )

      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("vertexai/gemini-3.1-flash-lite", {
        contents: [
          {
            parts: [
              {
                text: "Describe a robot learning to paint, in two sentences.",
              },
            ],
            role: "user",
          },
        ],
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/vertexai/gemini-3.1-flash-lite \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"contents\": [{\"parts\":[{\"text\":\"Describe a robot learning to paint, in two sentences.\"}],\"role\":\"user\"}]}"
      ```
    </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(
              "vertexai/gemini-3.1-flash-lite",
              {
                  "contents": [
                      {
                          "parts": [
                              {
                                  "text": "Describe a robot learning to paint, in two sentences.",
                              },
                          ],
                          "role": "user",
                      },
                  ],
              },
          )
          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("vertexai/gemini-3.1-flash-lite", {
        contents: [
          {
            parts: [
              {
                text: "Describe a robot learning to paint, in two sentences.",
              },
            ],
            role: "user",
          },
        ],
      });
      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/vertexai/gemini-3.1-flash-lite/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"contents\": [{\"parts\":[{\"text\":\"Describe a robot learning to paint, in two sentences.\"}],\"role\":\"user\"}]}"

      # 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/vertexai/gemini-3.1-flash-lite/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/vertexai/gemini-3.1-flash-lite/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="contents" type="object[]" required>
  モデルとの現在の会話のコンテンツ。単一ターンのクエリでは、これは単一のインスタンスです。マルチターンのクエリでは、これは会話履歴と最新のリクエストを含む繰り返しフィールドです。
</ParamField>

<ParamField body="contents[].parts" type="object[]" required />

<ParamField body="contents[].parts[].fileData" type="object">
  URI ベースのデータ。
</ParamField>

<ParamField body="contents[].parts[].fileData.fileUri" type="string">
  URI
</ParamField>

<ParamField body="contents[].parts[].fileData.mimeType" type="string">
  data または fileUri フィールドで指定されたファイルのメディアタイプ。指定可能な値は以下のとおりです。gemini-2.0-flash-lite および gemini-2.0-flash では、オーディオファイルの最大長は 8.4 時間、ビデオファイル（音声なし）の最大長は 1 時間です。詳細については、Gemini のオーディオとビデオの要件を参照してください。テキストファイルは UTF-8 でエンコードされている必要があります。テキストファイルの内容はトークン制限にカウントされます。画像解像度に制限はありません。

  指定可能な値: `application/pdf`、`audio/mpeg`、`audio/mp3`、`audio/wav`、`image/png`、`image/jpeg`、`image/webp`、`text/plain`、`video/mov`、`video/mpeg`、`video/mp4`、`video/mpg`、`video/avi`、`video/wmv`、`video/mpegps`、`video/flv`、`image/heic`、`image/heif`、`audio/flac`、`video/webm`
</ParamField>

<ParamField body="contents[].parts[].inlineData" type="object">
  生バイトのインラインデータ。gemini-2.0-flash-lite および gemini-2.0-flash では、inlineData を使用して最大 3000 枚の画像を指定できます。
</ParamField>

<ParamField body="contents[].parts[].inlineData.data" type="string (byte)">
  プロンプトにインラインで含める画像、PDF、またはビデオの base64 エンコード。メディアをインラインで含める場合は、データのメディアタイプ（mimeType）も指定する必要があります。サイズ制限: 20MB

  形式: `byte`
</ParamField>

<ParamField body="contents[].parts[].inlineData.mimeType" type="string">
  data または fileUri フィールドで指定されたファイルのメディアタイプ。指定可能な値は以下のとおりです。gemini-2.0-flash-lite および gemini-2.0-flash では、オーディオファイルの最大長は 8.4 時間、ビデオファイル（音声なし）の最大長は 1 時間です。詳細については、Gemini のオーディオとビデオの要件を参照してください。テキストファイルは UTF-8 でエンコードされている必要があります。テキストファイルの内容はトークン制限にカウントされます。画像解像度に制限はありません。

  指定可能な値: `application/pdf`、`audio/mpeg`、`audio/mp3`、`audio/wav`、`image/png`、`image/jpeg`、`image/webp`、`text/plain`、`video/mov`、`video/mpeg`、`video/mp4`、`video/mpg`、`video/avi`、`video/wmv`、`video/mpegps`、`video/flv`、`image/heic`、`image/heif`、`audio/flac`、`video/webm`
</ParamField>

<ParamField body="contents[].parts[].mediaProcessing" type="string">
  モデルがこのパートの動画をどのように読み取るか。"AGENTIC" を設定すると、固定レートのフレームサンプリングの代わりに、モデルが検査するセグメントを決定できるようになります。デフォルトの固定レートサンプリングでは省略します。gemini-3.7-flash 以降の Flash モデルでサポートされています。
</ParamField>

<ParamField body="contents[].parts[].text" type="string">
  テキストプロンプトまたはコードスニペット。
</ParamField>

<ParamField body="contents[].parts[].thought" type="boolean">
  このパートがモデルによる思考/推論ステップであることを示します。
</ParamField>

<ParamField body="contents[].role" type="string">
  指定可能な値: `user`、`model`
</ParamField>

<ParamField body="generationConfig" type="object">
  生成のためのサンプリング、長さ、出力の設定。すべてのフィールドはオプションです。以下で `default` を宣言しているフィールドは省略時にその値が適用され、それ以外はモデル自身の動作にフォールバックします。
</ParamField>

<ParamField body="generationConfig.imageConfig" type="object">
  画像生成の設定
</ParamField>

<ParamField body="generationConfig.imageConfig.aspectRatio" type="string">
  生成済み画像のアスペクト比率
</ParamField>

<ParamField body="generationConfig.imageConfig.imageOutputOptions" type="object">
  オプション。生成済み画像の画像出力形式。
</ParamField>

<ParamField body="generationConfig.imageConfig.imageOutputOptions.compressionQuality" type="integer">
  オプション。出力画像の圧縮品質。
</ParamField>

<ParamField body="generationConfig.imageConfig.imageOutputOptions.mimeType" type="string">
  オプション。出力を保存する画像形式。
</ParamField>

<ParamField body="generationConfig.imageConfig.imageSize" type="string">
  オプション。生成済み画像のサイズを指定します。サポートされる値は 1K、2K、4K です。指定しない場合、モデルはデフォルト値の 1K を使用します。
</ParamField>

<ParamField body="generationConfig.maxOutputTokens" type="integer">
  レスポンスで生成できるトークンの最大数。1 トークンはおよそ 4 文字です。100 トークンはおよそ 60～80 語に相当します。

  範囲: `16`～`65536`
</ParamField>

<ParamField body="generationConfig.responseModalities" type="`TEXT`, `IMAGE`[]" />

<ParamField body="generationConfig.seed" type="integer">
  シードを特定の値に固定すると、モデルは繰り返しのリクエストに対して同じレスポンスを返すよう最善を尽くします。決定論的な出力は保証されません。また、temperature などのモデルやパラメータ設定を変更すると、同じシード値を使用してもレスポンスが変動する可能性があります。デフォルトでは、ランダムなシード値が使用されます。以下のモデルで利用可能です: gemini-2.5-flash、gemini-2.5-pro、gemini-2.5-flash-preview-04-1、gemini-2.5-pro-preview-05-0、gemini-2.0-flash-lite-00、gemini-2.0-flash-001
</ParamField>

<ParamField body="generationConfig.stopSequences" type="string[]" />

<ParamField body="generationConfig.temperature" type="number" default="1">
  温度は、topP と topK が適用される際に行われる応答生成中のサンプリングに使用されます。温度はトークン選択におけるランダム性の度合いを制御します。低い温度は、あまり自由奔放でない、または創造性を必要としないプロンプトに適しており、高い温度はより多様な、または創造的な結果をもたらす可能性があります。温度が 0 の場合、常に最も確率の高いトークンが選択されます。この場合、特定のプロンプトに対する応答はほぼ決定的になりますが、わずかなばらつきが生じる可能性は依然としてあります。モデルが返す応答が一般的すぎる、短すぎる、またはフォールバック応答を返す場合は、温度を上げてみてください

  範囲: `0` から `2`

  形式: `float`
</ParamField>

<ParamField body="generationConfig.thinkingConfig" type="object">
  オプション。思考機能の設定です。思考とは、モデルが複雑なタスクを小さなステップに分解して、より高品質な応答を生成するプロセスです。
</ParamField>

<ParamField body="generationConfig.thinkingConfig.includeThoughts" type="boolean">
  オプション。true の場合、モデルは応答に自身の思考を含めます。
</ParamField>

<ParamField body="generationConfig.thinkingConfig.thinkingBudget" type="integer">
  オプション。モデルの思考プロセスに割り当てるトークン予算です。モデルはこの予算内に収まるよう最善を尽くします。
</ParamField>

<ParamField body="generationConfig.thinkingConfig.thinkingLevel" type="string">
  オプション。モデルの思考レベルです。

  指定可能な値: `THINKING_LEVEL_UNSPECIFIED`、`LOW`、`MEDIUM`、`HIGH`、`MINIMAL`
</ParamField>

<ParamField body="generationConfig.topK" type="integer" default="40">
  Top-K は、モデルが出力用のトークンを選択する方法を変更します。Top-K が 1 の場合、次に選択されるトークンはモデルの語彙内のすべてのトークンの中で最も確率が高いものになります。Top-K が 3 の場合、次のトークンは確率が上位 3 つのトークンの中から温度を用いて選択されます。

  範囲: `1` から `…`
</ParamField>

<ParamField body="generationConfig.topP" type="number" default="0.95">
  指定した場合、nucleus サンプリングが使用されます。
  Top-P は、モデルが出力用のトークンを選択する方法を変更します。トークンは、その確率の合計が top-P の値に等しくなるまで、最も確率の高いもの（top-K を参照）から低いものへと選択されます。たとえば、トークン A、B、C の確率がそれぞれ 0.3、0.2、0.1 で、top-P の値が 0.5 の場合、モデルは温度を用いて A または B のいずれかを次のトークンとして選択し、C は候補から除外します。
  よりランダム性の低い応答には低い値を、よりランダム性の高い応答には高い値を指定してください。

  範囲: `0` から `1`

  形式: `float`
</ParamField>

<ParamField body="safetySettings" type="object[]">
  安全でないコンテンツをブロックするためのリクエストごとの設定です。GenerateContentResponse.candidates に対して適用されます。
</ParamField>

<ParamField body="safetySettings[].category" type="string" required>
  指定可能な値: `HARM_CATEGORY_SEXUALLY_EXPLICIT`、`HARM_CATEGORY_HATE_SPEECH`、`HARM_CATEGORY_HARASSMENT`、`HARM_CATEGORY_DANGEROUS_CONTENT`
</ParamField>

<ParamField body="safetySettings[].threshold" type="string" required>
  指定可能な値: `OFF`、`BLOCK_NONE`、`BLOCK_LOW_AND_ABOVE`、`BLOCK_MEDIUM_AND_ABOVE`、`BLOCK_ONLY_HIGH`
</ParamField>

<ParamField body="systemInstruction" type="object">
  モデルをより良いパフォーマンスへと導くための指示です。たとえば、「できるだけ簡潔に答えてください」や「回答に専門用語を使わないでください」などです。テキスト文字列はトークン制限にカウントされます。systemInstruction の role フィールドは無視され、モデルのパフォーマンスには影響しません。注: parts にはテキストのみを使用し、各 part のコンテンツは別々の段落にしてください。
</ParamField>

<ParamField body="systemInstruction.parts" type="object[]" required>
  単一のメッセージを構成する順序付けされた parts のリストです。part ごとに異なる IANA MIME タイプを持つ場合があります。最大トークン数や画像数などの入力の制限については、Google のモデルページにあるモデル仕様を参照してください。
</ParamField>

<ParamField body="systemInstruction.parts[].text" type="string">
  テキストプロンプトまたはコードスニペット。
</ParamField>

<ParamField body="systemInstruction.role" type="string">
  メッセージを作成するエンティティの識別情報です。次の値がサポートされています: user: メッセージが実在の人物によって送信されたことを示します。通常はユーザーが生成したメッセージです。model: メッセージがモデルによって生成されたことを示します。model の値は、マルチターンの会話中にモデルからのメッセージを会話に挿入するために使用されます。マルチターンでない会話では、このフィールドは空白のままか未設定にできます。

  指定可能な値: `user`、`model`
</ParamField>

<ParamField body="tools" type="object[]">
  システムがモデルの知識と範囲外のアクションまたは一連のアクションを実行するために、外部システムとやり取りできるようにするコードの一部です。関数呼び出しを参照してください。
</ParamField>

<ParamField body="tools[].functionDeclarations" type="object[]" />

<ParamField body="tools[].functionDeclarations[].description" type="string" />

<ParamField body="tools[].functionDeclarations[].name" type="string" required />

<ParamField body="tools[].functionDeclarations[].parameters" type="object">
  関数のパラメータ用の JSON スキーマ
</ParamField>

<ParamField body="uploadImagesToStorage" type="boolean">
  true の場合、生成された画像はクラウドストレージにアップロードされ、インラインの base64 データではなく署名付き URL として返されます。URL は 24 時間後に失効します。
</ParamField>

<ParamField body="videoMetadata" type="object">
  ビデオ入力の場合、ビデオの開始と終了のオフセットを Duration 形式で指定します。たとえば、1:00 から始まる 10 秒のクリップを指定するには、"startOffset": \{ "seconds": 60 } および "endOffset": \{ "seconds": 70 } を設定します。メタデータは、ビデオデータが inlineData または fileData で提示されている場合にのみ指定する必要があります。
</ParamField>

<ParamField body="videoMetadata.endOffset" type="object">
  ビデオタイムライン位置の再生時間オフセットを表します。
</ParamField>

<ParamField body="videoMetadata.endOffset.nanos" type="integer">
  ナノ秒単位の精度で表される、符号付きの秒の小数部です。小数を含むネガティブな秒の値であっても、nanos の値は非負でなければなりません。

  範囲: `0` ～ `999999999`
</ParamField>

<ParamField body="videoMetadata.endOffset.seconds" type="integer">
  期間の符号付き秒数です。-315,576,000,000 から +315,576,000,000 まで（両端を含む）でなければなりません。

  範囲: `-315576000000` ～ `315576000000`
</ParamField>

<ParamField body="videoMetadata.startOffset" type="object">
  ビデオタイムライン位置の再生時間オフセットを表します。
</ParamField>

<ParamField body="videoMetadata.startOffset.nanos" type="integer">
  ナノ秒単位の精度で表される、符号付きの秒の小数部です。小数を含むネガティブな秒の値であっても、nanos の値は非負でなければなりません。

  範囲: `0` ～ `999999999`
</ParamField>

<ParamField body="videoMetadata.startOffset.seconds" type="integer">
  期間の符号付き秒数です。-315,576,000,000 から +315,576,000,000 まで（両端を含む）でなければなりません。

  範囲: `-315576000000` ～ `315576000000`
</ParamField>

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

### 出力

<ResponseField name="candidates" type="object[]" />

<ResponseField name="candidates[].citationMetadata" type="object" />

<ResponseField name="candidates[].citationMetadata.citations" type="object[]" />

<ResponseField name="candidates[].citationMetadata.citations[].authors" type="string[]" />

<ResponseField name="candidates[].citationMetadata.citations[].endIndex" type="integer" />

<ResponseField name="candidates[].citationMetadata.citations[].license" type="string" />

<ResponseField name="candidates[].citationMetadata.citations[].publicationDate" type="string (date)">
  形式: `date`
</ResponseField>

<ResponseField name="candidates[].citationMetadata.citations[].startIndex" type="integer" />

<ResponseField name="candidates[].citationMetadata.citations[].title" type="string" />

<ResponseField name="candidates[].citationMetadata.citations[].uri" type="string" />

<ResponseField name="candidates[].content" type="object">
  モデルとの現在の会話のコンテンツ。単一ターンのクエリでは単一のインスタンスです。マルチターンのクエリでは、会話履歴と最新のリクエストを含む繰り返しフィールドです。
</ResponseField>

<ResponseField name="candidates[].content.parts" type="object[]" required />

<ResponseField name="candidates[].content.parts[].fileData" type="object">
  URI ベースのデータ。
</ResponseField>

<ResponseField name="candidates[].content.parts[].fileData.fileUri" type="string">
  URI
</ResponseField>

<ResponseField name="candidates[].content.parts[].fileData.mimeType" type="string">
  data または fileUri フィールドで指定されたファイルのメディアタイプ。使用可能な値は次のとおりです。gemini-2.0-flash-lite および gemini-2.0-flash では、オーディオファイルの最大長は 8.4 時間、ビデオファイル(音声なし)の最大長は 1 時間です。詳細については、Gemini のオーディオとビデオの要件を参照してください。テキストファイルは UTF-8 でエンコードする必要があります。テキストファイルの内容はトークン制限にカウントされます。画像の解像度に制限はありません。

  使用可能な値: `application/pdf`、`audio/mpeg`、`audio/mp3`、`audio/wav`、`image/png`、`image/jpeg`、`image/webp`、`text/plain`、`video/mov`、`video/mpeg`、`video/mp4`、`video/mpg`、`video/avi`、`video/wmv`、`video/mpegps`、`video/flv`、`image/heic`、`image/heif`、`audio/flac`、`video/webm`
</ResponseField>

<ResponseField name="candidates[].content.parts[].inlineData" type="object">
  生バイトのインラインデータ。gemini-2.0-flash-lite および gemini-2.0-flash では、inlineData を使用して最大 3000 枚の画像を指定できます。
</ResponseField>

<ResponseField name="candidates[].content.parts[].inlineData.data" type="string (byte)">
  プロンプトにインラインで含める画像、PDF、またはビデオの base64 エンコード。メディアをインラインで含める場合は、データのメディアタイプ(mimeType)も指定する必要があります。サイズ制限: 20MB

  形式: `byte`
</ResponseField>

<ResponseField name="candidates[].content.parts[].inlineData.mimeType" type="string">
  data または fileUri フィールドで指定されたファイルのメディアタイプ。使用可能な値は次のとおりです。gemini-2.0-flash-lite および gemini-2.0-flash では、オーディオファイルの最大長は 8.4 時間、ビデオファイル(音声なし)の最大長は 1 時間です。詳細については、Gemini のオーディオとビデオの要件を参照してください。テキストファイルは UTF-8 でエンコードする必要があります。テキストファイルの内容はトークン制限にカウントされます。画像の解像度に制限はありません。

  使用可能な値: `application/pdf`、`audio/mpeg`、`audio/mp3`、`audio/wav`、`image/png`、`image/jpeg`、`image/webp`、`text/plain`、`video/mov`、`video/mpeg`、`video/mp4`、`video/mpg`、`video/avi`、`video/wmv`、`video/mpegps`、`video/flv`、`image/heic`、`image/heif`、`audio/flac`、`video/webm`
</ResponseField>

<ResponseField name="candidates[].content.parts[].mediaProcessing" type="string">
  モデルがこのパートの動画をどのように読み取るか。"AGENTIC" を設定すると、固定レートのフレームサンプリングの代わりに、モデルが検査するセグメントを決定できるようになります。デフォルトの固定レートサンプリングでは省略します。gemini-3.7-flash 以降の Flash モデルでサポートされています。
</ResponseField>

<ResponseField name="candidates[].content.parts[].text" type="string">
  テキストプロンプトまたはコードスニペット。
</ResponseField>

<ResponseField name="candidates[].content.parts[].thought" type="boolean">
  この部分がモデルからの思考/推論ステップであることを示します。
</ResponseField>

<ResponseField name="candidates[].content.role" type="string">
  使用可能な値: `user`、`model`
</ResponseField>

<ResponseField name="candidates[].finishReason" type="string" />

<ResponseField name="candidates[].safetyRatings" type="object[]" />

<ResponseField name="candidates[].safetyRatings[].category" type="string">
  使用可能な値: `HARM_CATEGORY_SEXUALLY_EXPLICIT`、`HARM_CATEGORY_HATE_SPEECH`、`HARM_CATEGORY_HARASSMENT`、`HARM_CATEGORY_DANGEROUS_CONTENT`
</ResponseField>

<ResponseField name="candidates[].safetyRatings[].probability" type="string">
  コンテンツが指定された安全性カテゴリに違反する確率

  使用可能な値: `NEGLIGIBLE`、`LOW`、`MEDIUM`、`HIGH`、`UNKNOWN`
</ResponseField>

<ResponseField name="createTime" type="string">
  レスポンスが作成されたタイムスタンプ。
</ResponseField>

<ResponseField name="modelVersion" type="string">
  レスポンスの生成に使用されたモデルバージョン。
</ResponseField>

<ResponseField name="promptFeedback" type="object" />

<ResponseField name="promptFeedback.blockReason" type="string" />

<ResponseField name="promptFeedback.blockReasonMessage" type="string" />

<ResponseField name="promptFeedback.safetyRatings" type="object[]" />

<ResponseField name="promptFeedback.safetyRatings[].category" type="string">
  使用可能な値: `HARM_CATEGORY_SEXUALLY_EXPLICIT`、`HARM_CATEGORY_HATE_SPEECH`、`HARM_CATEGORY_HARASSMENT`、`HARM_CATEGORY_DANGEROUS_CONTENT`
</ResponseField>

<ResponseField name="promptFeedback.safetyRatings[].probability" type="string">
  コンテンツが指定された安全性カテゴリに違反する確率

  指定可能な値: `NEGLIGIBLE`、`LOW`、`MEDIUM`、`HIGH`、`UNKNOWN`
</ResponseField>

<ResponseField name="responseId" type="string">
  レスポンスの一意の識別子。
</ResponseField>

<ResponseField name="usageMetadata" type="object" />

<ResponseField name="usageMetadata.cachedContentTokenCount" type="integer">
  出力専用。入力内のキャッシュされた部分（キャッシュされたコンテンツ）のトークン数。
</ResponseField>

<ResponseField name="usageMetadata.candidatesTokenCount" type="integer">
  レスポンス内のトークン数。
</ResponseField>

<ResponseField name="usageMetadata.candidatesTokensDetails" type="object[]">
  モダリティ別の候補トークンの内訳。
</ResponseField>

<ResponseField name="usageMetadata.candidatesTokensDetails[].modality" type="string">
  入力または出力コンテンツのモダリティの種類。

  指定可能な値: `MODALITY_UNSPECIFIED`、`TEXT`、`IMAGE`、`VIDEO`、`AUDIO`、`DOCUMENT`
</ResponseField>

<ResponseField name="usageMetadata.candidatesTokensDetails[].tokenCount" type="integer">
  指定されたモダリティのトークン数。
</ResponseField>

<ResponseField name="usageMetadata.promptTokenCount" type="integer">
  リクエスト内のトークン数。cachedContent が設定されている場合でも、これは有効なプロンプトの合計サイズであり、キャッシュされたコンテンツ内のトークン数も含まれます。
</ResponseField>

<ResponseField name="usageMetadata.promptTokensDetails" type="object[]">
  モダリティ別のプロンプトトークンの内訳。
</ResponseField>

<ResponseField name="usageMetadata.promptTokensDetails[].modality" type="string">
  入力または出力コンテンツのモダリティの種類。

  指定可能な値: `MODALITY_UNSPECIFIED`、`TEXT`、`IMAGE`、`VIDEO`、`AUDIO`、`DOCUMENT`
</ResponseField>

<ResponseField name="usageMetadata.promptTokensDetails[].tokenCount" type="integer">
  指定されたモダリティのトークン数。
</ResponseField>

<ResponseField name="usageMetadata.thoughtsTokenCount" type="integer">
  thoughts 出力に含まれるトークン数。
</ResponseField>

<ResponseField name="usageMetadata.toolUsePromptTokenCount" type="integer">
  ツール使用プロンプトに含まれるトークン数。
</ResponseField>

<ResponseField name="usageMetadata.toolUsePromptTokensDetails" type="object[]">
  モダリティごとのツール使用プロンプトトークンの内訳。
</ResponseField>

<ResponseField name="usageMetadata.toolUsePromptTokensDetails[].modality" type="string">
  入力または出力コンテンツのモダリティの種類。

  指定可能な値: `MODALITY_UNSPECIFIED`, `TEXT`, `IMAGE`, `VIDEO`, `AUDIO`, `DOCUMENT`
</ResponseField>

<ResponseField name="usageMetadata.toolUsePromptTokensDetails[].tokenCount" type="integer">
  指定されたモダリティのトークン数。
</ResponseField>

<ResponseField name="usageMetadata.totalTokenCount" type="integer">
  トークンの総数（プロンプト + 候補）。
</ResponseField>

<ResponseField name="usageMetadata.trafficType" type="string">
  リクエストに使用されたトラフィックタイプ（例: PROVISIONED\_THROUGHPUT）。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "Describe a robot learning to paint, in two sentences."
        }
      ],
      "role": "user"
    }
  ]
}
```

### 出力

```json theme={null}
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "A lighthouse stands at the edge of the harbour, its lamp still turning as the sun comes up."
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "modelVersion": "gemini-3.1-flash-lite",
  "responseId": "0d1f2a3b-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
  "usageMetadata": {
    "candidatesTokenCount": 21,
    "promptTokenCount": 12,
    "totalTokenCount": 33
  }
}
```

## 出荷前の確認

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>
