stefanionescu/comfyui-openrouter

ComfyUI extension for OpenRouter models

Python

0

38 commits

updated Sep 24, 2026

See the code

See what people are saying

SourceMessageScoreDate

Show HN: ComfyUI Extension for OpenRouter Models

1

Sep 24, 2026

README

ComfyUI OpenRouter

This is a ComfyUI extension that runs any model on OpenRouter with your own API key. It has six kinds of nodes:

  • Chat: ask a model a question, with images, video, audio, or documents. Get back text, images, or speech.
  • Image: generate and edit images, including masks and SVG files.
  • Video: make a video from a prompt, frames, or reference media.
  • Audio: turn text into speech, optionally in a cloned voice, and speech into text with timestamps and subtitles.
  • Search: turn text and images into embeddings, and rank them against a query.
  • Decisions: ask Jev, OpenRouter's decision model, questions it answers with probabilities. A workflow can branch on the answers.

Requests go from your ComfyUI server to OpenRouter, which passes them to the model's provider and bills your OpenRouter account. Every run of a paid node is billed, so check the model's price in OpenRouter models before you run it.

Contents

Requirements

  • Python 3.12 or later.
  • ComfyUI 0.34.6 or later, with frontend 1.49.6 or later in the 1.x series.
  • An OpenRouter account with credit, and an API key from openrouter.ai/settings/keys.
  • Network access from the ComfyUI server to openrouter.ai.

Install

  1. Stop ComfyUI.
  2. Put the extension in ComfyUI/custom_nodes/comfyui-openrouter, with __init__.py and requirements.txt directly inside that folder.
  3. Install requirements.txt with the Python that runs ComfyUI, using the command for your installation below.
  4. Start ComfyUI and reload its window.

Comfy Desktop

  1. On the home screen, open the installation's menu and select Manage.
  2. Under About, copy Location. In that folder, find the ComfyUI folder that holds main.py, and put the extension in its custom_nodes folder.
  3. Select Terminal in the same panel. It opens in the ComfyUI folder with the installation's Python. Run:
pip install -r custom_nodes/comfyui-openrouter/requirements.txt

Then start the installation. Comfy Desktop's Manage panel explains these controls.

macOS or Linux

From the ComfyUI folder, replacing .venv if your environment has another name:

.venv/bin/python -m pip install -r custom_nodes/comfyui-openrouter/requirements.txt

With uv:

uv pip install --python .venv/bin/python -r custom_nodes/comfyui-openrouter/requirements.txt

Windows

From the ComfyUI folder, in PowerShell:

.\.venv\Scripts\python.exe -m pip install -r .\custom_nodes\comfyui-openrouter\requirements.txt

Windows portable

From the folder that holds ComfyUI and python_embeded, in PowerShell:

.\python_embeded\python.exe -m pip install -r .\ComfyUI\custom_nodes\comfyui-openrouter\requirements.txt

To update or remove the extension, see the advanced guide.

First run

  1. Open ComfyUI menu → Extensions → OpenRouter → OpenRouter settings and save your API key. It is stored on the server, in the extension's private folder.
  2. Open Browse Templates → comfyui-openrouter → decision-01-verify-then-escalate, or drag its file onto the canvas.
  3. Select Run.
  4. Read the answer in Answer, and Jev's check in Summary.

To stop a run, use ComfyUI's cancel button. To send the same request again, change run number. Each request's charge is listed at openrouter.ai/activity.

Example workflows

There are 13 example workflows, and together they use every node. Most of them have Jev decide something: which image to keep, whether a draft is distorted, or whether an answer is backed by its sources.

Open one from Browse Templates → comfyui-openrouter, or drag its file onto ComfyUI. Each group has a note that says what it does; start with Start Here. Each step after the inputs is a subgraph: select the icon at its top-right corner to open it. Media inputs start empty, so add your own image, audio, or document.

Some workflows use ComfyUI's If/Else Switch (beta). It runs only the branch it picks, so you pay only for the paid nodes on that branch.

After an update, open the examples in a new tab to get the new versions.

Chat

WorkflowInputNode guide
Chat: Write a Product ListingTwo product photos and a spec sheetChat: Attach Document
Chat: Caption a Training SetA folder of imagesChat: Ask

Images

Video

Audio

WorkflowInputNode guide
Audio: Triage a VoicemailA voicemailAudio: Transcribe
Audio: Dub a ClipA short clip of one speakerAudio: Speak
WorkflowInputNode guide
Search: Answer from Help ArticlesA question and help articlesSearch: Rank
Search: Choose a Hero ImageA briefSearch: Rank

Decisions

WorkflowInputNode guide
Decision: Verify a Quick Answer, Then EscalateNotes and a questionDecision: Ask

Request Options is used in Chat: Write a Product Listing, to keep the listing away from providers that store data.

