越光 API 连接 / YueGuang API Connector
25 LLMs behind one dropdown, with the prices printed on the labels
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- text
- model_id
- usage_stats
Paying full price for every LLM API you touch is a hobby this node quietly kills. 越光 API 连接 / YueGuang API Connector is a connector for YueGuang (Nebula), a Chinese LLM aggregator that fronts OpenAI, Anthropic, DeepSeek and Kimi behind one OpenAI-compatible endpoint (llm.ai-nebula.com/v1/chat/completions). One API key, 25 models, and - the genuinely nice touch - every dropdown option has its price baked into the label, like deepseek-v4-flash [入$0.1/M 出$0.3/M] (in/out per million tokens). The default model is the cheapest thing on the list, deliberately, so a mistriggered node costs you pocket change.
It's a sibling of the pack's ZenMux node with the same interface, so you can swap aggregators by rewiring one node. If you want the same shape with 130+ models and vendor-prefixed ids, that's the ZenMux article.
What it does
Text generation and vision (up to six images) through one chat-completions call. The model registry is built into the pack (yueguang/model_registry.py) rather than fetched live - YueGuang has no enumerable models endpoint, so the list comes from the official spec docs and updates mean editing that table. No network round-trip for the list, and no risk of an empty dropdown because a fetch failed.
Two engineering habits carry over from the author's API-node work and both save you real pain. First, base_url defaults to a value without :// - the ComfyUI frontend eats the protocol fragment, so the backend appends it. Don't type https://, or you'll wonder why the URL comes out mangled. Second, adaptive retry: some newer models deprecate temperature or demand max_completion_tokens instead of max_tokens. When the API answers 400, the node strips or renames the offending parameter and retries automatically - normal requests cost nothing extra.
Inputs and outputs
- api_key - your YueGuang key (
sk-...). The workflow saves it into the JSON, so clear it before sharing. - model - 25 price-tagged choices; search
gpt/claude/deepseek/kimito filter. Note ids have no vendor prefix here (gpt-4o, notopenai/gpt-4o) - same-vendor options cluster together in the sort. - system_prompt / user_prompt - role and the actual ask. Output-format rules ("only return JSON") belong in the system prompt.
- seed - mostly a "force re-run" lever; most of these models won't truly reproduce anyway.
Optional: temperature, top_p (leave at 1.0 and drive with temperature), max_tokens, image_1…image_6 (vision models only, resized to image_max_size and base64'd), detail (low/auto/high), image_max_size (default 1024 - smaller is cheaper), proxy_url (127.0.0.1:7890 style, no protocol), usd_to_cny (only affects the cost display).
Outputs: text, model_id, and usage_stats - a five-line cost report: token counts, output characters, vendor, model with unit prices, and the dollar/CNY conversion.
Gotchas
If a vision model ignores your images, you picked a text-only model - the dropdown doesn't gate it for you. If a call errors and you don't see a retry note, check the ComfyUI console; the parameter-fix path logs there. And if your usage_stats looks wrong, check usd_to_cny against today's rate - it's display math only, never the actual bill.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | 越光的 API Key(形如 sk-xxxxxxxx)。 ⚠ 工作流会连同此值一起保存,分享 json 前记得清空。 | |
| model | COMBO | deepseek-v4-flash [入$0.1/M 出$0.3/M] | 模型,标签里直接带了输入/输出单价(USD/百万 token)。 越光的 model id 不带厂商前缀,下拉里同厂商是靠排序 聚在一起的 —— 在下拉的搜索框输 gpt / claude / deepseek / kimi 即可快速过滤。 默认 deepseek-v4-flash 是表里最便宜的($0.1/$0.3)。 |
| system_prompt | STRING | You are a helpful assistant. | 系统提示词:设定模型的角色与总体行为准则。 输出格式要求(如「只返回 JSON」)写在这里最稳定。 |
| user_prompt | STRING | 用户提示词:这一次具体要模型做什么。 | |
| seed | INT | 00–18446744073709550000 | 随机种子。多数模型并不真正支持复现, 这里主要用于强制节点重新执行(改了它就不会走缓存)。 |
| temperatureopt | FLOAT | 0.70–2 | 采样温度:越低越稳定保守,越高越发散。 结构化输出用 0~0.3,创意文案用 0.7~1.0。 部分新模型已弃用该参数,节点会自动剔除后重试。 |
| top_popt | FLOAT | 1.000–1 | 核采样:只在累计概率前 top_p 的词里挑。 与温度作用重叠,一般固定 1.0 只调温度,别两个一起动。 |
| max_tokensopt | INT | 10241–200000 | 回复的最大长度上限。设小了会把回答从中间截断。 注意它同时是费用上限的重要因素。 |
| image_1opt | IMAGE | 要一并发给模型的图像 1(需所选模型支持视觉)。 会按下方最大边长压缩后转 base64 提交。 | |
| image_2opt | IMAGE | 图像 2。 | |
| image_3opt | IMAGE | 图像 3。 | |
| image_4opt | IMAGE | 图像 4。 | |
| image_5opt | IMAGE | 图像 5。 | |
| image_6opt | IMAGE | 图像 6。图越多越贵、越慢。 | |
| detailopt | COMBO | auto | 图像细节级别: low 便宜快速,只看大致内容; high 切块细看,认小字/细节更准但更贵; auto 由服务端决定。 |
| image_max_sizeopt | INT | 1024256–4096 | 上传前把图缩放到的最大边长。 调小可显著省钱提速,但小字与细节会看不清。 |
| base_urlopt | STRING | llm.ai-nebula.com/v1 | 接口地址,一般不用改。 **不要写 https://** —— ComfyUI 前端会吞掉 "://", 协议由后端自动补全,这里只填域名和路径。 |
| proxy_urlopt | STRING | HTTP 代理,同样不要带协议前缀,只填 IP:端口, 例如 127.0.0.1:7890。留空表示直连。 | |
| max_retriesopt | INT | 30–10 | 网络失败后的自动重连次数,0 表示不重连。 会触发重连的情况:SSL 握手被打断 (SSLEOFError)、连接被重置、读超时、响应体 截断,以及 429 限流和 5xx 服务端临时故障。 不会重连的情况:参数类 400、鉴权类 401/403 —— 这些重试多少次都是同样的结果。 退避按 1s→2s→4s 指数增长并带随机抖动,避免 多个节点同时重连再次压垮服务端;服务端给了 Retry-After 时以它为准。 |
| timeoutopt | INT | 18010–1800 | 单次请求的超时秒数。 长文本或多图推理较慢时可调大。 超时会计入上面的重连次数。 |
| usd_to_cnyopt | FLOAT | 7.200.1–100 | 美元兑人民币汇率,仅用于把 usage_stats 输出里的 费用换算成人民币显示,不影响实际计费。 可按当日牌价自行调整。 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| model_id | STRING | — |
| usage_stats | STRING | — |