🌐 通用API调用(测试) @炮老师的小课堂
One node for OpenAI, Claude, Gemini mirrors, or any API you name
- 🖼️ 图像1
- 🖼️ 图像2
- 🖼️ 图像3
- 🖼️ 图像4
- 🎬 视频
- 🎵 音频
- AI回复
- response
- raw_json
- image
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-keyin a header; OpenAI-style wantsAuthorizationwith 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.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| 🎯 系统角色 | STRING | 你是一个专业的AI助手 | — |
| 💬 用户输入 | STRING | 请分析这个内容 | — |
| 🤖 模型名称 | STRING | gpt-4-vision-preview | — |
| 🌐 API地址 | STRING | https://api.openai.com/v1/chat/completions | — |
| 🔑 API密钥 | STRING | — | |
| 📡 请求方法 | COMBO | POST | 4 options: POST, GET, PUT, DELETE |
| 🔐 密钥位置 | COMBO | Header | 3 options: Header, Query, Body |
| 📝 密钥字段名 | STRING | Authorization | — |
| 🖼️ 图像1opt | IMAGE | — | |
| 🖼️ 图像2opt | IMAGE | — | |
| 🖼️ 图像3opt | IMAGE | — | |
| 🖼️ 图像4opt | IMAGE | — | |
| 🎬 视频opt | IMAGE | — | |
| 🎵 音频opt | AUDIO | — | |
| 🎬 视频文件路径opt | STRING | — | |
| 🎵 音频文件路径opt | STRING | — | |
| 🎯 响应提取路径opt | STRING | — | |
| ⏱️ 超时时间opt | INT | 1801–300 | — |
| 📋 额外Headersopt | STRING | {} | — |
| 📦 额外Body字段opt | STRING | {} | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| AI回复 | STRING | — |
| response | STRING | — |
| raw_json | STRING | — |
| image | IMAGE | — |