Skip to content

Commit cc34bec

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-394: docs: move examples up for klings
1 parent 1d69507 commit cc34bec

17 files changed

Lines changed: 256 additions & 370 deletions
152 KB
Loading

docs/api-references/video-models/Kling-AI/v1-pro-image-to-video.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1/pro/image-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
This model transforms static images into dynamic video clips. Offers more advanced camera controls than v1 Standard model, including options for tilt, pan, zoom, and roll movements. Results in richer details and more stable camera movements, enhancing the overall visual quality of the generated videos. Produces significantly sharper and more detailed videos. Enhanced animations make elements like water flow and character movements appear more natural and engaging.
1210

1311
## Setup your API Key

docs/api-references/video-models/Kling-AI/v1-pro-text-to-video.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1/pro/text-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
11-
This model converts textual descriptions into high-quality video content. Provides advanced camera control options, including more sophisticated movements and stabilization. Maximum Video Length: 10 s.
9+
This model converts textual descriptions into high-quality video content. Provides advanced camera control options, including more sophisticated movements and stabilization. 
1210

1311
## Setup your API Key
1412

docs/api-references/video-models/Kling-AI/v1-standard-image-to-video.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1/standard/image-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
A model transforms static images into dynamic video clips.
1210

1311
## Setup your API Key
@@ -29,26 +27,6 @@ Below, you can find both corresponding API schemas.
2927

3028
</details>
3129

32-
## API Schemas
33-
34-
### Create a video generation task and send it to the server
35-
36-
{% hint style="warning" %}
37-
The `ratio` and `aspect_ratio` parameters are deprecated. The aspect ratio of the generated video is solely determined by the aspect ratio of the input reference image.
38-
{% endhint %}
39-
40-
{% openapi src="v1-standard-image-to-video.json" path="/v2/generate/video/kling/generation" method="post" %}
41-
[v1-standard-image-to-video.json](v1-standard-image-to-video.json)
42-
{% endopenapi %}
43-
44-
### Retrieve the generated video from the server
45-
46-
After sending a request for video generation, this task is added to the queue. Based on the service's load, the generation can be completed in seconds or take a bit more. &#x20;
47-
48-
{% openapi src="v1-standard-image-to-video-pair.json" path="/v2/generate/video/kling/generation" method="get" %}
49-
[v1-standard-image-to-video-pair.json](v1-standard-image-to-video-pair.json)
50-
{% endopenapi %}
51-
5230
## Full Example: Generating and Retrieving the Video From the Server
5331

