openrouter/images 的 API 参考,由 Comfy Router 从 Openrouter 提供。
输入: 文本、图像 · 输出: 图像
请求设置
在你的 Comfy 工作区中创建一个密钥,并将其导出为COMFY_API_KEY。对于 Python,运行 pip install comfy-sdk。对于 TypeScript,运行 npm install @comfyorg/sdk。cURL 使用原始 HTTP。
模型 ID: openrouter/images
端点: POST https://api.comfy.org/v2/models/openrouter/images
此模型没有可运行的请求示例。请根据下方的输入文档构建请求体,然后将其与 Router 快速入门配合使用。
Schema
输入
是否允许备用提供商处理请求
- true:(默认)当主提供商(或“order”中的自定义提供商)不可用时,使用下一个最佳提供商。
- false: 仅使用主提供商/自定义提供商,如果其不可用,则返回上游错误。
数据收集设置。如果没有可用的模型提供商满足该要求,你的请求将返回错误。
- allow:(默认)允许会长期存储用户数据并可能基于这些数据进行训练的提供商
- deny: 仅使用不收集用户数据的提供商。
`AkashML`, `AI21`, `AionLabs`, `Alibaba`, `Ambient`, `Baidu`, `Amazon Bedrock`, `Amazon Nova`, `Anthropic`, `Arcee AI`, `AtlasCloud`, `Avian`, `Azure`, `BaseTen`, `BytePlus`, `Black Forest Labs`, `Cerebras`, `Chutes`, `Cirrascale`, `Clarifai`, `Cloudflare`, `Cohere`, `Crucible`, `Crusoe`, `DeepInfra`, `DeepSeek`, `DekaLLM`, `Featherless`, `Fireworks`, `Friendli`, `GMICloud`, `Google`, `Google AI Studio`, `Groq`, `Hyperbolic`, `Inception`, `Inceptron`, `InferenceNet`, `Ionstream`, `Infermatic`, `Io Net`, `Inflection`, `Liquid`, `Mara`, `Mancer 2`, `Minimax`, `ModelRun`, `Mistral`, `Modular`, `Moonshot AI`, `Morph`, `NCompass`, `Nebius`, `Nex AGI`, `NextBit`, `Novita`, `Nvidia`, `OpenAI`, `OpenInference`, `Parasail`, `Poolside`, `Perceptron`, `Perplexity`, `Phala`, `Recraft`, `Reka`, `Relace`, `SambaNova`, `Seed`, `SiliconFlow`, `Sourceful`, `StepFun`, `Stealth`, `StreamLake`, `Switchpoint`, `Together`, `Upstage`, `Venice`, `WandB`, `Xiaomi`, `xAI`, `Z.AI`, `FakeProvider` | string[]
要忽略的提供商 slug 列表。若提供,此列表会与你账户范围内针对此请求忽略的提供商设置合并。
`AkashML`, `AI21`, `AionLabs`, `Alibaba`, `Ambient`, `Baidu`, `Amazon Bedrock`, `Amazon Nova`, `Anthropic`, `Arcee AI`, `AtlasCloud`, `Avian`, `Azure`, `BaseTen`, `BytePlus`, `Black Forest Labs`, `Cerebras`, `Chutes`, `Cirrascale`, `Clarifai`, `Cloudflare`, `Cohere`, `Crucible`, `Crusoe`, `DeepInfra`, `DeepSeek`, `DekaLLM`, `Featherless`, `Fireworks`, `Friendli`, `GMICloud`, `Google`, `Google AI Studio`, `Groq`, `Hyperbolic`, `Inception`, `Inceptron`, `InferenceNet`, `Ionstream`, `Infermatic`, `Io Net`, `Inflection`, `Liquid`, `Mara`, `Mancer 2`, `Minimax`, `ModelRun`, `Mistral`, `Modular`, `Moonshot AI`, `Morph`, `NCompass`, `Nebius`, `Nex AGI`, `NextBit`, `Novita`, `Nvidia`, `OpenAI`, `OpenInference`, `Parasail`, `Poolside`, `Perceptron`, `Perplexity`, `Phala`, `Recraft`, `Reka`, `Relace`, `SambaNova`, `Seed`, `SiliconFlow`, `Sourceful`, `StepFun`, `Stealth`, `StreamLake`, `Switchpoint`, `Together`, `Upstage`, `Venice`, `WandB`, `Xiaomi`, `xAI`, `Z.AI`, `FakeProvider` | string[]
要允许的提供商 slug 列表。若提供,此列表会与你账户范围内针对此请求允许的提供商设置合并。
`AkashML`, `AI21`, `AionLabs`, `Alibaba`, `Ambient`, `Baidu`, `Amazon Bedrock`, `Amazon Nova`, `Anthropic`, `Arcee AI`, `AtlasCloud`, `Avian`, `Azure`, `BaseTen`, `BytePlus`, `Black Forest Labs`, `Cerebras`, `Chutes`, `Cirrascale`, `Clarifai`, `Cloudflare`, `Cohere`, `Crucible`, `Crusoe`, `DeepInfra`, `DeepSeek`, `DekaLLM`, `Featherless`, `Fireworks`, `Friendli`, `GMICloud`, `Google`, `Google AI Studio`, `Groq`, `Hyperbolic`, `Inception`, `Inceptron`, `InferenceNet`, `Ionstream`, `Infermatic`, `Io Net`, `Inflection`, `Liquid`, `Mara`, `Mancer 2`, `Minimax`, `ModelRun`, `Mistral`, `Modular`, `Moonshot AI`, `Morph`, `NCompass`, `Nebius`, `Nex AGI`, `NextBit`, `Novita`, `Nvidia`, `OpenAI`, `OpenInference`, `Parasail`, `Poolside`, `Perceptron`, `Perplexity`, `Phala`, `Recraft`, `Reka`, `Relace`, `SambaNova`, `Seed`, `SiliconFlow`, `Sourceful`, `StepFun`, `Stealth`, `StreamLake`, `Switchpoint`, `Together`, `Upstage`, `Venice`, `WandB`, `Xiaomi`, `xAI`, `Z.AI`, `FakeProvider` | string[]
按顺序排列的提供商 slug 列表。路由器会尝试使用此列表子集中第一个支持你所请求模型的提供商,如果该提供商不可用,则回退到下一个。如果没有任何提供商可用,请求将失败并返回报错信息。
首选最大延迟(以秒为单位)。可以是数字(应用于 p50),也可以是包含按百分位设置的截止值的对象。高于阈值的端点仍可能被使用,但在路由中的优先级会降低。使用回退模型时,如果回退模型满足阈值,这可能导致改用回退模型而不是主模型。
首选最小吞吐量(以每秒 token 数为单位)。可以是数字(应用于 p50),也可以是包含按百分位设置的截止值的对象。低于阈值的端点仍可能被使用,但在路由中的优先级会降低。使用回退模型时,如果回退模型满足阈值,这可能导致改用回退模型而不是主模型。
GET /v2/models/openrouter/images/openapi.json 提供的 schema 生成,该文档也是它在请求到达提供商之前用于校验调用的同一份文档。### 输出
输出
Base64 编码的图像数据。当响应大于 1,048,576 字节时,Comfy Router 会用
url 取而代之。当响应不大于该值时,或图像上传到 Comfy 存储失败时,图像仍保留在此字段中。由 Comfy 托管的图像签名 URL,当响应大于 1,048,576 字节时以其替代
b64_json 返回。Comfy Router 始终会请求它;/proxy/ 路由仅在请求发送 Comfy-Asset-Format: url 时才会请求它。零数据保留工作区永远不会获得它:其图像仍保留在 b64_json 中。该 URL 在调用后 24 小时过期。示例
输出
发布前须知
SDK 会生成Idempotency-Key 并在自动重试中复用它。手动重试时,请复用原始 key。Router 最长可保持连接 10 分钟。
请求失败时,Router 会发送 X-Comfy-Error-Type 响应头说明原因。422 表示 Router 在调用提供商之前就拒绝了输入,413 表示请求体超出了 Router 可接受的大小。已生成的资源请及时下载,因为结果 URL 会过期。
上文任何字段描述中提到的尺寸限制,都是提供商对该字段自身的限定,引自提供商的规范。Router 会对整个请求体另行设置上限,base64 编码的媒体内容也计入其中:参见请求体大小。
本页记录的是通过 Comfy Router 调用的某一个合作伙伴模型。同一个 comfy-sdk / @comfyorg/sdk 包还提供第二个客户端,用于在 Comfy Cloud 上运行完整的 ComfyUI 工作流图:Comfy(api_key=...) / new Comfy({ apiKey }),并带有 client.workflows、client.assets 和 client.jobs。请参阅 Comfy SDKs。
请求头
身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
使用 Router API
模型发现、验证错误、重试与计费。
限制
Router 目前不支持的功能,以及替代方案。