4Z API

tusheng video

Endpoint: POST https://4zapi.com/kling/v1/videos/image2video

Generate a video using the input image as the starting frame.

Request body (application/json)

  • duration (required): Video duration (seconds), required. Non-kling-v3: only 5 or 10; kling-v3: 3~15. Supports string or integer, gateway normalizes to string.
  • image (string, required): Enter image URL or Base64, required. As a reference for the first frame of the video; Tusheng video core field. The format/size/resolution is verified by the upstream, the gateway only verifies that it is not empty.
  • model_name (string, required): Model name. When not transmitted, gateway accounting defaults to kling-v1, and it is recommended to fill it in explicitly. More kling-v1-5 / kling-v2-1 than text2video. It must be kling-v3 when multi_shot=true; it must be kling-v3 when mode=4k. ["kling-v1", "kling-v1-5", "kling-v1-6", "kling-v2-master", "kling-v2-1", "kling-v2-1-master", "kling-v2-5-turbo", "kling-v2-6", "kling-v3"]
  • aspect_ratio (string): Aspect ratio (width:height). Upstream constraints: commonly used 16:9 / 9:16 / 1:1, the gateway does not preflight enumeration. ["16:9", "9:16", "1:1"]
  • callback_url (string): Task completion callback address. POST notification after the upstream task is completed, the public network must be reachable, and the gateway transparently transmits the information as it is.
  • camera_control (object): Lens motion control. If it is not transmitted, the model will intelligently match it; the gateway transparently transmits it and does not pre-check the specific value range.
  • cfg_scale (number): Generate degrees of freedom (CFG). The larger the value, the stronger the correlation between the generated results and prompt; the gateway does not pre-check the range, and the upstream constraints are usually 0~1.
  • external_task_id (string): The caller's external task ID, used for idempotent association and business reconciliation; non-response body data.task_id.
  • image_tail (string): End frame image URL or Base64, optional. Cooperate with image to realize the transition between the first and last frames; if not passed, it will only be generated from the first frame. The gateway transmits transparently and does not pre-check the format.
  • mode (string): Generate schema. The billing side defaults to std when not transmitted. 4k only kling-v3; kling-v2-6 requires pro to open sound. ["std", "pro", "4k"]
  • multi_prompt (array<object>): Customized storyboard list. Required when shot_type=customize, up to 6 shots. Each mirror prompt≤512, duration≥1; the sum of the durations of each mirror must be equal to the top-level duration (error ≤0.1).
  • multi_shot (boolean): Whether there are multiple lenses. When true, only kling-v3 supports it, and prompt is invalid; when false, shot_type / multi_prompt cannot be passed, and a 400 error will occur if it is passed.
  • negative_prompt (string): Negative cue words. Describe unwanted content (such as blur, low image quality, deformation, etc.), and the gateway transparently transmits it.
  • prompt (string): Positive cue words. Required when multi_shot=false (default); invalid when multi_shot=true, 400 will be sent. Describe movement, shots and style, upstream constraint ≤2500 characters.
  • shot_type (string): Storyboarding method. Required when multi_shot=true; cannot be passed when multi_shot=false. customize must be used with multi_prompt; intelligence is automatically removed from the upstream. ["customize", "intelligence"]
  • sound (string): Audible switch. The gateway only performs model/schema verification on non-null values; triggers audible billing when on is passed. Only supported by kling-v2-6 / kling-v3; v2-6 requires mode=pro. ["on", "off"]
  • voice_list (array<object>): Custom sound list. Participate in the billing multiplier (hasVoiceId) when sound=on and is not empty; only image2video path identification, text2video is not included. Requires kling-v2-6 / kling-v3 audio capabilities.

Request example

{
  "duration": "5",
  "image": "{{image_url}}",
  "mode": "pro",
  "model_name": "kling-v2-6",
  "prompt": "A panda drinks coffee in a cozy cafe"
}