Nodes/ComfyUI Deploy/Text Output (ComfyDeploy)
ComfyUI Node

Text Output (ComfyDeploy)

Return text from a deployed workflow — prompts, captions, JSON payloads

By BennyKok·Created 3 years ago·Updated 10 months ago· 1,529
Text Output (ComfyDeploy)
      text
      filename_prefixComfyUI
      file_typetxt
      output_idoutput_text

      Not every deployed workflow's deliverable is a picture. Some end with a generated prompt, an image caption, a JSON blob of generation settings, or a negative prompt your caller wants to reuse. "Text Output (ComfyDeploy)" saves a STRING to disk as .txt, .json, or .md and hands it to the ComfyDeploy backend, so your API response can include text alongside whatever images the workflow produced.

      Think of it as the text twin of the Image Output node. Where the image nodes report an uploaded file URL, this one reports a saved text file - and for API consumers, that's often what they parse first. A common pattern is pairing it with a node that assembles metadata: captioning workflows that return both the image and the caption, or "prompt from image" APIs that hand back the reconstructed prompt as a downloadable text file.

      What you set

      • text - the string to save. It's marked forceInput, so you'll wire it from a text-producing node (CLIP text, a caption model, an LLM node) rather than typing into it.
      • filename_prefix - default ComfyUI. Supports the same %date:yyyy-MM-dd% and %Node.field% templates as the image savers.
      • file_type - txt, json, or md (default txt). The interesting one is json: if your text parses as valid JSON, it's written pretty-printed with indentation; if not, the node falls back to plain text. So you can pass a raw JSON string and get a clean file out.
      • output_id - default output_text. The key your API response uses for this artifact.

      No outputs - terminal node.

      How it works

      Mechanically it's the same save-and-report path as the image output nodes: write the file into ComfyUI's output folder, register the filename with the backend under your output_id, and ComfyDeploy uploads it to your configured storage. The JSON branch is the only clever bit - it tries json.loads and reformats with indent=2, degrading gracefully to plain text if the input isn't valid JSON.

      Installing it

      It's part of ComfyUI Deploy, so:

      cd ComfyUI/custom_nodes
      git clone https://github.com/BennyKok/comfyui-deploy.git
      

      Restart ComfyUI, or install "ComfyUI Deploy" via ComfyUI Manager. No models, no key, nothing extra beyond the pack's pip deps (aiofiles, pydantic, opencv-python, imageio-ffmpeg, brotli, tabulate).

      Where people get burned

      The JSON mode is the trap if you don't read the fallback: it only pretty-prints when the input is actually valid JSON. Send it a comma in the wrong place or a single-quoted dict (Python-style, not JSON-style) and it silently writes plain text instead - no error, just a .json file full of raw text. If your caller is parsing it as JSON, that's a runtime surprise.

      Also, like the image savers, this node's upload only fires when the workflow runs through a ComfyDeploy machine. In the editor it just writes a file to your output folder. That's normal behavior, not a bug - and it's handy for checking exactly what the API will receive without spinning up a full run.

      Category🔗ComfyDeploy

      Inputs (4)

      NameTypeDefaultDescription
      textSTRINGThe text to save.
      filename_prefixSTRINGComfyUIThe prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% to include values from nodes.
      file_typeCOMBOtxt3 options: txt, json, md
      output_idoptSTRINGoutput_text

      Outputs (0)

      No outputs