5432
We have a classic [reproduction](https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg) of the famous da Vinci painting. Let's ask the model to generate a video where the Mona Lisa puts on glasses.
@@ -355,3 +333,23 @@ Processing complete:/n {'id': '0ebebc75-7c09-404b-ac36-345ef346a0ac:kling-video/
355333
<figure><img src="../../../.gitbook/assets/kling-video-v1-standard-image-to-video_preview.gif" alt=""><figcaption></figcaption></figure>
356334

357335
</details>
336+
337+
## API Schemas
338+
339+
### Create a video generation task and send it to the server
340+
341+
{% hint style="warning" %}
342+
The `ratio` and `aspect_ratio` parameters are deprecated. The aspect ratio of the generated video is solely determined by the aspect ratio of the input reference image.
343+
{% endhint %}
344+
345+
{% openapi src="v1-standard-image-to-video.json" path="/v2/generate/video/kling/generation" method="post" %}
346+
[v1-standard-image-to-video.json](v1-standard-image-to-video.json)
347+
{% endopenapi %}
348+
349+
### Retrieve the generated video from the server
350+
351+
After sending a request for video generation, this task is added to the queue. Based on the service's load, the generation can be completed in seconds or take a bit more. &#x20;
352+
353+
{% openapi src="v1-standard-image-to-video-pair.json" path="/v2/generate/video/kling/generation" method="get" %}
354+
[v1-standard-image-to-video-pair.json](v1-standard-image-to-video-pair.json)
355+
{% endopenapi %}

docs/api-references/video-models/Kling-AI/v1-standard-text-to-video.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1/standard/text-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
This model converts textual descriptions into high-quality video content. Maximum Video Length: 5 s.
1210

1311
## Setup your API Key

docs/api-references/video-models/Kling-AI/v1.6-pro-image-to-video.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1.6/pro/image-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
An advanced AI video generation model, designed to create high-quality videos from image. This version introduces significant improvements in visual quality and dynamic action rendering, enabling users to generate more consistent and visually appealing results compared to its predecessor, Kling 1.5. Incorporates natural camera movements and transitions for more cinematic outputs.
1210

1311
## Setup your API Key

docs/api-references/video-models/Kling-AI/v1.6-standard-text-to-video.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1.6/standard/text-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
An advanced AI video generation model, designed to create high-quality videos from text prompts and images. This version introduces significant improvements in prompt adherence, visual quality, and dynamic action rendering, enabling users to generate more consistent and visually appealing results compared to its predecessor, Kling 1.5.
1210

1311
## Setup your API Key

docs/api-references/video-models/Kling-AI/v1.6-standart-image-to-video.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1.6/standard/image-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
An advanced AI video generation model developed by Kuaishou Technology, designed to create high-quality videos from text prompts and images. This version introduces significant improvements in prompt adherence, visual quality, and dynamic action rendering, enabling users to generate more consistent and visually appealing results compared to its predecessor, Kling 1.5.
1210

1311
## Setup your API Key

docs/api-references/video-models/kling-ai/v1.6-pro-effects.md

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `klingai/kling-video-v1.6-pro-effects`
77
{% endhint %}
88

9-
## Model Overview
10-
119
A specialized video model that generates short clips based on reference images of people, applying one of several preset scenarios: two people hugging, kissing, or making a heart shape with their hands (requires **2** reference images), or a single person being humorously squished like clay or inflated like a balloon (requires **1** reference image).
1210

1311
<details>
@@ -38,38 +36,7 @@ Processing complete:/n {'id': '50f3e8ae-3d88-482f-95ea-7faa4799f60f:kling-video/
3836

3937
If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](../../../quickstart/setting-up.md).
4038

41-
## How to Make a Call
42-
43-
<details>
44-
45-
<summary>Step-by-Step Instructions</summary>
46-
47-
Generating a video using this model involves sequentially calling two endpoints:&#x20;
48-
49-
* The first one is for creating and sending a video generation task to the server (returns a generation ID).
50-
* The second one is for requesting the generated video from the server using the generation ID received from the first endpoint.&#x20;
51-
52-
Below, you can find two corresponding API schemas and an example with both endpoint calls.
53-
54-
</details>
55-
56-
## API Schemas
57-
58-
### Create a video generation task and send it to the server
59-
60-
{% openapi-operation spec="klingai-v1-6-pro-effects" path="/v2/generate/video/kling/generation" method="post" %}
61-
[OpenAPI klingai-v1-6-pro-effects](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/Kling-AI/v1.6-pro-effects.json)
62-
{% endopenapi-operation %}
63-
64-
### Retrieve the generated video from the server
65-
66-
After sending a request for video generation, this task is added to the queue. Based on the service's load, the generation can be completed in seconds or take a bit more.&#x20;
67-
68-
{% openapi-operation spec="kling-video-retrieve" path="/v2/generate/video/kling/generation" method="get" %}
69-
[OpenAPI kling-video-retrieve](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/Kling-AI/v1.6-pro-effects-pair.json)
70-
{% endopenapi-operation %}
71-
72-
## Code Example (Python)
39+
## Code Example
7340

7441
In this example, we'll try to make two people from different photos (provided via URLs) form a romantic heart shape with their hands. No prompt is required — the effect is selected by setting the appropriate value for the `effect_scene` parameter.
7542

@@ -91,6 +58,8 @@ In videos featuring a single person (the `squish` and `expansion` effects), an a
9158

9259
The code below creates a video generation task, then automatically polls the server every **10** seconds until it finally receives the video URL.
9360

61+
{% tabs %}
62+
{% tab title="Python" %}
9463
{% code overflow="wrap" %}
9564
```python
9665
import requests
@@ -122,7 +91,6 @@ def generate_video():
12291
print(f"Error: {response.status_code} - {response.text}")
12392
else:
12493
response_data = response.json()
125-
#print(response_data)
12694
return response_data
12795

12896

@@ -138,17 +106,14 @@ def get_video(gen_id):
138106
"Authorization": f"Bearer {api_key}",
139107
"Content-Type": "application/json"
140108
}
141-
142109
response = requests.get(url, params=params, headers=headers)
143110
return response.json()
144111

145-
146-
147112
def main():
148-
# Running video generation and getting a task id
113+
# Running video generation and getting a task id
149114
gen_response = generate_video()
150115
gen_id = gen_response.get("id")
151-
print("Gen_ID: ", gen_id)
116+
print("Generation ID: ", gen_id)
152117

153118
# Trying to retrieve the video from the server every 10 sec
154119
if gen_id:
@@ -173,13 +138,14 @@ def main():
173138
return response_data
174139

175140
print("Timeout reached. Stopping.")
176-
return None
177-
141+
return None
178142

179143
if __name__ == "__main__":
180144
main()
181145
```
182146
{% endcode %}
147+
{% endtab %}
148+
{% endtabs %}
183149

184150
<details>
185151

@@ -226,3 +192,26 @@ Processing complete:/n {'id': '91bc5296-f0f9-4336-ab6a-60f993cbb971:kling-video/
226192
<figure><img src="../../../.gitbook/assets/kling-effects-heart (1).gif" alt=""><figcaption></figcaption></figure>
227193

228194
</details>
195+
196+
## API Schemas
197+
198+
Generating a video using this model involves sequentially calling two endpoints:&#x20;
199+
200+
* The first one is for creating and sending a video generation task to the server (returns a generation ID).
201+
* The second one is for requesting the generated video from the server using the generation ID received from the first endpoint.&#x20;
202+
203+
Below, you can find two corresponding API schemas and an example with both endpoint calls.
204+
205+
### Create a video generation task and send it to the server
206+
207+
{% openapi-operation spec="klingai-v1-6-pro-effects" path="/v2/generate/video/kling/generation" method="post" %}
208+
[OpenAPI klingai-v1-6-pro-effects](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/Kling-AI/v1.6-pro-effects.json)
209+
{% endopenapi-operation %}
210+
211+
### Retrieve the generated video from the server
212+
213+
After sending a request for video generation, this task is added to the queue. Based on the service's load, the generation can be completed in seconds or take a bit more.&#x20;
214+
215+
{% openapi-operation spec="kling-video-retrieve" path="/v2/generate/video/kling/generation" method="get" %}
216+
[OpenAPI kling-video-retrieve](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/Kling-AI/v1.6-pro-effects-pair.json)
217+
{% endopenapi-operation %}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This documentation is valid for the following list of our models:
66
* `kling-video/v1.6/pro/text-to-video`
77
{% endhint %}
88

9-
## Model Overview
10-
119
An advanced AI video generation model, designed to create high-quality videos from text prompts and images. This version introduces significant improvements in prompt adherence, visual quality, and dynamic action rendering, enabling users to generate more consistent and visually appealing results compared to its predecessor, Kling 1.5.
1210

1311
## Setup your API Key

0 commit comments

Comments
 (0)