import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# The SDK automatically creates an idempotency key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: result = await client.models.run( "vertexai/gemini-3.1-pro-preview", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const result = await comfy.models.run<Result>("vertexai/gemini-3.1-pro-preview", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
curl https://api.comfy.org/v2/models/vertexai/gemini-3.1-pro-preview \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"
同じ本文を POST https://api.comfy.org/v2/models/vertexai/gemini-3.1-pro-preview/requests に送信します。Router は実行が受け付けられるとすぐに 201 と request_id を返し、結果は準備が整い次第、このプロセスからでも別のプロセスからでも収集できます。キュー配信では、ステータス、キャンセル、収集について順を追って説明します。
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: handle = await client.models.submit( "vertexai/gemini-3.1-pro-preview", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) 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. async 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 = await handle.get() print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const handle = await comfy.models.submit<Result>("vertexai/gemini-3.1-pro-preview", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});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();if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
# 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-pro-preview/requests \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"# 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-pro-preview/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-pro-preview/requests/$REQUEST_ID \ -H "X-API-Key: $COMFY_API_KEY"
モデルをより良いパフォーマンスへと導くための指示です。たとえば、「できるだけ簡潔に答えてください」や「応答に専門用語を使わないでください」などです。テキスト文字列はトークン上限にカウントされます。systemInstruction の role フィールドは無視され、モデルのパフォーマンスには影響しません。注: parts にはテキストのみを使用し、各 part の content は別々の段落にしてください。
object[]
必須
1 つのメッセージを構成する、順序付けられた parts のリストです。part ごとに異なる IANA MIME タイプを持つ場合があります。最大トークン数や画像数など入力の制限については、Google のモデルページにあるモデル仕様を参照してください。
string
テキストプロンプトまたはコードスニペット。
string
メッセージを作成するエンティティの識別情報です。以下の値がサポートされています。user: メッセージが実在の人物によって送信されたことを示します。通常はユーザーが生成したメッセージです。model: メッセージがモデルによって生成されたことを示します。model の値は、マルチターンの会話中にモデルからのメッセージを会話に挿入するために使用されます。マルチターンでない会話では、このフィールドは空白のままにするか、未設定にすることができます。指定可能な値: user, model
{ "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence." } ] } ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256 }}
出力
{ "candidates": [ { "content": { "role": "model", "parts": [ { "text": "A single red maple leaf rests on a plain white background, its edges sharp and its color deep." } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 18, "candidatesTokenCount": 24 }}
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# The SDK automatically creates an idempotency key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: result = await client.models.run( "vertexai/gemini-3.5-flash", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const result = await comfy.models.run<Result>("vertexai/gemini-3.5-flash", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
curl https://api.comfy.org/v2/models/vertexai/gemini-3.5-flash \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"
同じ本文を POST https://api.comfy.org/v2/models/vertexai/gemini-3.5-flash/requests に送信します。Router は実行が受け付けられるとすぐに 201 と request_id を返し、結果は準備が整い次第、このプロセスからでも別のプロセスからでも収集できます。キュー配信では、ステータス、キャンセル、収集について順を追って説明します。
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: handle = await client.models.submit( "vertexai/gemini-3.5-flash", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) 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. async 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 = await handle.get() print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const handle = await comfy.models.submit<Result>("vertexai/gemini-3.5-flash", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});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();if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
# 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.5-flash/requests \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"# 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.5-flash/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.5-flash/requests/$REQUEST_ID \ -H "X-API-Key: $COMFY_API_KEY"
モデルをより良いパフォーマンスへと導くための指示です。たとえば、「できるだけ簡潔に答えてください」や「応答に専門用語を使わないでください」などです。テキスト文字列はトークン上限にカウントされます。systemInstruction の role フィールドは無視され、モデルのパフォーマンスには影響しません。注: parts にはテキストのみを使用し、各 part の content は別々の段落にしてください。
object[]
必須
1 つのメッセージを構成する、順序付けられた parts のリストです。part ごとに異なる IANA MIME タイプを持つ場合があります。最大トークン数や画像数など入力の制限については、Google のモデルページにあるモデル仕様を参照してください。
string
テキストプロンプトまたはコードスニペット。
string
メッセージを作成するエンティティの識別情報です。以下の値がサポートされています。user: メッセージが実在の人物によって送信されたことを示します。通常はユーザーが生成したメッセージです。model: メッセージがモデルによって生成されたことを示します。model の値は、マルチターンの会話中にモデルからのメッセージを会話に挿入するために使用されます。マルチターンでない会話では、このフィールドは空白のままにするか、未設定にすることができます。指定可能な値: user, model
{ "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence." } ] } ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256 }}
出力
{ "candidates": [ { "content": { "role": "model", "parts": [ { "text": "A single red maple leaf rests on a plain white background, its edges sharp and its color deep." } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 18, "candidatesTokenCount": 24 }}
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# The SDK automatically creates an idempotency key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: result = await client.models.run( "vertexai/gemini-2.5-pro", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const result = await comfy.models.run<Result>("vertexai/gemini-2.5-pro", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
curl https://api.comfy.org/v2/models/vertexai/gemini-2.5-pro \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"
同じ本文を POST https://api.comfy.org/v2/models/vertexai/gemini-2.5-pro/requests に送信します。Router は実行が受け付けられるとすぐに 201 と request_id を返し、結果は準備が整い次第、このプロセスからでも別のプロセスからでも収集できます。キュー配信では、ステータス、キャンセル、収集について順を追って説明します。
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: handle = await client.models.submit( "vertexai/gemini-2.5-pro", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) 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. async 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 = await handle.get() print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const handle = await comfy.models.submit<Result>("vertexai/gemini-2.5-pro", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});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();if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
# 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.curl https://api.comfy.org/v2/models/vertexai/gemini-2.5-pro/requests \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"# 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-2.5-pro/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-2.5-pro/requests/$REQUEST_ID \ -H "X-API-Key: $COMFY_API_KEY"
スキーマ
入力
フィールドは Google が公開している API 仕様に従っており、CI でその仕様と照合されます。このモデルに対する Router 独自のスキーマはまだ公開されていないため、リクエストは検証されずにプロバイダーへ転送されます。
{ "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence." } ] } ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256 }}
出力
{ "candidates": [ { "content": { "role": "model", "parts": [ { "text": "A single red maple leaf rests on a plain white background, its edges sharp and its color deep." } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 18, "candidatesTokenCount": 24 }}
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# The SDK automatically creates an idempotency key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: result = await client.models.run( "vertexai/gemini-2.5-flash", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const result = await comfy.models.run<Result>("vertexai/gemini-2.5-flash", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
curl https://api.comfy.org/v2/models/vertexai/gemini-2.5-flash \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"
同じ本文を POST https://api.comfy.org/v2/models/vertexai/gemini-2.5-flash/requests に送信します。Router は実行が受け付けられるとすぐに 201 と request_id を返し、結果は準備が整い次第、このプロセスからでも別のプロセスからでも収集できます。キュー配信では、ステータス、キャンセル、収集について順を追って説明します。
import asynciofrom comfy_sdk import AsyncComfy# Reads COMFY_API_KEY from the environment.# Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.async def main(): async with AsyncComfy() as client: handle = await client.models.submit( "vertexai/gemini-2.5-flash", { "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256, }, }, ) 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. async 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 = await handle.get() print("text:", result["candidates"][0]["content"]["parts"][0]["text"])asyncio.run(main())
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.type Result = { candidates: { content: { parts: { text: string }[] } }[] };const handle = await comfy.models.submit<Result>("vertexai/gemini-2.5-flash", { contents: [ { role: "user", parts: [ { text: "Describe a single red maple leaf on a white background in one sentence.", }, ], }, ], generationConfig: { temperature: 0.7, maxOutputTokens: 256, },});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();if (result.kind !== "json") throw new Error("expected a JSON result");console.log("text:", result.data.candidates[0].content.parts[0].text);
# 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.curl https://api.comfy.org/v2/models/vertexai/gemini-2.5-flash/requests \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"contents\": [{\"role\":\"user\",\"parts\":[{\"text\":\"Describe a single red maple leaf on a white background in one sentence.\"}]}], \"generationConfig\": {\"temperature\":0.7,\"maxOutputTokens\":256}}"# 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-2.5-flash/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-2.5-flash/requests/$REQUEST_ID \ -H "X-API-Key: $COMFY_API_KEY"
スキーマ
入力
フィールドは Google が公開している API 仕様に従っており、CI でその仕様と照合されます。このモデルに対する Router 独自のスキーマはまだ公開されていないため、リクエストは検証されずにプロバイダーへ転送されます。
{ "contents": [ { "role": "user", "parts": [ { "text": "Describe a single red maple leaf on a white background in one sentence." } ] } ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256 }}
出力
{ "candidates": [ { "content": { "role": "model", "parts": [ { "text": "A single red maple leaf rests on a plain white background, its edges sharp and its color deep." } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 18, "candidatesTokenCount": 24 }}