{"record":{"id":"651635c0f6499b78","repo":"Comfy-Org/ComfyUI","slug":"kling-video-o1-only-supports-durations-of-5-or-10","errorCode":null,"errorMessage":"kling-video-o1 only supports durations of 5 or 10 seconds.","messagePattern":"kling-video-o1 only supports durations of 5 or 10 seconds\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_kling.py","lineNumber":701,"sourceCode":"            ),\n        )\n\n    @classmethod\n    async def execute(\n        cls,\n        model_name: str,\n        prompt: str,\n        aspect_ratio: str,\n        duration: int,\n        resolution: str = \"1080p\",\n        storyboards: dict | None = None,\n        generate_audio: bool = False,\n        seed: int = 0,\n    ) -> IO.NodeOutput:\n        _ = seed\n        if model_name == \"kling-video-o1\":\n            if duration not in (5, 10):\n                raise ValueError(\"kling-video-o1 only supports durations of 5 or 10 seconds.\")\n            if generate_audio:\n                raise ValueError(\"kling-video-o1 does not support audio generation.\")\n            if resolution == \"4k\":\n                raise ValueError(\"kling-video-o1 does not support 4k resolution.\")\n        stories_enabled = storyboards is not None and storyboards[\"storyboards\"] != \"disabled\"\n        if stories_enabled and model_name == \"kling-video-o1\":\n            raise ValueError(\"kling-video-o1 does not support storyboards.\")\n        validate_string(prompt, strip_whitespace=True, min_length=0 if stories_enabled else 1, max_length=2500)\n\n        multi_shot = None\n        multi_prompt_list = None\n        if stories_enabled:\n            count = int(storyboards[\"storyboards\"].split()[0])\n            multi_shot = True\n            multi_prompt_list = []\n            for i in range(1, count + 1):\n                sb_prompt = storyboards[f\"storyboard_{i}_prompt\"]\n                sb_duration = storyboards[f\"storyboard_{i}_duration\"]","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_kling.py#L683-L719","documentation":"Client-side model-capability guard in the Kling text-to-video node: kling-video-o1 only accepts durations of exactly 5 or 10 seconds. Any other value (including 15, 20, or fractional settings) is rejected before any API call. The combo of model_name == 'kling-video-o1' and duration not in (5, 10) triggers it.","triggerScenarios":"Selecting kling-video-o1 with duration 3, 15, or any value other than 5/10 in a text-to-video workflow; workflows saved with older defaults; programmatic runs passing duration=15.","commonSituations":"Switching the model dropdown from kling-v2.x (which allows 5/10 but sometimes 15+ via storyboard totals) to o1 without updating duration; old workflow JSONs carrying incompatible duration values.","solutions":["Set duration to 5 or 10 when using kling-video-o1","Update saved workflows that pair o1 with other durations","If you need longer videos, switch to a model that supports them, or chain two o1 generations"],"exampleFix":"// before\nmodel_name = \"kling-video-o1\"; duration = 15\n\n// after\nmodel_name = \"kling-video-o1\"; duration = 10","handlingStrategy":"validation","validationCode":"def o1_t2v_ok(model_name: str, duration: int) -> bool:\n    return model_name != \"kling-video-o1\" or duration in (5, 10)\n\nassert o1_t2v_ok(model_name, duration)","typeGuard":"def is_valid_o1_duration(model_name: str, duration: int) -> bool:\n    if model_name != \"kling-video-o1\":\n        return True\n    return duration in (5, 10)","tryCatchPattern":"try:\n    out = await kling_t2v_node(model_name=model, duration=duration, ...)\nexcept ValueError as e:\n    if \"only supports durations\" in str(e):\n        out = await kling_t2v_node(model_name=model, duration=10, ...)\n    else:\n        raise","preventionTips":["After switching the model dropdown, re-check duration/audio/resolution options","Encode model capability tables in workflow templates so UIs disable invalid combos"],"tags":["kling","model-constraints","duration","validation","pre-flight"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}