import { config, higgsfield } from "@higgsfield/client/v2"; config({ credentials: process.env.HF_CREDENTIALS,}); const result = await higgsfield.subscribe( "kling-video/v4.0/video-edit", { input: { "prompt": "A cinematic scene at sunset", "duration": 10, "video_url": "https://example.com/input.mp4", "resolution": "1080p", "aspect_ratio": "adaptive" }, withPolling: true, },); console.log(result);Calling the API
Use kling-video/v4.0/video-edit with the Higgsfield API. Keep credentials on your server.
import { config, higgsfield } from "@higgsfield/client/v2"; config({ credentials: process.env.HF_CREDENTIALS,}); const result = await higgsfield.subscribe( "kling-video/v4.0/video-edit", { input: { "prompt": "A cinematic scene at sunset", "duration": 10, "video_url": "https://example.com/input.mp4", "resolution": "1080p", "aspect_ratio": "adaptive" }, withPolling: true, },); console.log(result);Request parameters
promptstring · required
prompt
{
"type": "string",
"minLength": 1
}durationinteger · optional
duration
Default: 10
{
"type": "integer",
"default": 10,
"maximum": 30,
"minimum": 3
}elementsarray · optional
elements
{
"type": "array",
"items": {
"type": "integer",
"minimum": 1
},
"maxItems": 7
}image_urlstring · optional
image url
{
"type": "string",
"format": "uri",
"minLength": 1
}video_urlstring · required
video url
{
"type": "string",
"format": "uri",
"minLength": 1
}image_urlsarray · optional
image urls
{
"type": "array",
"items": {
"type": "string",
"format": "uri",
"minLength": 1
},
"maxItems": 10
}resolutionstring · optional
resolution
Options: 720p, 1080p
Default: "1080p"
{
"enum": [
"720p",
"1080p"
],
"type": "string",
"default": "1080p"
}video_urlsarray · optional
video urls
{
"type": "array",
"items": {
"type": "string",
"format": "uri",
"minLength": 1
},
"maxItems": 5
}aspect_ratiostring · optional
aspect ratio
Options: 21:9, 16:9, 9:16, 1:1, adaptive
Default: "adaptive"
{
"enum": [
"21:9",
"16:9",
"9:16",
"1:1",
"adaptive"
],
"type": "string",
"default": "adaptive"
}end_image_urlstring · optional
end image url
{
"type": "string",
"format": "uri",
"minLength": 1
}Price
Standard self-serve rates in USD per second of generated video. - Without video input: 720p: $0.1257; 1080p: $0.1879. - With video input: 720p: $0.1544; 1080p: $0.2336. Total price = selected rate × output duration in seconds. Input video duration is not added to the billed duration. Video input includes video-based elements.
View all pricing