# Kling 4.0 API

> Kling 4.0 generates 3–30 second videos from text, images or references, and edits existing clips, at 720p or 1080p.

Source: https://www.sandbase.ai/models/kling-4-0

## Models

- [KwaiVGI Kling V4 Reference to Video](https://www.sandbase.ai/models/kwaivgi/kling-video/v4/reference-to-video.md): `kwaivgi/kling-video/v4/reference-to-video`; From $1 per run (15% off list price); Kling V4 Reference to Video by Kuaishou generates a 3-30 second video that keeps characters, objects and motion from reference images and videos.
- [KwaiVGI Kling V4 Text to Video](https://www.sandbase.ai/models/kwaivgi/kling-video/v4/text-to-video.md): `kwaivgi/kling-video/v4/text-to-video`; From $1 per run (15% off list price); Kling V4 Text to Video by Kuaishou turns a text prompt into a 3-30 second video at 720p, 1080p or 4K.
- [KwaiVGI Kling V4 Image to Video](https://www.sandbase.ai/models/kwaivgi/kling-video/v4/image-to-video.md): `kwaivgi/kling-video/v4/image-to-video`; From $1 per run (15% off list price); Kling V4 Image to Video by Kuaishou animates a start image, optionally toward an end image, into a 3-30 second video.
- [KwaiVGI Kling V4 Video Edit](https://www.sandbase.ai/models/kwaivgi/kling-video/v4/video-edit.md): `kwaivgi/kling-video/v4/video-edit`; From $7.19 per run (15% off list price); Kling V4 Video Edit by Kuaishou edits a 3-30 second source video from a text instruction and optional reference images.

## Model lineup

The most used endpoints first.

| Model | Task | What it does |
| --- | --- | --- |
| Kling V4 Reference to Video | Reference → video | Kling V4 Reference to Video by Kuaishou generates a 3-30 second video that keeps characters, objects and motion from reference images and videos |
| Kling V4 Text to Video | Text → video | Kling V4 Text to Video by Kuaishou turns a text prompt into a 3-30 second video at 720p or 1080p |
| Kling V4 Image to Video | Image → video | Kling V4 Image to Video by Kuaishou animates a start image, optionally toward an end image, into a 3-30 second video |
| Kling V4 Video Edit | Video → video | Kling V4 Video Edit by Kuaishou edits a 3-30 second source video from a text instruction and optional reference images |

## Overview

### Kling 4.0 on SandBase

Kling 4.0 is the newest Kling generation. Its main change is clip length: every endpoint works with 3–30 second videos, up from 15 seconds on Kling 3.0.

- **Text to video:** 3–30 seconds at 720p or 1080p.
- **Image to video:** animate a start image, optionally toward an end image.
- **Reference to video:** keep characters, objects and motion from reference images and videos.
- **Video edit:** change a 3–30 second source clip with a text instruction and optional reference images.

Need 4K, Motion Control or talking avatars? Those are on [Kling 3.0](https://www.sandbase.ai/models/kling-3-0). Every version is on [Kling API](https://www.sandbase.ai/models/kling).

## Start using Kling 4.0 API on SandBase

One API key and one request shape for every model on this page.

1. **Create an API key** Sign in to the SandBase Console and create a key on the API Keys page. Keep it in an environment variable and never commit it to source control.

```
export SANDBASE_API_KEY="YOUR_SANDBASE_API_KEY"
```

2. **Submit a run** Send a request to the Unified Run API with model kwaivgi/kling-video/v4/text-to-video. Only the model field changes between models on this page.

```
curl https://api.sandbase.ai/v1/run \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "kwaivgi/kling-video/v4/text-to-video", "prompt": "A single drop of water falls from a leaf into a shallow dish, golden window light, macro shot"}'
```

3. **Fetch the result** The response includes a run id. Poll it every few seconds until the status is completed, then download the output URL.

```
curl https://api.sandbase.ai/v1/run/$RUN_ID \
  -H "Authorization: Bearer $SANDBASE_API_KEY"
```

## FAQ

### How long can Kling 4.0 videos be?

3 to 30 seconds on every Kling 4.0 endpoint.

### What resolutions does Kling 4.0 support?

Text to Video lists 720p and 1080p. Check each model page for its options.

### Kling 4.0 or Kling 3.0?

Use 4.0 for clips longer than 15 seconds and reference-guided video. Use 3.0 for native 4K and Motion Control.

### Can Kling 4.0 edit an existing video?

Yes. Kling V4 Video Edit changes a 3–30 second clip from a text instruction and optional reference images.

## Use it through SandBase

- Base URL: `https://api.sandbase.ai/v1`, with `Authorization: Bearer $SANDBASE_API_KEY`.
- Language models use the OpenAI-compatible `POST /v1/chat/completions`; media models use `POST /v1/run`; data APIs use `POST /v1/api/{vendor}/{endpoint}`.
- AI agents can connect through the SandBase MCP server or CLI: https://www.sandbase.ai/skill.md
- Every model and API page has a Markdown twin at the same URL plus `.md`. Full index: https://www.sandbase.ai/llms.txt
