Transform Text
Let Claude Rewrite Your Prompt Mid-Workflow
- transformed_text
Transform Text does exactly what the name says: you hand it a chunk of text, it hands that text to Claude, and Claude hands back a rewritten version. One node, one job, one API call. Don't expect anything local - there's no model file, no download, no VRAM. The work happens on Anthropic's servers, and your only hardware requirement is an internet connection and a credit card.
The obvious use is prompt rephrasing. You've got a bare idea - "cyberpunk street, neon, rain" - and you want a full sentence before it hits a text encoder. That's worth more in 2026 than it was in 2024, because the models people actually run (Z-Image, Flux 2 Klein, Anima, anything with an LLM encoder) want natural-language instructions, not a bag of tags. An LLM is genuinely good at drafting that structure for you. It's also decent at the inverse: taking a messy multi-line prompt and returning something clean and de-duplicated, which helps when you're pasting fragments from half a dozen sources into one workflow.
How it works
Under the hood it's embarrassingly simple, and that's kind of the point. The node builds a single prompt string in the shape {prompt}\nText: {text}\n and fires it at Anthropic's messages API with a fixed 1024-token budget. Whatever comes back is your transformed_text output. No chaining, no streaming, no retries - one round trip. If the API call fails for any reason, the node swallows the exception and returns an empty string, with the real error dumped to your ComfyUI console.
Inputs and outputs that matter
- text - the string you want transformed. Multiline, and the only thing that actually goes into the "Text:" slot.
- model - a dropdown of nine Claude aliases, default
claude-opus-4-6. That's Anthropic's flagship and also the most expensive thing in the list. For rephrasing prompts,claude-haiku-4-5does the job at a fraction of the cost. The author keeps the list current - the repo's latest commit is literally titled "Updated Claude models." - api_key - your Anthropic key, typed straight into the node.
- system_prompt - optional. Your "act as an expert prompt engineer" box.
- prompt - optional, and here's the trap.
That prompt field defaults to "Describe this image in detail." - a copy-paste from the pack's image node that the author never cleaned up. Wire text in, hit run, and Claude will describe your prompt like it's a photograph. Change it to something like "Rewrite this as a detailed, natural-language prompt" or you'll get nonsense. Every time.
The transformed_text output is a plain STRING, so it feeds anything with a string input - typically a CLIP Text Encode, or a text-display node so you can eyeball the result before it goes near the sampler.
How to install
From ComfyUI Manager: search for "ComfyUI Claude" (that's the pack's registry name) and install. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/tkreuziger/comfyui-claude.git
pip install -r comfyui-claude/requirements.txt
Then restart ComfyUI. Dependencies are pleasantly light - anthropic, pillow, and comfyui-types. No model downloads, nothing heavy. This is one of those packs that takes a minute and then leaves your environment alone.
Common issues
- Empty output. Check the console. Authentication failures, rate limits, and unknown model IDs all land there as a logged exception because the node returns
''instead of crashing. - Your API key lives in the workflow. The README is explicit that you fill the key into each node - there's no separate config, and no env-var handling here. That means the key is baked into your workflow JSON. Fine for your own machine; scrub it before you share a workflow with anyone.
- The default prompt. Re-read the section above. If your "transformed" text reads like an image description, this is why.
The honest verdict: for a one-off "make my prompt better" pass this is the cheapest thing in the ecosystem that works. But if you're running LLM-in-the-graph constantly, you'll hit cost and key management fast - at that point a local model via Ollama starts looking a lot better. This node is the polite, thin, API-key version of that idea.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| model | COMBO | claude-opus-4-6 | 9 options: claude-opus-4-6, claude-sonnet-4-5, claude-opus-4-5, claude-opus-4-1, claude-sonnet-4-0, claude-opus-4-0, +3 |
| api_key | STRING | — | |
| system_promptopt | STRING | — | |
| promptopt | STRING | Describe this image in detail. | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| transformed_text | STRING | — |