Nodes

The nodes are in the OpenRouter menu, under Chat, Image, Video, Audio, Search, and Decision. ComfyUI's node help opens each node's guide.

NodeWhat it does
Chat: AskAsks a model a question, with images, video, audio, or documents.
Chat: Attach DocumentAttaches a PDF or text file from ComfyUI's input folder.
Image: GenerateGenerates or edits images.
Video: GenerateMakes a video from a prompt, frames, or reference media.
Video: DownloadDownloads a video that OpenRouter kept making after a run stopped.
Audio: SpeakTurns text into speech, optionally in a cloned voice.
Audio: TranscribeTurns speech into text, with timed segments, words, and subtitles.
Search: EmbedTurns text and images into embeddings and compares them.
Search: RankRanks text and images by how well they match a query.
Decision: AskAsks Jev questions about a situation.
Decision: Add QuestionAdds a yes-or-no, one-choice, or score question.
Decision: Read AnswerReads one answer as text, a yes flag, and numbers.
Request OptionsSets providers, price limits, and extra request fields for the paid nodes.

The decision nodes use OpenRouter's alpha decisions API (/api/alpha/decisions), which OpenRouter may still change.

Models

The extension ships with a copy of OpenRouter's model list. To get the current list and prices, open Extensions → OpenRouter → OpenRouter models and select Refresh Models. The node dropdowns update after a refresh. The same dialog estimates prices.

To use a model that is not in the list, choose other model ID in a node's model dropdown and type its ID. You can add a suffix, such as :online for web search.

Automatic checks tell you when OpenRouter's list has changed; select Refresh Models to take the new list. See model updates.

How a run works

Node inputs ──▶ ComfyUI server (the key and settings stay here)
                  │ checks the inputs against the chosen model
                  ▼
               OpenRouter ──▶ the model's provider
                  │
                  ▼
Node outputs ◀── text, images, video, audio, and answers
  1. The node checks its inputs against the chosen model's capabilities and stops with an error on an input the model cannot take. This happens before anything is sent or billed.
  2. It waits for a free slot. At most parallel requests requests run at once; the default is 4.
  3. It sends one request from your ComfyUI server to OpenRouter with your key. OpenRouter passes it to the model's provider and bills your account.
  4. For video, the node records the job, checks it until the video is ready, and downloads it. The checks and the download are free.
  5. The node turns the reply into ComfyUI outputs. Nodes connected to an empty output, such as images from a text-only model, are skipped.
  6. Your save nodes write the files. ComfyUI reuses a result while the inputs are unchanged; change run number to send the request again.

The advanced guide lists what each node sends and returns.

Development

Development needs Git and mise. Tell the checks where ComfyUI is, in .mise.local.toml:

[env]
COMFYUI_PATH = "/path/to/ComfyUI"
COMFYUI_PYTHON = "/path/to/ComfyUI/.venv/bin/python"

Install the tools, dependencies, and Git hooks, and run the full check:

mise trust
mise run repo:setup
mise run repo:check

Restart ComfyUI after changing Python. After changing the browser code, run mise run comfy:frontend:build; after changing a workflow description, run mise run comfy:workflows:build. The advanced guide lists every task.

Common problems

ProblemFix
No OpenRouter nodes in the menuCheck that the folder is ComfyUI/custom_nodes/comfyui-openrouter, ComfyUI is 0.34.6 or later, and the console shows no import error.
No OpenRouter entry under ExtensionsCheck that web/extension.js exists in the extension's folder, then reload the window.
"Set your OpenRouter API key..."Save the key in OpenRouter settings, or set OPENROUTER_API_KEY and restart ComfyUI.
The settings cannot be changedComfyUI runs in multi-user mode or is open from another computer. Set OPENROUTER_API_KEY where ComfyUI starts instead.
A model is missing from a dropdownSelect Refresh Models in OpenRouter models, or choose other model ID and type it.
"Value not in list" for a modelOpenRouter no longer lists the model. Choose another, or type its ID in other model ID.
A video was not ready in timeOpenRouter keeps making it. Add Video: Download, choose the job, and select Run.
pydantic cannot be importedInstall requirements.txt with the Python that runs ComfyUI, then restart.
Node help is missingReinstall the whole extension, including web/docs.
The templates are missingReinstall the whole extension, including example_workflows.
Nodes or menus appear twiceKeep one comfyui-openrouter folder in custom_nodes; move copies elsewhere.

For the messages a node shows, see troubleshooting. The advanced guide also covers keys, settings, limits, prices, model updates, caching, and video recovery.

License

The code, guides, and workflows are under the MIT license. Third-party components keep their own licenses.

Contributors

stefanionescu

38 commits

stefanionescu/comfyui-openrouter

