Skip to content

Commit ada5865

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-573: docs: add 2 kling v2.6 pro
1 parent a01b64b commit ada5865

5 files changed

Lines changed: 194 additions & 56 deletions

File tree

docs/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@
262262
* [v2.5-turbo/pro/image-to-video](api-references/video-models/kling-ai/v2.5-turbo-pro-image-to-video.md)
263263
* [avatar-standard](api-references/video-models/kling-ai/avatar-standard.md)
264264
* [avatar-pro](api-references/video-models/kling-ai/avatar-pro.md)
265-
* [v2.6-pro/text-to-video](api-references/video-models/kling-ai/video-v2-6-pro-text-to-video.md)
265+
* [video-v2.6-pro-text-to-video](api-references/video-models/kling-ai/video-v2-6-pro-text-to-video.md)
266+
* [video-v2.6-pro-image-to-video](api-references/video-models/kling-ai/video-v2.6-pro-image-to-video.md)
266267
* [Krea](api-references/video-models/krea/README.md)
267268
* [krea-wan-14b/text-to-video](api-references/video-models/krea/krea-wan-14b-text-to-video.md)
268269
* [krea-wan-14b/video-to-video](api-references/video-models/krea/krea-wan-14b-video-to-video.md)

docs/api-references/model-database.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/api-references/video-models/README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/api-references/video-models/kling-ai/video-v2-6-pro-text-to-video.md

Lines changed: 25 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
---
2-
hidden: true
3-
noIndex: true
4-
---
5-
6-
# v2.6-pro/text-to-video
1+
# video-v2.6-pro-text-to-video
72

83
{% columns %}
94
{% column width="66.66666666666666%" %}
@@ -19,7 +14,7 @@ This documentation is valid for the following list of our models:
1914
{% endcolumn %}
2015
{% endcolumns %}
2116

22-
17+
A high-end AI system for producing cinematic, high-fidelity videos from text prompts, featuring native audio generation and smooth, natural motion. The flagship Kling model as of early December 2025.
2318

2419
## Setup your API Key
2520

@@ -73,21 +68,19 @@ base_url = "https://api.aimlapi.com/v2"
7368

7469
# Creating and sending a video generation task to the server
7570
def generate_video():
76-
url = f"{base_url}/generate/video/kling/generation"
71+
url = f"{base_url}/video/generations"
7772
headers = {
7873
"Authorization": f"Bearer {api_key}",
7974
}
8075

8176
data = {
82-
"model": "klingai/v2.5-turbo/pro/text-to-video",
77+
"model": "klingai/video-v2-6-pro-text-to-video",
8378
"prompt": "A cheerful white raccoon running through a sequoia forest",
8479
"aspect_ratio": "16:9",
85-
"duration": "5",
86-
"cfg_scale": 0.9
80+
"duration": "5"
8781
}
8882

8983
response = requests.post(url, json=data, headers=headers)
90-
9184
if response.status_code >= 400:
9285
print(f"Error: {response.status_code} - {response.text}")
9386
else:
@@ -97,7 +90,7 @@ def generate_video():
9790

9891
# Requesting the result of the task from the server using the generation_id
9992
def get_video(gen_id):
100-
url = f"{base_url}/generate/video/kling/generation"
93+
url = f"{base_url}/video/generations"
10194
params = {
10295
"generation_id": gen_id,
10396
}
@@ -110,13 +103,14 @@ def get_video(gen_id):
110103
response = requests.get(url, params=params, headers=headers)
111104
return response.json()
112105

106+
113107
def main():
114108
# Running video generation and getting a task id
115109
gen_response = generate_video()
116110
gen_id = gen_response.get("id")
117111
print("Generation ID: ", gen_id)
118112

119-
# Trying to retrieve the video from the server every 10 sec
113+
# Trying to retrieve the video from the server every 15 sec
120114
if gen_id:
121115
start_time = time.time()
122116

@@ -132,8 +126,8 @@ def main():
132126
print("Status:", status)
133127

134128
if status == "waiting" or status == "active" or status == "queued" or status == "generating":
135-
print("Still waiting... Checking again in 10 seconds.")
136-
time.sleep(10)
129+
print("Still waiting... Checking again in 15 seconds.")
130+
time.sleep(15)
137131
else:
138132
print("Processing complete:/n", response_data)
139133
return response_data
@@ -155,48 +149,26 @@ if __name__ == "__main__":
155149

