Nodes/ComfyUI-QING/URL Gemini图像编辑丨API
ComfyUI Node

URL Gemini图像编辑丨API

Gemini image editing against the gateway of your choice

By sheengoa·Created about a year ago·Updated 19 days ago· 16
URL Gemini图像编辑丨API
  • image
  • image2
  • image3
  • image
  • raw_response
  • status
  • debug_info
prompt
custom_headers_json
extra_body_json
base_url
model
api_key_override
api_key_modeAuthorization Bearer
aspect_ratio1:1
image_size1K
response_modalitiesIMAGE
timeout_sec300

The stock GeminiEditAPI only talks to Google AI Studio. CustomURLGeminiImageEditAPI is the version that lets you point Gemini's image-editing capability at whatever base URL you like - Google's native endpoint, a Vertex-style setup, or one of the reseller gateways (the pack's own tooltip suggests https://api.apiyi.com as an example) that proxy Gemini image models with easier billing. If you've been burned by the friction of a Google Cloud project, this node is the "paste a gateway key and go" route. The cost tradeoffs - reseller undercutting, region access, looser onboarding - are the ones the KB's external-API essay documents for the whole Nano-Banana-style proxy layer.

It's part of ComfyUI-QING's API category. Mechanically it's a different animal from the OpenAI-style nodes: this one calls Gemini's generateContent REST format directly, not chat completions.

How it works. You give it a base_url (the Gemini-compatible root, e.g. https://api.apiyi.com) and a model ID (the tooltip's example is gemini-3-pro-image-preview). It builds a generateContent request: your prompt becomes the first text part, and the image(s) - up to three via image2/image3 - are attached as independent inlineData parts. Then the Gemini-specific controls kick in: aspect_ratio (ten ratios from 1:1 to 21:9), image_size (1K/2K/4K), and response_modalities (IMAGE or TEXT,IMAGE) map into generationConfig. The key-sending mode is the thing most people get wrong, and it's a dropdown: Authorization Bearer (what gateways usually want), x-goog-api-key (native Gemini style), query key, or none for endpoints with no auth.

The inputs that matter.

  • prompt - the edit instruction.
  • image - required; the main image to edit.
  • base_url and model - the gateway root and its model ID.
  • api_key_mode - pick Bearer for gateways, x-goog-api-key for native Gemini.
  • aspect_ratio, image_size, response_modalities - the output geometry/format controls.
  • timeout_sec (default 300 - image generation is slow).
  • Optional: image2/image3, custom_headers_json, extra_body_json, api_key_override.

Outputs: image (IMAGE), raw_response, status, debug_info.

How to install. ComfyUI-QING is a one-pack install - search "ComfyUI-QING" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/GAO-SHIQING/ComfyUI-QING
cd ComfyUI-QING
python install_dependencies.py

Restart after installing. The README's clone URL is typo'd (GAOSHI-QING, missing the H) - use the URL above or Manager.

Troubleshooting. api_key_mode is where almost everyone stumbles: a gateway that expects Authorization: Bearer will 401 if you leave the node in the native x-goog-api-key mode, and vice versa - switch the dropdown before you question the key itself. Second, base_url must be the Gemini-compatible root, not a /v1/chat/completions endpoint - this node doesn't speak OpenAI format. Third, if you get "modalities" errors, check response_modalities against what the gateway supports (TEXT,IMAGE needs a model that returns text alongside the image). And the honest cautions: gateways may run looser moderation than Google's first party, but the model still enforces its own refusals; your images go to a third party; and the "reseller undercutting" price is real but so is the risk of an unknown endpoint handling your prompts - only point this at a gateway you have a reason to trust.

CategoryQING/API

Inputs (14)

NameTypeDefaultDescription
promptSTRING图像编辑指令,只作为第一个 text part 发送
custom_headers_jsonSTRING可选JSON对象,例如 {"X-API-Key":"..."}
extra_body_jsonSTRING可选JSON对象,会合并进请求体顶层
imageIMAGE要编辑的主图像
base_urlSTRINGGemini兼容服务根地址,如 https://api.apiyi.com
modelSTRINGGemini图像模型ID,如 gemini-3-pro-image-preview
api_key_overrideSTRING仅当前节点生效;留空时读取 CUSTOM_URL_API_KEY 或 QING custom_url_api_key
api_key_modeCOMBOAuthorization BearerAPI密钥发送方式:网关常用Bearer,Gemini原生常用x-goog-api-key或query key
aspect_ratioCOMBO1:110 options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, +4
image_sizeCOMBO1K3 options: 1K, 2K, 4K
response_modalitiesCOMBOIMAGEgenerationConfig.responseModalities
timeout_secINT3005–900
image2optIMAGE可选第二张参考图,作为独立 inlineData part 发送
image3optIMAGE可选第三张参考图,作为独立 inlineData part 发送

Outputs (4)

NameTypeDescription
imageIMAGE
raw_responseSTRING
statusSTRING
debug_infoSTRING