> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# TextGenerateLTX2Prompt - ComfyUI Built-in Node Documentation

> The TextGenerateLTX2Prompt node expands a short user prompt into a detailed, audio-visual description suitable for generating video with the LTX-2 series of video models.

The TextGenerateLTX2Prompt node expands a short user prompt into a detailed, audio-visual description suitable for generating video with the LTX-2 series of video models. It automatically adds task-specific system instructions, sends the formatted prompt to a language model, and returns the enhanced text. When an optional reference image is supplied, the node switches to image-to-video mode and expands the prompt starting from that image's content.

## Inputs

### Common Inputs

| Parameter | Description | Data Type | Required | Range |
| - | - | - | - | - |
| `clip` | The CLIP model used for text encoding. The node checks the model's tokenizer name to select the matching instructions: Gemma 4 based models use the LTX-2.4 format, while other models use the LTX-2 (Gemma 3) format. | CLIP | Yes | - |
| `prompt` | The raw text input describing the scene or concept to be expanded into a detailed video generation prompt. | STRING | Yes | - |
| `image` | An optional input image used as the first frame of the video. When provided, the node switches to image-to-video mode and uses a system prompt that expands the user prompt based on the image's content. | IMAGE | No | - |
| `video` | An optional video input used as additional context. Passed to the language model as an image batch; assumed to be 24 FPS and subsampled to 1 FPS internally. | IMAGE | No | - |
| `audio` | An optional audio input that can be used as additional context for generation. | AUDIO | No | - |
| `max_length` | The maximum number of tokens the language model is allowed to generate (default: 512). | INT | Yes | 1 to 32768 |
| `sampling_mode` | Controls whether random sampling is used during text generation. When set to `"on"`, the sampling parameters below become available; with `"off"` the node generates text without random sampling. | DYNAMIC\_COMBO | Yes | `"on"`<br />`"off"` |
| `thinking` | When enabled, the model is instructed to reason before answering. Any reasoning block is returned on the `thinking` output instead of in `generated_text` (default: False). | BOOLEAN | No | True/False |
| `use_default_template` | When enabled, the node uses the default chat template for formatting (default: True). Advanced setting. | BOOLEAN | No | True/False |
| `mtp` | Speculative decoding with the checkpoint's multi-token-prediction head. Has no effect without MTP weights. `"auto"` adapts the draft depth, `"2"` to `"5"` pin it. Sampled output stays correctly distributed but differs from non-MTP output for the same seed (default: `"auto"`). | COMBO | No | `"auto"`<br />`"off"`<br />`"2"`<br />`"3"`<br />`"4"`<br />`"5"` |
| `system_prompt` | Replaces the built-in LTX-2 system prompt. When left empty, the node uses its own instructions: the image-to-video prompt when an `image` is connected, otherwise the text-to-video prompt. Connect a STRING input instead of typing in the node (default: empty). | STRING | No | - |

### Sampling Parameters (when `sampling_mode` is "on")

| Parameter | Description | Data Type | Required | Range |
| - | - | - | - | - |
| `temperature` | Controls the randomness of the output. Lower values make the output more predictable, higher values make it more creative (default: 0.7). | FLOAT | Yes | 0.01 to 2.0 |
| `top_k` | Limits the sampling pool to the top K most likely next tokens. A value of 0 disables this filter (default: 64). | INT | Yes | 0 to 1000 |
| `top_p` | Uses nucleus sampling: it keeps the smallest set of most likely tokens whose cumulative probability reaches this value. (default: 0.95) | FLOAT | Yes | 0.0 to 1.0 |
| `min_p` | Sets a minimum probability threshold for tokens to be considered (default: 0.05). | FLOAT | Yes | 0.0 to 1.0 |
| `repetition_penalty` | Penalizes tokens that have already been generated to reduce repetition. A value of 1.0 applies no penalty (default: 1.05). | FLOAT | Yes | 0.0 to 5.0 |
| `seed` | A number used to initialize the random number generator for reproducible results (default: 0). | INT | Yes | 0 to 18446744073709551615 |
| `presence_penalty` | Penalizes new tokens based on whether they have appeared in the text so far, encouraging the model to talk about new topics (default: 0.0). | FLOAT | No | 0.0 to 5.0 |

**Note:** The sampling parameters above are only active and visible in the node interface when `sampling_mode` is set to "on". When it is set to "off", no sampling parameters are available and the node generates text without random sampling.

**Note:** The behavior of the node changes based on its inputs:

* If an `image` is provided, the generated prompt is formatted for an image-to-video task using a system prompt that describes how to expand the prompt based on the image's content. If no image is provided, the formatting is for a text-to-video task using a system prompt that expands the prompt into a detailed video generation description.
* If the CLIP tokenizer's name contains "gemma4", the node uses the LTX-2.4 system prompts and the Gemma 4 chat format. Otherwise, it uses the LTX-2 (Gemma 3) system prompts and chat format.
* When `thinking` is enabled with a Gemma 4 model, the model is opened on its reasoning channel; when disabled, the model is opened directly on the final-answer channel. For non-Gemma 4 models, `thinking` is passed through to the underlying generation step.
* A `system_prompt` replaces the built-in instructions for the selected mode (image-to-video or text-to-video); when it is empty, the built-in prompt is used.
* Any reasoning block is returned on the `thinking` output instead of `generated_text`.
* If the language model produces no usable text, the node returns the original `prompt` instead.

## Outputs

| Output Name | Description | Data Type |
| - | - | - |
| `generated_text` | The enhanced video-generation prompt produced by the language model, with any reasoning block separated out into the `thinking` output. If the result is empty, the original user prompt is returned. | STRING |
| `thinking` | The reasoning block the model produced, with the opening `<think>` tag removed. Empty when the model produced no reasoning block; with Gemma 4 models a reasoning block is only expected when `thinking` is enabled. | STRING |

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/TextGenerateLTX2Prompt/en.md)

***

**Source fingerprint (SHA-256):** `a601a8bff65e8ee148d09f04ac0afc201dbc9ba5e09a65856400e9be37e085bb`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.