{"slug": "the-ultimate-guide-to-kling-4-0", "title": "The Ultimate Guide to Kling 4.0", "summary": "Kuaishou released Kling 4.0, an AI video model that generates clips of up to 30 seconds at 720p or 1080p, with prompts up to 26,000 characters and up to 10 keyframes per shot. The model adds a 21:9 ultra-wide aspect ratio alongside 16:9, 9:16 and 1:1, and accepts start, middle and end images that the video passes through in order in a single continuous shot. Kling 4.0 is available through Replicate as \"kwaivgi/kling-v4.0\" and through AI Gateway, where keyframe inputs are named first_frame, middle_frames and last_frame.", "body_md": "# The Ultimate Guide to Kling 4.0\n\nRun Kling 4.0\n\nKling from Kuaishou has been one of the front-runners in AI video for a while. Kling 4.0 is the new version, and it changes how you direct a shot.\n\nThe headline numbers:\n\n- **Up to 30 seconds** per generation, anywhere from 3 to 30.\n- **720p or 1080p** output.\n- **Four aspect ratios:** 16:9, 9:16, 1:1, and a new ultra-wide 21:9.\n- **Prompts up to 26,000 characters** , so you can write a whole shot list.\n- **Up to 10 keyframes:** a first frame, a last frame, and images in between that the video passes through in order.\n\nThis post walks through what Kling 4.0 does best, with real outputs for each.\n\n## \n\nStart with a plain description of the scene and the camera. Kling 4.0 holds onto small physical details, like ripples spreading where raindrops land and neon reflections that move with the water.\n\nA paper boat drifts down a narrow, rain-soaked Tokyo alley at night. Neon signs in pink and teal reflect in the puddles and ripple as raindrops fall. The camera tracks low alongside the boat, close to the water. Cinematic, photorealistic, shallow depth of field.\n\n## \n\n21:9 is new in Kling 4.0. It’s the cinema widescreen format, and it suits landscapes and establishing shots. Set `aspect_ratio` to `\"21:9\"`.\n\nA sweeping aerial shot glides over a red sandstone canyon at sunrise. Long shadows stretch across the canyon floor as a river catches the first golden light. The camera slowly pushes forward and rises to reveal the desert horizon. Epic cinematic landscape, anamorphic look.\n\n## \n\nGive Kling 4.0 a start image (`start_image` on Replicate, `first_frame` on AI Gateway) and it animates from there. In the prompt, refer to the image as `@image_1`. Here a pencil sketch turns into a finished product shot.\n\nThe pencil sneaker sketch in @image_1 comes to life. The graphite lines fill in with real materials: white leather, a perforated toe box, an orange suede heel panel, a translucent cushioned sole. The sneaker lifts off the sketchbook page and settles onto a slowly rotating white studio turntable as the paper fades into a soft grey seamless backdrop. Studio softbox lighting, crisp reflections, macro detail on the stitching. Smooth, continuous camera orbit.\n\n## \n\nThis is the part that’s new. Instead of a start and an end, you can give Kling 4.0 a start image, a list of middle images, and an end image, up to 10 images in total. On Replicate these are `start_image`, `middle_images`, and `end_image`; on AI Gateway they are `first_frame`, `middle_frames`, and `last_frame`. The video passes through each one, in order, in a single continuous shot.\n\nThe images are numbered in that order: `@image_1` is the first frame, then the middle frames, and the last frame comes last. Use those names in the prompt to say what happens at each point.\n\n@image_1 (first)\n\n@image_2 (middle)\n\n@image_3 (last)\n\nA flat illustrated robot mascot printed on a notebook page wakes up. In @image_1 it is flat ink on the paper; it blinks, its antenna wiggles, and it peels itself up off the page into a glossy 3D toy. In @image_2 it stands on the page beside its own faded print, knees bent, mid-hop. By @image_3 it has hopped onto the wooden desk next to the coffee mug and waves at the camera. Warm morning sunlight, shallow depth of field, playful stop-motion feel, one continuous shot with a fixed camera.\n\nWith keyframes, the output takes the shape of your images, so `aspect_ratio` is ignored.\n\n## \n\nHere’s how to generate a video with Kling 4.0:\n\n``` python\nimport Replicate from \"replicate\";\n\nconst replicate = new Replicate();\n\nconst output = await replicate.run(\n  \"kwaivgi/kling-v4.0\",\n  {\n    input: {\n      prompt: \"A paper boat drifts down a narrow, rain-soaked Tokyo alley at night. Neon signs in pink and teal reflect in the puddles and ripple as raindrops fall. The camera tracks low alongside the boat, close to the water.\",\n      duration: 5,\n      resolution: \"1080p\",\n      aspect_ratio: \"16:9\",\n      // start_image: \"https://...\",              // start from an image (@image_1)\n      // middle_images: [\"https://...\", \"...\"],    // keyframes the shot passes through\n      // end_image: \"https://...\",                // image the shot ends on\n    }\n  }\n);\n\nconsole.log(output);\n```\n\n## \n\nKling 4.0 is also on Cloudflare AI Gateway as `klingai/kling-v4`. From a Worker:\n\n``` js\nconst response = await env.AI.run(\n  'klingai/kling-v4',\n  {\n    prompt: 'A sweeping aerial shot glides over a red sandstone canyon at sunrise. The camera slowly pushes forward and rises to reveal the desert horizon.',\n    duration: 8,\n    resolution: '720p',\n    aspect_ratio: '21:9',\n  },\n)\nconsole.log(response.result.video)\n```\n\nOr over HTTP:\n\n```\ncurl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \\\n  --header \"Authorization: Bearer $CLOUDFLARE_API_TOKEN\" \\\n  --header \"Content-Type: application/json\" \\\n  --data '{\n    \"model\": \"klingai/kling-v4\",\n    \"input\": {\n      \"prompt\": \"A paper boat drifts down a narrow, rain-soaked Tokyo alley at night.\",\n      \"duration\": 5,\n      \"resolution\": \"1080p\"\n    }\n  }'\n```\n\nRequests through AI Gateway can use logging, caching, rate limiting, and the rest of the gateway features. Cloudflare handles the Kling credentials and bills usage per output second through Unified Billing, so you don’t need a Kling API key. A 10-second 1080p clip takes a few minutes to generate.\n\n## \n\n1. \n**Lead with the camera.** “The camera tracks low alongside the boat” or “a smooth, continuous camera orbit” gives Kling 4.0 something concrete to follow.\n2. \n**Name your keyframes.** Say what happens “in @image_1”, “in @image_2”, and “by @image_3”. The model uses those beats to plan the motion between them.\n3. \n**Ask for one continuous shot when you use keyframes.** Adding “one continuous shot with a fixed camera” keeps the move between keyframes smooth instead of cutting.\n4. \n**Pick the aspect ratio for the shot.** 21:9 for landscapes and establishing shots, 9:16 for vertical social video, 1:1 for feeds.\n5. \n**Use the long prompt.** 26,000 characters is enough to describe lighting, materials, and every beat of the action. Specific materials and lighting, like “orange suede heel panel” or “studio softbox lighting”, show up in the output.\n\nTry Kling 4.0", "url": "https://wpnews.pro/news/the-ultimate-guide-to-kling-4-0", "canonical_source": "https://replicate.com/blog/kling-4", "published_at": "2026-10-27 00:00:00+00:00", "updated_at": "2026-11-03 14:21:02.771218+00:00", "lang": "en", "topics": ["generative-ai", "artificial-intelligence", "ai-products"], "entities": ["Kuaishou", "Kling 4.0", "Replicate", "AI Gateway"], "also_reported_by": [], "takeaway": "Kling 4.0 accepts up to 10 ordered keyframes via start_image, middle_images and end_image on Replicate (first_frame, middle_frames, last_frame on AI Gateway), and aspect_ratio is ignored when keyframes are supplied.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/the-ultimate-guide-to-kling-4-0", "markdown": "https://wpnews.pro/news/the-ultimate-guide-to-kling-4-0.md", "text": "https://wpnews.pro/news/the-ultimate-guide-to-kling-4-0.txt", "jsonld": "https://wpnews.pro/news/the-ultimate-guide-to-kling-4-0.jsonld"}}