Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: other
|
| 5 |
+
pipeline_tag: text-to-video
|
| 6 |
+
tags:
|
| 7 |
+
- kling
|
| 8 |
+
- text-to-video
|
| 9 |
+
- image-to-video
|
| 10 |
+
inference: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Kling API
|
| 14 |
+
|
| 15 |
+
**Model Page:** [Kling API](https://apiframe.ai/models/kling-3.0)
|
| 16 |
+
|
| 17 |
+
Community model card for calling Kling through a REST API.
|
| 18 |
+
|
| 19 |
+
This repo documents the `kling-3.0` model as exposed by Apiframe: Kuaishou's Kling Video 3.0, text-to-video and image-to-video, 3–15s, optional native audio, start/end frame control. Related ids on the same endpoint: `kling-3.0-omni`, `kling-3.0-motion-control`.
|
| 20 |
+
|
| 21 |
+
This repository does not host weights. Kling is a closed model. Inference runs remotely.
|
| 22 |
+
|
| 23 |
+
<video src="https://apiframe.ai/models-examples/kling-3-0-ember-neon-cafe.mp4" width="280" muted controls></video>
|
| 24 |
+
|
| 25 |
+
## Model description
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Architecture | Kling 3.0 |
|
| 30 |
+
| Task | text-to-video; image-to-video |
|
| 31 |
+
| Output | 1 video (`videoUrl`) |
|
| 32 |
+
| Duration | 3, 5, 8, 10, or 15 seconds |
|
| 33 |
+
| Aspect ratios | `1:1`, `9:16`, `16:9` |
|
| 34 |
+
| Modes | `standard` (720p), `pro` (1080p), `4k` |
|
| 35 |
+
| Typical latency | ~135s |
|
| 36 |
+
|
| 37 |
+
## How to use
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
pip install requests
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
import os
|
| 45 |
+
import time
|
| 46 |
+
import requests
|
| 47 |
+
|
| 48 |
+
API = "https://api.apiframe.ai/v2"
|
| 49 |
+
headers = {
|
| 50 |
+
"X-API-Key": os.environ["APIFRAME_API_KEY"],
|
| 51 |
+
"Content-Type": "application/json",
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
job = requests.post(
|
| 55 |
+
f"{API}/videos/generate",
|
| 56 |
+
headers=headers,
|
| 57 |
+
json={
|
| 58 |
+
"model": "kling-3.0",
|
| 59 |
+
"prompt": "a cinematic sunrise over a futuristic cityscape",
|
| 60 |
+
"klingParams": {
|
| 61 |
+
"duration": 5,
|
| 62 |
+
"mode": "pro",
|
| 63 |
+
"aspect_ratio": "16:9",
|
| 64 |
+
"generate_audio": True,
|
| 65 |
+
},
|
| 66 |
+
},
|
| 67 |
+
).json()
|
| 68 |
+
|
| 69 |
+
while True:
|
| 70 |
+
result = requests.get(f"{API}/jobs/{job['jobId']}", headers=headers).json()
|
| 71 |
+
if result["status"] in ("COMPLETED", "FAILED"):
|
| 72 |
+
break
|
| 73 |
+
time.sleep(2)
|
| 74 |
+
|
| 75 |
+
print(result.get("result"))
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
`result["videoUrl"]` is the CDN URL. Pass `webhookUrl` on the generate call if you do not want to poll.
|
| 79 |
+
|
| 80 |
+
### Image-to-video
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
import os
|
| 84 |
+
import requests
|
| 85 |
+
|
| 86 |
+
headers = {
|
| 87 |
+
"X-API-Key": os.environ["APIFRAME_API_KEY"],
|
| 88 |
+
"Content-Type": "application/json",
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
requests.post(
|
| 92 |
+
"https://api.apiframe.ai/v2/videos/generate",
|
| 93 |
+
headers=headers,
|
| 94 |
+
json={
|
| 95 |
+
"model": "kling-3.0",
|
| 96 |
+
"prompt": "slow push in, steam rising from the cup",
|
| 97 |
+
"klingParams": {
|
| 98 |
+
"start_image": "https://example.com/frame.jpg",
|
| 99 |
+
"duration": 5,
|
| 100 |
+
"mode": "pro",
|
| 101 |
+
"aspect_ratio": "16:9",
|
| 102 |
+
},
|
| 103 |
+
},
|
| 104 |
+
)
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
Swap `model` for `kling-3.0-omni` (reference images/video) or `kling-3.0-motion-control` (transfer motion from a clip onto a character).
|
| 108 |
+
|
| 109 |
+
## Limitations
|
| 110 |
+
|
| 111 |
+
- Closed model. No weights, fine-tuning, or local inference.
|
| 112 |
+
- Requires an Apiframe API key (`X-API-Key`).
|
| 113 |
+
- Commercial use follows Kling's terms.
|
| 114 |
+
- Generated media is retained on the CDN for 90 days.
|
| 115 |
+
|
| 116 |
+
## License
|
| 117 |
+
|
| 118 |
+
Outputs are subject to Kling's terms. This card is documentation only. Apiframe is not affiliated with, endorsed by, or sponsored by Kuaishou Technology.
|