ComfyUI extension for OpenRouter models

Python

0

38 commits

updated Sep 24, 2026

See the code

See what people are saying

SourceMessageScoreDate

Show HN: ComfyUI Extension for OpenRouter Models

1

Sep 24, 2026

README

ComfyUI OpenRouter

This is a ComfyUI extension that runs any model on OpenRouter with your own API key. It has six kinds of nodes:

  • Chat: ask a model a question, with images, video, audio, or documents. Get back text, images, or speech.
  • Image: generate and edit images, including masks and SVG files.
  • Video: make a video from a prompt, frames, or reference media.
  • Audio: turn text into speech, optionally in a cloned voice, and speech into text with timestamps and subtitles.
  • Search: turn text and images into embeddings, and rank them against a query.
  • Decisions: ask Jev, OpenRouter's decision model, questions it answers with probabilities. A workflow can branch on the answers.

Requests go from your ComfyUI server to OpenRouter, which passes them to the model's provider and bills your OpenRouter account. Every run of a paid node is billed, so check the model's price in OpenRouter models before you run it.

Contents

Requirements

  • Python 3.12 or later.
  • ComfyUI 0.34.6 or later, with frontend 1.49.6 or later in the 1.x series.
  • An OpenRouter account with credit, and an API key from openrouter.ai/settings/keys.
  • Network access from the ComfyUI server to openrouter.ai.

Install

  1. Stop ComfyUI.
  2. Put the extension in ComfyUI/custom_nodes/comfyui-openrouter, with __init__.py and requirements.txt directly inside that folder.
  3. Install requirements.txt with the Python that runs ComfyUI, using the command for your installation below.
  4. Start ComfyUI and reload its window.

Comfy Desktop

  1. On the home screen, open the installation's menu and select Manage.
  2. Under About, copy Location. In that folder, find the ComfyUI folder that holds main.py, and put the extension in its custom_nodes folder.
  3. Select Terminal in the same panel. It opens in the ComfyUI folder with the installation's Python. Run:
pip install -r custom_nodes/comfyui-openrouter/requirements.txt

Then start the installation. Comfy Desktop's Manage panel explains these controls.

macOS or Linux

From the ComfyUI folder, replacing .venv if your environment has another name:

.venv/bin/python -m pip install -r custom_nodes/comfyui-openrouter/requirements.txt

With uv:

uv pip install --python .venv/bin/python -r custom_nodes/comfyui-openrouter/requirements.txt

Windows

From the ComfyUI folder, in PowerShell:

.\.venv\Scripts\python.exe -m pip install -r .\custom_nodes\comfyui-openrouter\requirements.txt

Windows portable

From the folder that holds ComfyUI and python_embeded, in PowerShell:

.\python_embeded\python.exe -m pip install -r .\ComfyUI\custom_nodes\comfyui-openrouter\requirements.txt

To update or remove the extension, see the advanced guide.

First run

  1. Open ComfyUI menu → Extensions → OpenRouter → OpenRouter settings and save your API key. It is stored on the server, in the extension's private folder.
  2. Open Browse Templates → comfyui-openrouter → decision-01-verify-then-escalate, or drag its file onto the canvas.
  3. Select Run.
  4. Read the answer in Answer, and Jev's check in Summary.

To stop a run, use ComfyUI's cancel button. To send the same request again, change run number. Each request's charge is listed at openrouter.ai/activity.

Example workflows

There are 13 example workflows, and together they use every node. Most of them have Jev decide something: which image to keep, whether a draft is distorted, or whether an answer is backed by its sources.

Open one from Browse Templates → comfyui-openrouter, or drag its file onto ComfyUI. Each group has a note that says what it does; start with Start Here. Each step after the inputs is a subgraph: select the icon at its top-right corner to open it. Media inputs start empty, so add your own image, audio, or document.

Some workflows use ComfyUI's If/Else Switch (beta). It runs only the branch it picks, so you pay only for the paid nodes on that branch.

After an update, open the examples in a new tab to get the new versions.

Chat

WorkflowInputNode guide
Chat: Write a Product ListingTwo product photos and a spec sheetChat: Attach Document
Chat: Caption a Training SetA folder of imagesChat: Ask

Images

Video

Audio

WorkflowInputNode guide
Audio: Triage a VoicemailA voicemailAudio: Transcribe
Audio: Dub a ClipA short clip of one speakerAudio: Speak
WorkflowInputNode guide
Search: Answer from Help ArticlesA question and help articlesSearch: Rank
Search: Choose a Hero ImageA briefSearch: Rank

Decisions

WorkflowInputNode guide
Decision: Verify a Quick Answer, Then EscalateNotes and a questionDecision: Ask

Request Options is used in Chat: Write a Product Listing, to keep the listing away from providers that store data.

Nodes

