Kuaishou
Kling 4.0
kling-4.0/text-to-video
Kuaishou video generation model that can generate 30-second videos with stereo audio in a single pass, supports multi-keyframe and first/last frame control, and is suitable for marketing short films and storyboard previews
Try kling-4.0/text-to-video
Input
Output
Pricing
kling-4.0/text-to-video per second
| Specifications | Unit Price |
|---|---|
| 1080P | $0.330 |
Overview
The Kling 4.0 text-to-video route is designed for developers who need to produce finished clips directly from plain text descriptions. Enter a prompt describing the subject, action, camera movement, and lighting, and you get a video clip that includes both visuals and audio. A single clip can be set to any duration from 3 to 30 seconds, output supports 720p and 1080p, and you can choose from four aspect ratios: 16:9, 9:16, 1:1, and 21:9. It suits teams producing ad spots, vertical social media content, and storyboard previews, and is called through the unified HiAPI.ai interface with billing based on output seconds.
Key Highlights
- A single generation covers 3 to 30 seconds — duration is specified directly as a request parameter, so long shots don't need to be split into multiple segments and stitched together, reducing post-production alignment work.
- Visuals and audio generated together — the scene described in the prompt is produced along with its sound, eliminating a separate voiceover or sound effect step.
- Four aspect ratios for different distribution channels — in addition to landscape and portrait, 1:1 and 21:9 are also available, so you can select the output ratio for a platform placement in one go.
- Switchable resolution on demand — both 720p and 1080p are available; iterate at lower resolution during the draft stage, then raise the clarity for the final version.
Capabilities
Describe shots with long prompts: prompts can be up to 2500 characters, enough to hold a complete description of subject, action, camera movement, lighting, and atmosphere, letting a single request express more complex shot intent.
Parameterized duration control: duration values range from 3 to 30 seconds, and billing is based on output seconds. Short clips and long shots use the same interface, making it easy to allocate cost according to content pacing.
Two-tier resolution output: choose 720p or 1080p; 1080p rendering takes noticeably longer, so it is best run after the creative direction is confirmed.
Preset aspect ratios: aspect_ratio supports 16:9, 9:16, 1:1, and 21:9, so generation directly yields the target placement ratio without a second round of cropping.
Use Cases
- Vertical short videos for social media teams — use a one-sentence scene description plus a 9:16 aspect ratio to generate a roughly 15-second clip, ready for short-video platforms or feed placements.
- Early-stage pitches for advertising creatives — quickly produce multiple versions of a shot concept at 720p so clients can narrow down the direction at a low-cost stage.
- Storyboarding and narrative previews — turn storyboard text into dynamic clips with sound to explain camera movement and pacing to the production team.
- Widescreen-style content — choose the 21:9 aspect ratio to generate cinematic landscape clips for openings or brand image assets.
Limitations and Selection Advice
Currently only text input is supported; you cannot constrain the visuals with reference images or first/last frames, so projects demanding high character consistency and precise composition are hard to control accurately. Public information differs on the maximum resolution, and this route caps out at 1080p. 1080p rendering takes noticeably longer; for long-duration clips, test consistency and stability first. If you have a source image to use as a starting point, switch to the image-to-video route in the same series; if you only need quick drafts, consider the Flash version.
Frequently asked questions
View all FAQs →-
What does the first-frame image need to be?
A publicly reachable jpeg or png URL inside the image_urls array, one image per request. That image becomes the opening frame of the clip.
-
What happens if I leave aspect ratio out?
Output follows the source image's ratio, so a portrait image stays portrait. Set aspect_ratio only when you want to override the original framing.
-
Is the prompt required?
Yes. The first frame supplies composition and identity; the prompt directs motion, camera and sound. Both are required, and shorter prompts usually work better.
-
How is image-to-video billed?
Per output second, same as text-to-video, with separate tiers for 720p and 1080p and no minimum charge.
Create a generation task
https://api.hiapi.ai/v1/tasks Headers
AuthorizationstringRequiredAccount API key. Required on every request. Example: Bearer YOUR_HIAPI_API_KEY. Get your API key
Content-TypestringOptionalThe request body is always parsed as JSON; when sent, only application/json (optionally with charset) is accepted — any other value returns 415. Example: application/json.
Idempotency-KeystringOptionalIdempotency key, up to 255 bytes. Retries with the same key from the same account create the task only once; replays return the original taskId.
On network timeouts or client retries, the same key creates the task only once — no double charges (scope: the API key's account). Use a business-unique identifier as the key (e.g. "order-42"); replays return the original taskId, and keys expire 24 hours after the first request. See the Unified Async API overview for the full scenario matrix.
Body
modelstringRequiredCurrent fixed value: kling-4.0/text-to-video
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for kling-4.0/text-to-video and route default — see the parameter table below.
promptstringRequiredminLength 1maxLength 2500What happens in the shot: subject, action, camera movement, lighting and mood. Audio is generated together with the picture.
durationintegerOptionalDefault: 5min 3max 30Clip length in seconds (3-30). Billed per second.
resolutionstringOptionalDefault: "720p"Output resolution. 1080p takes noticeably longer to render than 720p.
720p1080paspect_ratiostringOptionalDefault: "16:9"Frame shape of the output. 21:9 gives an ultrawide cinematic frame.
16:99:161:121:9callbackobjectOptional
Terminal-state notification config. When omitted, no callback is delivered — poll the task yourself. See the callback note below.
Provide callback.url when creating a task and HiAPI POSTs to your service once the task reaches a terminal state — no polling needed. The callback payload mirrors the task detail structure; signature verification, delivery retries and idempotency are documented on the Unified Async API overview page.
urlstringRequiredRequired when callback is present. A POST is sent to this URL once the task reaches a terminal state; must be a valid http(s) URL.
whenstringOptionalDefault: "final"Only final is supported today — notified on both success and fail.
finalstoragestringOptionalDefault: "temp"Artifact storage tier: temp (default, retained about 7 days) or persistent (long-term, billed by size). Insufficient balance or exceeding the storage cap silently downgrades to temp; the effective tier is shown in the task detail response.
temppersistentRequest examples
# Submit an async task; returns a taskId immediately (no waiting for generation)
curl -X POST "https://api.hiapi.ai/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0/text-to-video",
"input": {
"prompt": "…",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}' const res = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "kling-4.0/text-to-video",
input: {
"prompt": "…",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "kling-4.0/text-to-video",
"input": {
"prompt": "…",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} Get task detail
https://api.hiapi.ai/v1/tasks/:id Response fields
taskIdstringRequiredTask ID, always prefixed with tk-hiapi-.
modelstringRequiredResolved full model name. Tasks submitted with the route parameter return base@route (e.g. gpt-image-2/text-to-image@ext); otherwise identical to the name passed at creation.
routestringOptionalPresent only when the task was submitted with an explicit route parameter; echoes the submitted value.
statusstringRequiredTask status.
queued Queued, not started yet.
handling Being processed.
archiving Processing finished, artifacts being prepared.
success Terminal: completed, artifacts available (output returned).
fail Terminal: failed (error returned).
After submission, check status: success and fail are terminal, everything else is non-terminal. Poll every 1–3 seconds until terminal. On success, download artifacts from output[].url and transfer them before expireAt; pass storage: "persistent" at creation time when long-term retention is needed.
creatednumberRequiredTask creation time (Unix seconds).
completednumberRequiredUnix seconds when the task reached a terminal state; fixed to 0 while not terminal.
outputarrayOptional
Present only when status == success. Artifact list — always an array; a single task may return multiple types at once (e.g. video + first_frame).
Array [ object ]
Array items
urlstringRequiredArtifact URL, directly downloadable.
typestringRequiredCurrent possible values: video, image, audio, first_frame, last_frame, thumbnail; more may be added later.
expireAtnumberRequiredUnix seconds until which the artifact remains accessible; download or transfer before it expires.
errorobjectOptional
Present only when status == fail.
codestringRequiredBusiness error code.
messagestringRequiredError description.
Response examples
Success
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} Processing (non-terminal)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} Failed
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
} Articles
View all articles →Related Models
View all models →Same Type
-
Veo 3.1 Google $0.290 /second -
Kling 4.0 Kuaishou $0.330 /second -
MiniMax H3 MiniMax $0.072 /second -
Vidu Q4 Preview Vidu $0.051 /second -
Kling 3.0 Kuaishou $0.100 /second -
Grok Imagine 1.5 xAI $0.011 /second -
LTX 2.5 Fast Lightricks $0.086 /second -
Kandinsky 6.0 Pro $1.93 /video -
Kling AI Avatar Kuaishou -- -
Vidu Q3 Vidu $0.149 /second -
HappyHorse 1.0 Alibaba $0.168 /second -
Creatify Boreal Creatify $0.015 /second