Skip to content

Commit a3c5c2e

Browse files
authored
support for ltx 2.3 models (#79)
1 parent c838d24 commit a3c5c2e

4 files changed

Lines changed: 87 additions & 63 deletions

File tree

griptape_nodes_library/video/ltx_audio_to_video_generation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
MODEL_MAPPING = {
2828
"LTX 2 Pro": "ltx-2-pro",
29+
"LTX 2.3 Pro": "ltx-2-3-pro",
2930
}
3031

3132

@@ -61,7 +62,7 @@ def __init__(self, **kwargs: Any) -> None:
6162
default_value="LTX 2 Pro",
6263
tooltip="Model to use for video generation",
6364
allowed_modes={ParameterMode.INPUT, ParameterMode.PROPERTY},
64-
traits={Options(choices=["LTX 2 Pro"])},
65+
traits={Options(choices=["LTX 2 Pro", "LTX 2.3 Pro"])},
6566
)
6667
)
6768
self.add_parameter(

griptape_nodes_library/video/ltx_image_to_video_generation.py

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
MODEL_MAPPING = {
2727
"LTX 2 Pro": "ltx-2-pro",
2828
"LTX 2 Fast": "ltx-2-fast",
29+
"LTX 2.3 Pro": "ltx-2-3-pro",
30+
"LTX 2.3 Fast": "ltx-2-3-fast",
2931
}
3032

3133
# Camera motion options
@@ -46,7 +48,7 @@ class LTXImageToVideoGeneration(GriptapeProxyNode):
4648
Inputs:
4749
- image (ImageArtifact|ImageUrlArtifact|str): Input image (required, base64 data URI format)
4850
- prompt (str): Text prompt for video generation (required)
49-
- model (str): Model to use (LTX 2 Pro or LTX 2 Fast)
51+
- model (str): Model to use (LTX 2 Pro, LTX 2 Fast, LTX 2.3 Pro, or LTX 2.3 Fast)
5052
- resolution (str): Video resolution (1920x1080, 2560x1440, or 3840x2160)
5153
- duration (int): Video length in seconds
5254
- fps (int): Frames per second (default: 25)
@@ -65,34 +67,40 @@ class LTXImageToVideoGeneration(GriptapeProxyNode):
6567
API_KEY_NAME = "GT_CLOUD_API_KEY"
6668
DEFAULT_MAX_ATTEMPTS = 240
6769

70+
FAST_MODEL_CAPABILITIES: ClassVar[dict[str, Any]] = {
71+
"resolutions": {
72+
"1920x1080": {
73+
"fps": {25: [6, 8, 10, 12, 14, 16, 18, 20], 50: [6, 8, 10]},
74+
},
75+
"2560x1440": {
76+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
77+
},
78+
"3840x2160": {
79+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
80+
},
81+
}
82+
}
83+
84+
PRO_MODEL_CAPABILITIES: ClassVar[dict[str, Any]] = {
85+
"resolutions": {
86+
"1920x1080": {
87+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
88+
},
89+
"2560x1440": {
90+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
91+
},
92+
"3840x2160": {
93+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
94+
},
95+
}
96+
}
97+
6898
# Model capability definitions
6999
MODEL_CAPABILITIES: ClassVar[dict[str, Any]] = {
70-
"ltx-2-fast": {
71-
"resolutions": {
72-
"1920x1080": {
73-
"fps": {25: [6, 8, 10, 12, 14, 16, 18, 20], 50: [6, 8, 10]},
74-
},
75-
"2560x1440": {
76-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
77-
},
78-
"3840x2160": {
79-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
80-
},
81-
}
82-
},
83-
"ltx-2-pro": {
84-
"resolutions": {
85-
"1920x1080": {
86-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
87-
},
88-
"2560x1440": {
89-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
90-
},
91-
"3840x2160": {
92-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
93-
},
94-
}
95-
},
100+
"ltx-2-fast": FAST_MODEL_CAPABILITIES,
101+
"ltx-2-3-fast": FAST_MODEL_CAPABILITIES,
102+
"ltx-2-pro": PRO_MODEL_CAPABILITIES,
103+
"ltx-2-3-pro": PRO_MODEL_CAPABILITIES,
96104
}
97105

98106
def __init__(self, **kwargs: Any) -> None:
@@ -105,7 +113,7 @@ def __init__(self, **kwargs: Any) -> None:
105113
default_value="LTX 2 Fast",
106114
tooltip="Model to use for video generation",
107115
allowed_modes={ParameterMode.INPUT, ParameterMode.PROPERTY},
108-
traits={Options(choices=["LTX 2 Pro", "LTX 2 Fast"])},
116+
traits={Options(choices=["LTX 2 Pro", "LTX 2 Fast", "LTX 2.3 Pro", "LTX 2.3 Fast"])},
109117
)
110118
)
111119
self.add_parameter(

griptape_nodes_library/video/ltx_text_to_video_generation.py

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
MODEL_MAPPING = {
2525
"LTX 2 Pro": "ltx-2-pro",
2626
"LTX 2 Fast": "ltx-2-fast",
27+
"LTX 2.3 Pro": "ltx-2-3-pro",
28+
"LTX 2.3 Fast": "ltx-2-3-fast",
2729
}
2830

2931
# Camera motion options
@@ -43,7 +45,7 @@ class LTXTextToVideoGeneration(GriptapeProxyNode):
4345
4446
Inputs:
4547
- prompt (str): Text prompt for video generation (required)
46-
- model (str): Model to use (LTX 2 Pro or LTX 2 Fast)
48+
- model (str): Model to use (LTX 2 Pro, LTX 2 Fast, LTX 2.3 Pro, or LTX 2.3 Fast)
4749
- resolution (str): Video resolution (1920x1080, 2560x1440, or 3840x2160)
4850
- duration (int): Video length in seconds
4951
- fps (int): Frames per second (default: 25)
@@ -62,34 +64,40 @@ class LTXTextToVideoGeneration(GriptapeProxyNode):
6264
API_KEY_NAME = "GT_CLOUD_API_KEY"
6365
DEFAULT_MAX_ATTEMPTS = 240
6466

67+
FAST_MODEL_CAPABILITIES: ClassVar[dict[str, Any]] = {
68+
"resolutions": {
69+
"1920x1080": {
70+
"fps": {25: [6, 8, 10, 12, 14, 16, 18, 20], 50: [6, 8, 10]},
71+
},
72+
"2560x1440": {
73+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
74+
},
75+
"3840x2160": {
76+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
77+
},
78+
}
79+
}
80+
81+
PRO_MODEL_CAPABILITIES: ClassVar[dict[str, Any]] = {
82+
"resolutions": {
83+
"1920x1080": {
84+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
85+
},
86+
"2560x1440": {
87+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
88+
},
89+
"3840x2160": {
90+
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
91+
},
92+
}
93+
}
94+
6595
# Model capability definitions
6696
MODEL_CAPABILITIES: ClassVar[dict[str, Any]] = {
67-
"ltx-2-fast": {
68-
"resolutions": {
69-
"1920x1080": {
70-
"fps": {25: [6, 8, 10, 12, 14, 16, 18, 20], 50: [6, 8, 10]},
71-
},
72-
"2560x1440": {
73-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
74-
},
75-
"3840x2160": {
76-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
77-
},
78-
}
79-
},
80-
"ltx-2-pro": {
81-
"resolutions": {
82-
"1920x1080": {
83-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
84-
},
85-
"2560x1440": {
86-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
87-
},
88-
"3840x2160": {
89-
"fps": {25: [6, 8, 10], 50: [6, 8, 10]},
90-
},
91-
}
92-
},
97+
"ltx-2-fast": FAST_MODEL_CAPABILITIES,
98+
"ltx-2-3-fast": FAST_MODEL_CAPABILITIES,
99+
"ltx-2-pro": PRO_MODEL_CAPABILITIES,
100+
"ltx-2-3-pro": PRO_MODEL_CAPABILITIES,
93101
}
94102

95103
def __init__(self, **kwargs: Any) -> None:
@@ -102,7 +110,7 @@ def __init__(self, **kwargs: Any) -> None:
102110
default_value="LTX 2 Fast",
103111
tooltip="Model to use for video generation",
104112
allowed_modes={ParameterMode.INPUT, ParameterMode.PROPERTY},
105-
traits={Options(choices=["LTX 2 Pro", "LTX 2 Fast"])},
113+
traits={Options(choices=["LTX 2 Pro", "LTX 2 Fast", "LTX 2.3 Pro", "LTX 2.3 Fast"])},
106114
)
107115
)
108116

