OpenRouter API (Tlant V1)
Every LLM Under One Node — With a Cache That Doesn't Waste Your Credits
- images
- response_text
- reasoning_content
OpenRouter is the "one key for a hundred models" service - Google, Anthropic, DeepSeek, xAI, all behind a single API key and a single endpoint. This node puts that inside your graph: pick a model, type a prompt, and the response lands as a string you can feed straight into your text encoder. It's also the most polished node in the Tlant pack, and the caching behavior is the reason why.
How it works
The headline feature is the cache. ComfyUI re-executes a node when IS_CHANGED says its inputs changed, and this node hashes every input - including the image tensor, which it fingerprints by shape plus sum. Same inputs, same seed, same output: the API call is skipped entirely and you get the cached result. Bump the seed and it makes a fresh call. For prompt-rewriting workflows where you iterate on one variable, that means you only pay for calls you actually change - a real credit-saver with paid models.
The request itself is a standard chat-completions call: system prompt, user prompt, temperature, top_p, max_tokens, optional images. For vision models, images are encoded to base64 PNGs and sent as data: URLs with an image_detail level (auto/low/high). It sets the OpenRouter-required attribution headers (HTTP-Referer pointing at ComfyUI, X-Title naming the pack), prints token usage to the console, and - the genuinely thoughtful part - parses out reasoning_content separately from the final answer.
Inputs that matter
model_name(defaultxiaomi/mimo-v2-flash) - OpenRouter'svendor/modelidentifier, e.g.google/gemini-2.5-pro-preview.api_key- yoursk-or-v1-...key. No key, no calls.system_prompt/user_prompt- the conversation. Both have optional_inputvariants that get appended when wired, so you can drive them from other nodes.seed- change to force a fresh call, keep fixed to hit the cache.remove_think_tags- strips<think>...</think>blocks from the answer.proxy_url- for setups where OpenRouter needs a proxy (e.g.socks5://127.0.0.1:1080).images- optionalIMAGEinput for vision models; supports batches.
Outputs: response_text (the answer) and reasoning_content (a reasoning model's chain-of-thought, when the provider returns one - the node also pulls it out of <think> tags in the text if the field is missing).
Install
Same pack as the other fifteen:
cd ComfyUI/custom_nodes
git clone https://github.com/Tlant/ComfyUI-OllamaPromptsGeneratorTlant
restart, then grab a key at openrouter.ai and paste it in. Dependencies are just requests/aiohttp.
Where people get burned
- Empty prompts return empty. With no
user_promptand no images, the node bails early with("", "")- silent, but it's telling you it has nothing to send. - The cache can mask changes. Because the hash is over raw inputs, changing an upstream node that computes a prompt only matters if the resulting string actually changes. If you're tweaking a LoRA and expecting a new call, the string hasn't changed - that's by design, and it's also the cache working exactly as documented.
- Timeout is real. Default 300 seconds, and a slow reasoning model on a big vision request can get close. Errors come back as
response_text, not as a crash. - Reasoning content can be long. Wire
reasoning_contentthroughReasoningLLMOutputCleanerbefore it goes anywhere near a prompt widget, or you'll be encoding chain-of-thought.
It's the one node in this pack that competes with the dedicated LLM API packs, and the caching alone makes it worth having.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | STRING | xiaomi/mimo-v2-flash | OpenRouter model identifier, e.g. google/gemini-2.5-pro-preview |
| base_url | STRING | https://openrouter.ai/api/v1/chat/completions | API endpoint URL |
| api_key | STRING | OpenRouter API key (sk-or-v1-...) | |
| system_prompt | STRING | You are a helpful assistant. | System prompt to set model behavior |
| user_prompt | STRING | User prompt / instruction | |
| temperature | FLOAT | 0.700–2 | Controls randomness. Lower = more deterministic |
| max_tokens | INT | 20481–128000 | Maximum number of tokens in the response |
| seed | INT | 00–18446744073709550000 | Change seed to force re-execution; keep fixed to use cache |
| remove_think_tags | BOOLEAN | false | Remove <think>...</think> blocks from output |
| proxy_url | STRING | Optional proxy. e.g. http://127.0.0.1:1080 or socks5://127.0.0.1:1080 | |
| top_p | FLOAT | 1.000–1 | Nucleus sampling threshold |
| timeout | INT | 30010–1200 | Request timeout in seconds |
| image_detail | COMBO | auto | Image detail level for vision models |
| imagesopt | IMAGE | Optional image input for vision models. Supports batch. | |
| user_prompt_inputopt | STRING | External user prompt input, will be appended to user_prompt | |
| system_prompt_inputopt | STRING | External system prompt input, will be appended to system_prompt |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response_text | STRING | The model's text response |
| reasoning_content | STRING | Reasoning content returned by reasoning models (if available) |