156150
{% code overflow="wrap" %}
157151
```json5
158-
Generation ID: a248abc5-3122-45a9-a9ee-352e4642e01c:klingai/v2.5-turbo/pro/text-to-video
159-
Status: generating
160-
Still waiting... Checking again in 10 seconds.
161-
Status: generating
162-
Still waiting... Checking again in 10 seconds.
163-
Status: generating
164-
Still waiting... Checking again in 10 seconds.
165-
Status: generating
166-
Still waiting... Checking again in 10 seconds.
167-
Status: generating
168-
Still waiting... Checking again in 10 seconds.
169-
Status: generating
170-
Still waiting... Checking again in 10 seconds.
171-
Status: generating
172-
Still waiting... Checking again in 10 seconds.
173-
Status: generating
174-
Still waiting... Checking again in 10 seconds.
175-
Status: generating
176-
Still waiting... Checking again in 10 seconds.
177-
Status: generating
178-
Still waiting... Checking again in 10 seconds.
179-
Status: generating
180-
Still waiting... Checking again in 10 seconds.
181-
Status: generating
182-
Still waiting... Checking again in 10 seconds.
183-
Status: generating
184-
Still waiting... Checking again in 10 seconds.
185-
Status: generating
186-
Still waiting... Checking again in 10 seconds.
187-
Status: generating
188-
Still waiting... Checking again in 10 seconds.
189-
Status: generating
190-
Still waiting... Checking again in 10 seconds.
152+
Generation ID: bfb9eca8-178f-41ca-a1f1-6e4551157a0b:klingai/video-v2-6-pro-text-to-video
153+
Status: generating. Checking again in 15 seconds.
154+
Status: generating. Checking again in 15 seconds.
155+
Status: generating. Checking again in 15 seconds.
156+
Status: generating. Checking again in 15 seconds.
157+
Status: generating. Checking again in 15 seconds.
158+
Status: generating. Checking again in 15 seconds.
159+
Status: generating. Checking again in 15 seconds.
160+
Status: generating. Checking again in 15 seconds.
161+
Status: generating. Checking again in 15 seconds.
162+
Status: generating. Checking again in 15 seconds.
191163
Status: completed
192-
Processing complete:/n {'id': 'a248abc5-3122-45a9-a9ee-352e4642e01c:klingai/v2.5-turbo/pro/text-to-video', 'status': 'completed', 'video': {'url': 'https://cdn.aimlapi.com/eagle/files/lion/l7XgndUauE6MRszEJjNSm_output.mp4', 'content_type': 'video/mp4', 'file_name': 'output.mp4', 'file_size': 20235536}}
164+
Processing complete:/n {'id': 'bfb9eca8-178f-41ca-a1f1-6e4551157a0b:klingai/video-v2-6-pro-text-to-video', 'status': 'completed', 'video': {'url': 'https://cdn.aimlapi.com/flamingo/files/b/0a84eb06/XtWjnJNjQLBMwJbBz4WcF_output.mp4'}}
193165
```
194166
{% endcode %}
195167

196168
</details>
197169

