Nodes/ComfyUI-dapaoAPI/🌐 通用API调用(测试) @炮老师的小课堂
ComfyUI Node

🌐 通用API调用(测试) @炮老师的小课堂

One node for OpenAI, Claude, Gemini mirrors, or any API you name

By paolaoshi·Created 10 months ago·Updated a day ago· 217
🌐 通用API调用(测试) @炮老师的小课堂
  • 🖼️ 图像1
  • 🖼️ 图像2
  • 🖼️ 图像3
  • 🖼️ 图像4
  • 🎬 视频
  • 🎵 音频
  • AI回复
  • response
  • raw_json
  • image
🎯 系统角色你是一个专业的AI助手
💬 用户输入请分析这个内容
🤖 模型名称gpt-4-vision-preview
🌐 API地址https://api.openai.com/v1/chat/completions
🔑 API密钥
📡 请求方法POST
🔐 密钥位置Header
📝 密钥字段名Authorization
🎬 视频文件路径
🎵 音频文件路径
🎯 响应提取路径
⏱️ 超时时间180
📋 额外Headers{}
📦 额外Body字段{}

Every once in a while a pack ships a node that's basically "HTTP client with a ComfyUI skin," and that's genuinely more useful than it sounds. UniversalAPINode ("🌐 通用API调用(测试) @炮老师的小课堂") lets you call any HTTP API from the canvas: you supply the URL, the method, the key and where it goes, the body - and it handles chat-completions-style responses, including extracting text and decoding an image if the API returns one. The README's own description is the best one: "支持任意 HTTP API" - OpenAI, Claude, Gemini, or any third-party endpoint.

What you configure

  • 🎯 系统角色 and 💬 用户输入 - the prompt materials, bundled into a standard chat-completions payload.
  • 🤖 模型名称 - free text; whatever the endpoint expects.
  • 🌐 API地址 - the full URL, including path. Default https://api.openai.com/v1/chat/completions.
  • 🔑 API密钥, 📡 请求方法 (POST/GET/PUT/DELETE), 🔐 密钥位置 (Header/Query/Body), 📝 密钥字段名 - the auth stack. The README's config examples show the two common shapes: Gemini official wants x-goog-api-key in a header; OpenAI-style wants Authorization with a Bearer prefix the node adds for you.

Optional media is where the multimodal bit lives: 🖼️ 图像1–4, 🎬 视频, 🎵 音频, plus 视频文件路径 and 音频文件路径 strings for files already on disk. Video gets sampled into keyframes for models that can't take raw video; audio only reaches models that accept it. There's also 🎯 响应提取路径 (pull a specific field out of the response JSON), ⏱️ 超时时间, 📋 额外Headers, 📦 额外Body字段.

Outputs: AI回复 (the extracted text answer), response (the full response string), raw_json, and image (IMAGE - the node tries to decode an image if the API returned one, so it can double as a generation client).

The README's Gemini special-casing

The README claims the node auto-detects the official Gemini API, prefers the SDK, and falls back to REST on SDK failure. The practical upshot: for Google's endpoint you can often get away with the domain plus a x-goog-api-key header, and the node normalizes model names for you. For everyone else, it's a plain POST.

Install and the standing advice

cd ComfyUI/custom_nodes/
git clone https://github.com/paolaoshi/ComfyUI-dapaoAPI.git
cd ComfyUI-dapaoAPI
pip install -r requirements.txt

Restart, then paste keys into the node (they're not written to files, per the pack's design). No models download.

Now the part that matters: this node is a raw key-carrying network client, and the KB's external-API essay names this exact shape the riskiest in the ecosystem - the one that already shipped malware once. A node that holds your key and calls anywhere is only as safe as what you tell it to call and what you install alongside it. Practically: this is a fantastic Swiss-army tool for testing an API before you build a workflow around it, and a terrible place to keep long-term credentials from endpoints you haven't audited. Also remember the beta label - field names can shuffle between releases, so keep the pack updated. And if a call returns something weird, the 原始 raw_json output is your debugger.

Category🤖dapaoAPI/🔮API通用工具🔮

Inputs (20)

NameTypeDefaultDescription
🎯 系统角色STRING你是一个专业的AI助手
💬 用户输入STRING请分析这个内容
🤖 模型名称STRINGgpt-4-vision-preview
🌐 API地址STRINGhttps://api.openai.com/v1/chat/completions
🔑 API密钥STRING
📡 请求方法COMBOPOST4 options: POST, GET, PUT, DELETE
🔐 密钥位置COMBOHeader3 options: Header, Query, Body
📝 密钥字段名STRINGAuthorization
🖼️ 图像1optIMAGE
🖼️ 图像2optIMAGE
🖼️ 图像3optIMAGE
🖼️ 图像4optIMAGE
🎬 视频optIMAGE
🎵 音频optAUDIO
🎬 视频文件路径optSTRING
🎵 音频文件路径optSTRING
🎯 响应提取路径optSTRING
⏱️ 超时时间optINT1801–300
📋 额外HeadersoptSTRING{}
📦 额外Body字段optSTRING{}

Outputs (4)

NameTypeDescription
AI回复STRING
responseSTRING
raw_jsonSTRING
imageIMAGE