griptape_nodes_library/video/ltx_video_retake.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
MIN_RETAKE_DURATION = 2.0
2929
RETAKE_SEGMENT_LENGTH = 2
3030

31+
MODEL_MAPPING = {
32+
"LTX 2 Pro": "ltx-2-pro",
33+
"LTX 2.3 Pro": "ltx-2-3-pro",
34+
}
35+
3136

3237
class LTXVideoRetake(GriptapeProxyNode):
3338
"""Regenerate a segment of an existing video using LTX AI via Griptape Cloud model proxy.
@@ -37,7 +42,7 @@ class LTXVideoRetake(GriptapeProxyNode):
3742
- retake_segment (list[float]): Time range [start, end] in seconds to regenerate
3843
- prompt (str): Text describing what should happen in the retake segment (max 5000 chars)
3944
- mode (str): What to replace - audio only, video only, or both (default: both)
40-
- model (str): Model to use (only LTX 2 Pro supported currently)
45+
- model (str): Model to use (LTX 2 Pro or LTX 2.3 Pro)
4146
(Always polls for result: 5s interval, 20 min timeout)
4247
4348
Outputs:
@@ -57,14 +62,14 @@ def __init__(self, **kwargs: Any) -> None:
5762

5863
# INPUTS / PROPERTIES
5964

60-
# Model parameter (only ltx-2-pro supported)
65+
# Model parameter (retake supports pro-tier LTX models)
6166
self.add_parameter(
6267
ParameterString(
6368
name="model",
6469
default_value="LTX 2 Pro",
65-
tooltip="Model to use for video retake (only LTX 2 Pro supported currently)",
70+
tooltip="Model to use for video retake",
6671
allowed_modes={ParameterMode.INPUT, ParameterMode.PROPERTY},
67-
traits={Options(choices=["LTX 2 Pro"])},
72+
traits={Options(choices=["LTX 2 Pro", "LTX 2.3 Pro"])},
6873
)
6974
)
7075
self.add_parameter(
@@ -299,7 +304,9 @@ def _get_parameters(self) -> dict[str, Any]:
299304
}
300305

301306
def _get_api_model_id(self) -> str:
302-
return "ltx-2-pro:retake"
307+
model_name = self.get_parameter_value("model") or "LTX 2 Pro"
308+
model_id = MODEL_MAPPING.get(model_name, "ltx-2-pro")
309+
return f"{model_id}:retake"
303310

304311
def _validate_video_input(self, video: Any) -> str | None:
305312
"""Validate video is provided and doesn't exceed duration limits."""
@@ -413,7 +420,7 @@ async def _build_payload(self) -> dict[str, Any]:
413420
"duration": duration,
414421
"prompt": params["prompt"].strip(),
415422
"mode": params["mode"],
416-
"model": "ltx-2-pro", # API only supports ltx-2-pro
423+
"model": MODEL_MAPPING.get(params["model"], "ltx-2-pro"),
417424
}
418425

419426
return payload

0 commit comments

Comments
 (0)