198-
**Original**: [1920x1080](https://drive.google.com/file/d/1jAhXF-NO9W3IncmivJXlTHOaI6c2BAqT/view?usp=sharing)
170+
**Processing time**: \~ 2 min 32 sec.
199171

200-
**Low-res GIF preview**:
172+
**Generated video** (1920x1080, with sound):
201173

202-
<div align="left"><figure><img src="../../../.gitbook/assets/klingai-v2.5-turbo-pro-text-to-video_preview.gif" alt=""><figcaption><p><code>"prompt": "A cheerful white raccoon running through a sequoia forest"</code></p></figcaption></figure></div>
174+
{% embed url="https://drive.google.com/file/d/1hc9nwAaoefJi3mglf3vWztoDHZNV4z2O/view" %}
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# video-v2.6-pro-image-to-video
2+
3+
{% columns %}
4+
{% column width="66.66666666666666%" %}
5+
{% hint style="info" %}
6+
This documentation is valid for the following list of our models:
7+
8+
* `klingai/video-v2-6-pro-image-to-video`
9+
{% endhint %}
10+
{% endcolumn %}
11+
12+
{% column width="33.33333333333334%" %}
13+
<a href="https://aimlapi.com/app/klingai/video-v2-6-pro-image-to-video" class="button primary">Try in Playground</a>
14+
{% endcolumn %}
15+
{% endcolumns %}
16+
17+
A high-end AI system for producing cinematic, high-fidelity videos from text prompts and reference images, featuring native audio generation and smooth, natural motion. The flagship Kling model as of early December 2025.
18+
19+
## Setup your API Key
20+
21+
If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).
22+
23+
## API Schemas
24+
25+
Generating a video using this model involves sequentially calling two endpoints:
26+
27+
* The first one is for creating and sending a video generation task to the server (returns a generation ID).
28+
* The second one is for requesting the generated video from the server using the generation ID received from the first endpoint.
29+
30+
Below, you can find two corresponding API schemas and an example with both endpoint calls.
31+
32+
### Create a video generation task and send it to the server
33+
34+
{% openapi-operation spec="video-v2-6-pro-image-to-video" path="/v2/video/generations" method="post" %}
35+
[OpenAPI video-v2-6-pro-image-to-video](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/Kling-AI/video-v2-6-pro-image-to-video.json)
36+
{% endopenapi-operation %}
37+
38+
### Retrieve the generated video from the server
39+
40+
After sending a request for video generation, this task is added to the queue. This endpoint lets you check the status of a video generation task using its `generation_id`, obtained from the endpoint described above.\
41+
If the video generation task status is `complete`, the response will include the final result — with the generated video URL and additional metadata.
42+
43+
{% openapi-operation spec="kling-fetch" path="/v2/generate/video/kling/generation" method="get" %}
44+
[OpenAPI kling-fetch](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/Kling-AI/v1.6-standard-effects-pair.json)
45+
{% endopenapi-operation %}
46+
47+
## Code Example
48+
49+
The code below creates a video generation task, then automatically polls the server every **15** seconds until it finally receives the video URL.
50+
51+
{% tabs %}
52+
{% tab title="Python" %}
53+
{% code overflow="wrap" %}
54+
```python
55+
import requests
56+
import time
57+
58+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
59+
api_key = "<YOUR_AIMLAPI_KEY>"
60+
base_url = "https://api.aimlapi.com/v2"
61+
62+
# Creating and sending a video generation task to the server
63+
def generate_video():
64+
url = f"{base_url}/generate/video/kling/generation"
65+
headers = {
66+
"Authorization": f"Bearer {api_key}",
67+
}
68+
69+
data = {
70+
"model": "klingai/video-v2-6-pro-image-to-video",
71+
"prompt": "Mona Lisa puts on glasses with her hands.",
72+
"image_url": "https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg",
73+
"duration": "5",
74+
}
75+
76+
response = requests.post(url, json=data, headers=headers)
77+
78+
if response.status_code >= 400:
79+
print(f"Error: {response.status_code} - {response.text}")
80+
else:
81+
response_data = response.json()
82+
return response_data
83+
84+
85+
# Requesting the result of the task from the server using the generation_id
86+
def get_video(gen_id):
87+
url = f"{base_url}/generate/video/kling/generation"
88+
params = {
89+
"generation_id": gen_id,
90+
}
91+
92+
headers = {
93+
"Authorization": f"Bearer {api_key}",
94+
"Content-Type": "application/json"
95+
}
96+
97+
response = requests.get(url, params=params, headers=headers)
98+
return response.json()
99+
100+
101+
def main():
102+
# Running video generation and getting a task id
103+
gen_response = generate_video()
104+
gen_id = gen_response.get("id")
105+
print("Generation ID: ", gen_id)
106+
107+
# Trying to retrieve the video from the server every 15 sec
108+
if gen_id:
109+
start_time = time.time()
110+
111+
timeout = 1000
112+
while time.time() - start_time < timeout:
113+
response_data = get_video(gen_id)
114+
115+
if response_data is None:
116+
print("Error: No response from API")
117+
break
118+
119+
status = response_data.get("status")
120+
print("Status:", status)
121+
122+
if status == "waiting" or status == "active" or status == "queued" or status == "generating":
123+
print("Still waiting... Checking again in 15 seconds.")
124+
time.sleep(15)
125+
else:
126+
print("Processing complete:/n", response_data)
127+
return response_data
128+
129+
print("Timeout reached. Stopping.")
130+
return None
131+
132+
133+
if __name__ == "__main__":
134+
main()
135+
```
136+
{% endcode %}
137+
{% endtab %}
138+
{% endtabs %}
139+
140+
<details>
141+
142+
<summary>Response</summary>
143+
144+
{% code overflow="wrap" %}
145+
```json5
146+
Generation ID: 27f25c85-e9db-44e9-909a-0c3ceb35cdd9:klingai/video-v2-6-pro-image-to-video
147+
Status: generating. Checking again in 15 seconds.
148+
Status: generating. Checking again in 15 seconds.
149+
Status: generating. Checking again in 15 seconds.
150+
Status: generating. Checking again in 15 seconds.
151+
Status: generating. Checking again in 15 seconds.
152+
Status: generating. Checking again in 15 seconds.
153+
Status: generating. Checking again in 15 seconds.
154+
Status: completed
155+
Processing complete:/n {'id': '27f25c85-e9db-44e9-909a-0c3ceb35cdd9:klingai/video-v2-6-pro-image-to-video', 'status': 'completed', 'video': {'url': 'https://cdn.aimlapi.com/flamingo/files/b/0a84eaeb/4JST2nBT5v7zbzIy6RlmW_output.mp4'}}
156+
```
157+
{% endcode %}
158+
159+
</details>
160+
161+
**Processing time**: \~ 1 min 50 sec.
162+
163+
**Generated video** (1180x1756, with sound):
164+
165+
{% embed url="https://drive.google.com/file/d/1q5fWg4Qm92-tSOFPV93UtbMikfb6k0Ma/view" %}

0 commit comments

Comments
 (0)