The nodes are in the OpenRouter menu, under Chat, Image, Video, Audio, Search, and Decision. ComfyUI's node help opens each node's guide.

NodeWhat it does
Chat: AskAsks a model a question, with images, video, audio, or documents.
Chat: Attach DocumentAttaches a PDF or text file from ComfyUI's input folder.
Image: GenerateGenerates or edits images.
Video: GenerateMakes a video from a prompt, frames, or reference media.
Video: DownloadDownloads a video that OpenRouter kept making after a run stopped.
Audio: SpeakTurns text into speech, optionally in a cloned voice.
Audio: TranscribeTurns speech into text, with timed segments, words, and subtitles.
Search: EmbedTurns text and images into embeddings and compares them.
Search: RankRanks text and images by how well they match a query.
Decision: AskAsks Jev questions about a situation.
Decision: Add QuestionAdds a yes-or-no, one-choice, or score question.
Decision: Read AnswerReads one answer as text, a yes flag, and numbers.
Request OptionsSets providers, price limits, and extra request fields for the paid nodes.

The decision nodes use OpenRouter's alpha decisions API (/api/alpha/decisions), which OpenRouter may still change.

Models

The extension ships with a copy of OpenRouter's model list. To get the current list and prices, open Extensions → OpenRouter → OpenRouter models and select Refresh Models. The node dropdowns update after a refresh. The same dialog estimates prices.

To use a model that is not in the list, choose other model ID in a node's model dropdown and type its ID. You can add a suffix, such as :online for web search.

Automatic checks tell you when OpenRouter's list has changed; select Refresh Models to take the new list. See model updates.

How a run works

Node inputs ──▶ ComfyUI server (the key and settings stay here)
                  │ checks the inputs against the chosen model
                  ▼
               OpenRouter ──▶ the model's provider
                  │
                  ▼
Node outputs ◀── text, images, video, audio, and answers
  1. The node checks its inputs against the chosen model's capabilities and stops with an error on an input the model cannot take. This happens before anything is sent or billed.
  2. It waits for a free slot. At most parallel requests requests run at once; the default is 4.
  3. It sends one request from your ComfyUI server to OpenRouter with your key. OpenRouter passes it to the model's provider and bills your account.
  4. For video, the node records the job, checks it until the video is ready, and downloads it. The checks and the download are free.
  5. The node turns the reply into ComfyUI outputs. Nodes connected to an empty output, such as images from a text-only model, are skipped.
  6. Your save nodes write the files. ComfyUI reuses a result while the inputs are unchanged; change run number to send the request again.

The advanced guide lists what each node sends and returns.

Development

Development needs Git and mise. Tell the checks where ComfyUI is, in .mise.local.toml:

[env]
COMFYUI_PATH = "/path/to/ComfyUI"
COMFYUI_PYTHON = "/path/to/ComfyUI/.venv/bin/python"

Install the tools, dependencies, and Git hooks, and run the full check:

mise trust
mise run repo:setup
mise run repo:check

Restart ComfyUI after changing Python. After changing the browser code, run mise run comfy:frontend:build; after changing a workflow description, run mise run comfy:workflows:build. The advanced guide lists every task.

Common problems

ProblemFix
No OpenRouter nodes in the menuCheck that the folder is ComfyUI/custom_nodes/comfyui-openrouter, ComfyUI is 0.34.6 or later, and the console shows no import error.
No OpenRouter entry under ExtensionsCheck that web/extension.js exists in the extension's folder, then reload the window.
"Set your OpenRouter API key..."Save the key in OpenRouter settings, or set OPENROUTER_API_KEY and restart ComfyUI.
The settings cannot be changedComfyUI runs in multi-user mode or is open from another computer. Set OPENROUTER_API_KEY where ComfyUI starts instead.
A model is missing from a dropdownSelect Refresh Models in OpenRouter models, or choose other model ID and type it.
"Value not in list" for a modelOpenRouter no longer lists the model. Choose another, or type its ID in other model ID.
A video was not ready in timeOpenRouter keeps making it. Add Video: Download, choose the job, and select Run.
pydantic cannot be importedInstall requirements.txt with the Python that runs ComfyUI, then restart.
Node help is missingReinstall the whole extension, including web/docs.
The templates are missingReinstall the whole extension, including example_workflows.
Nodes or menus appear twiceKeep one comfyui-openrouter folder in custom_nodes; move copies elsewhere.

For the messages a node shows, see troubleshooting. The advanced guide also covers keys, settings, limits, prices, model updates, caching, and video recovery.

License

The code, guides, and workflows are under the MIT license. Third-party components keep their own licenses.

Contributors

stefanionescu

38 commits

Languages

Python

69.4%

JavaScript

19.8%

TypeScript

5.6%

Shell

4.5%