Kling 4.0
Kling 4.0 API. The newest Kling video model: text-to-video and image-to-video, 3-30 seconds, 720p or 1080p, 21:9 to 9:16.
Pricing, live playground and model overview: Kling 4.0 API on YepAPI
/v1/media/queueOverview
Kling 4.0 — the newest Kling video model, with clips up to 30 seconds at 720p or 1080p and ultrawide 21:9 framing. Async operation — submit a job, poll for completion.
| Property | Value |
|---|---|
| Model ID | kwaivgi/kling-v4.0 |
| Alias | kling-4, kling-4.0 |
| Provider | Kling |
| Inputs | text-to-video, image-to-video |
| Resolutions | 720p, 1080p |
| Aspect Ratios | 21:9, 16:9, 9:16, 1:1 |
| Duration | 3–30 seconds |
| Audio Generation | Not supported |
| Billing | Per job — priced when queued, charged only on success |
| Pricing | from $0.267/second |
Usage
All media models use the async job queue. Submit a job, then poll for the result.
Step 1: Submit Job
Text-to-Video
const res = await fetch('https://api.yepapi.com/v1/media/queue', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'kwaivgi/kling-v4.0',
prompt: 'A cinematic drone shot over a rugged coastline at golden hour',
options: {
aspectRatio: '16:9',
resolution: '1080p',
duration: '5',
},
}),
});
const { data } = await res.json();
// data.jobId — use this to poll for resultscurl -X POST https://api.yepapi.com/v1/media/queue \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "kwaivgi/kling-v4.0", "prompt": "A cinematic drone shot over a rugged coastline", "options": {"aspectRatio": "16:9", "resolution": "1080p", "duration": "5"}}'Image-to-Video
Pass a starting image via imageData to animate it.
const res = await fetch('https://api.yepapi.com/v1/media/queue', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'kwaivgi/kling-v4.0',
prompt: 'Animate this scene — clouds drifting, light changing',
options: {
resolution: '1080p',
duration: '5',
},
imageData: {
mimeType: 'image/jpeg',
base64: '...', // Base64-encoded image
},
}),
});curl -X POST https://api.yepapi.com/v1/media/queue \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "kwaivgi/kling-v4.0", "prompt": "Animate this scene — clouds drifting, light changing", "options": {"resolution": "1080p", "duration": "5"}, "imageData": {"mimeType": "image/jpeg", "base64": "..."}}'Step 2: Poll for Result
const status = await fetch(`https://api.yepapi.com/v1/media/status/${data.jobId}`, {
headers: { 'x-api-key': 'YOUR_API_KEY' },
});
const { data: job } = await status.json();
// job.status — "pending" | "processing" | "completed" | "failed"
// job.result.video — { mimeType, base64 } when completedcurl https://api.yepapi.com/v1/media/status/JOB_ID \
-H "x-api-key: YOUR_API_KEY"Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | Yes | kwaivgi/kling-v4.0 or aliases kling-4, kling-4.0 | — |
prompt | string | Yes | Text description of the video to generate | — |
options.aspectRatio | string | No | One of: 21:9, 16:9, 9:16, 1:1 (text-to-video only) | 16:9 |
options.resolution | string | No | 720p, 1080p | 1080p |
options.duration | string or number | No | 3 to 30 (seconds) | 5 |
imageData.mimeType | string | No | MIME type of input image (image/png, image/jpeg, image/webp) | — |
imageData.base64 | string | No | Base64-encoded input image for image-to-video generation | — |
Options are validated when you submit: an unsupported duration, resolution or value returns 400 naming the allowed values.
Features
- Text-to-video and image-to-video
- 3–30 seconds, the longest Kling clips
- 720p or 1080p
- 21:9, 16:9, 9:16 and 1:1 (text-to-video)
Pricing
| Tier | ≈ Cost/sec | 5-second video |
|---|---|---|
| 720p | $0.267 | $1.34 |
| 1080p | $0.40 | $2.00 |
Prices shown are for a 5-second clip at the default settings; longer clips cost proportionally more. Each job is priced when it's queued — the exact quote for your duration, resolution and options — and charged only if it succeeds. Failed or moderated jobs are free.
Video jobs can take several minutes to complete. When capacity is busy, jobs wait in the queue (status stays pending or processing) — no action needed. Results retained for 1 hour.
Powered by Kling's Kling 4.0 via our AI provider.
Ideogram 4.0
Ideogram 4.0 API. Best-in-class text rendering for posters, packaging and logos, with 23 aspect ratios and optional image reference.
Kling 3.0 Pro
Kling 3.0 Pro API. Cinematic text-to-video and image-to-video, 3-15 seconds, native audio on by default, multi-shot prompts and first/last-frame control.