
Parameters
Required Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| prompt_text | String | "" | Text prompt describing the video content |
| negative_prompt | String | "" | Elements to exclude from the video |
| seed | Integer | 0 | Random seed for generation |
| resolution | Select | ”1080p” | Output video resolution |
| duration | Select | ”5s” | Length of generated video |
| aspect_ratio | Float | 1.7777777777777777 | Video aspect ratio, range 0.4-2.5, step 0.001 |
Output
| Output | Type | Description |
|---|---|---|
| VIDEO | Video | Generated video |
Source Code
[Node Source Code (Updated 2025-05-05)]
class PikaTextToVideoNodeV2_2(PikaNodeBase):
"""Pika 2.2 Text to Video Node."""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
**cls.get_base_inputs_types(PikaBodyGenerate22T2vGenerate22T2vPost),
"aspect_ratio": model_field_to_node_input(
IO.FLOAT,
PikaBodyGenerate22T2vGenerate22T2vPost,
"aspectRatio",
step=0.001,
min=0.4,
max=2.5,
default=1.7777777777777777,
),
},
"hidden": {
"auth_token": "AUTH_TOKEN_COMFY_ORG",
},
}
RETURN_TYPES = ("VIDEO",)
DESCRIPTION = "Sends a text prompt to the Pika API v2.2 to generate a video."
def api_call(
self,
prompt_text: str,
negative_prompt: str,
seed: int,
resolution: str,
duration: int,
aspect_ratio: float,
auth_token: Optional[str] = None,
) -> tuple[VideoFromFile]:
"""API call for Pika 2.2 Text to Video."""
initial_operation = SynchronousOperation(
endpoint=ApiEndpoint(
path=PATH_TEXT_TO_VIDEO,
method=HttpMethod.POST,
request_model=PikaBodyGenerate22T2vGenerate22T2vPost,
response_model=PikaGenerateResponse,
),
request=PikaBodyGenerate22T2vGenerate22T2vPost(
promptText=prompt_text,
negativePrompt=negative_prompt,
seed=seed,
resolution=resolution,
duration=duration,
aspectRatio=aspect_ratio,
),
auth_token=auth_token,
content_type="application/x-www-form-urlencoded",
)
return self.execute_task(initial_operation, auth_token)