Skip to content

Commit 4c307a9

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-650: docs: fix gpt 5.2 pro desc and schema
1 parent a785713 commit 4c307a9

5 files changed

Lines changed: 175 additions & 129 deletions

File tree

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@
271271
* [video-v2.6-pro-image-to-video](api-references/video-models/kling-ai/video-v2.6-pro-image-to-video.md)
272272
* [kling o1 models](api-references/video-models/kling-ai/kling-o1-models.md)
273273
* [video o1 reference to video kling ai](api-references/video-models/kling-ai/video-o1-reference-to-video-kling-ai.md)
274+
* [video-o1-image-to-video](api-references/video-models/kling-ai/video-o1-image-to-video.md)
274275
* [Krea](api-references/video-models/krea/README.md)
275276
* [krea-wan-14b/text-to-video](api-references/video-models/krea/krea-wan-14b-text-to-video.md)
276277
* [krea-wan-14b/video-to-video](api-references/video-models/krea/krea-wan-14b-video-to-video.md)

docs/api-references/text-models-llm/openai/gpt-5.2-pro.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ This documentation is valid for the following list of our models:
1616

1717
## Model Overview
1818

19-
{% openapi-operation spec="gpt-5-2-pro-RESPONSES" path="/v1/responses" method="post" %}
20-
[OpenAPI gpt-5-2-pro-RESPONSES](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/text-models-llm/OpenAI/gpt-5-2-pro-RESPONSES.json)
21-
{% endopenapi-operation %}
19+
The Pro version is built for more challenging tasks and is available only through the Responses API, as it supports multi-turn interactions before generating a response.
2220

2321
## How to Make a Call
2422

@@ -56,7 +54,21 @@ If you need a more detailed walkthrough for setting up your development environm
5654

5755
## API Schema
5856

57+
<details>
58+
59+
<summary>Chat Completions vs. Responses API</summary>
60+
61+
**Chat Completions**\
62+
The _chat completions_ API is the older, chat-oriented interface where you send a list of messages (`role: user`, `role: assistant`, etc.), and the model returns a single response. It was designed specifically for conversational workflows and follows a structured chat message format. It is now considered a legacy interface.
5963

64+
**Responses**\
65+
The _Responses_ API is the newer, unified interface used across OpenAI’s latest models. Instead of focusing only on chat, it supports multiple input types (text, images, audio, tools, etc.) and multiple output modalities (text, JSON, images, audio, video). It is more flexible, more consistent across models, and intended to replace chat completions entirely.
66+
67+
</details>
68+
69+
{% openapi-operation spec="gpt-5-2-pro-RESPONSES" path="/v1/responses" method="post" %}
70+
[OpenAPI gpt-5-2-pro-RESPONSES](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/text-models-llm/OpenAI/gpt-5-2-pro-RESPONSES.json)
71+
{% endopenapi-operation %}
6072

6173
## Code Example: Using /responses Endpoint
6274

docs/api-references/video-models/kling-ai/avatar-standard.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# avatar-standard
22

33
{% columns %}
4-
{% column %}
4+
{% column width="66.66666666666666%" %}
55
{% hint style="info" %}
66
This documentation is valid for the following list of our models:
77

88
* `klingai/avatar-standard`
99
{% endhint %}
1010
{% endcolumn %}
1111

12-
{% column %}
12+
{% column width="33.33333333333334%" %}
1313

1414
{% endcolumn %}
1515
{% endcolumns %}
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
hidden: true
3+
noIndex: true
4+
---
5+
6+
# video-o1-image-to-video
7+
8+
{% columns %}
9+
{% column width="66.66666666666666%" %}
10+
{% hint style="info" %}
11+
This documentation is valid for the following list of our models:
12+
13+
* `klingai/video-o1-image-to-video`
14+
{% endhint %}
15+
{% endcolumn %}
16+
17+
{% column width="33.33333333333334%" %}
18+
<a href="https://aimlapi.com/app/klingai/video-o1-image-to-video" class="button primary">Try in Playground</a>
19+
{% endcolumn %}
20+
{% endcolumns %}
21+
22+
.
23+
24+
## Setup your API Key
25+
26+
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).
27+
28+
## API Schemas
29+
30+
Generating a video using this model involves sequentially calling two endpoints:
31+
32+
* The first one is for creating and sending a video generation task to the server (returns a generation ID).
33+
* The second one is for requesting the generated video from the server using the generation ID received from the first endpoint.
34+
35+
Below, you can find two corresponding API schemas and an example with both endpoint calls.
36+
37+
### Create a video generation task and send it to the server
38+
39+
{% openapi-operation spec="video-v2-6-pro-image-to-video" path="/v2/video/generations" method="post" %}
40+
[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)
41+
{% endopenapi-operation %}
42+
43+
### Retrieve the generated video from the server
44+
45+
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.\
46+
If the video generation task status is `complete`, the response will include the final result — with the generated video URL and additional metadata.
47+
48+
{% openapi-operation spec="universal-video-endpoint-fetch" path="/v2/video/generations" method="get" %}
49+
[OpenAPI universal-video-endpoint-fetch](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/ByteDance/omnihuman-pair.json)
50+
{% endopenapi-operation %}
51+
52+
## Code Example
53+
54+
The code below creates a video generation task, then automatically polls the server every **15** seconds until it finally receives the video URL.
55+
56+
{% tabs %}
57+
{% tab title="Python" %}
58+
{% code overflow="wrap" %}
59+
```python
60+
import requests
61+
import time
62+
63+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
64+
api_key = "<YOUR_AIMLAPI_KEY>"
65+
base_url = "https://api.aimlapi.com/v2"
66+
67+
# Creating and sending a video generation task to the server
68+
def generate_video():
69+
url = f"{base_url}/video/generations"
70+
headers = {
71+
"Authorization": f"Bearer {api_key}",
72+
}
73+
74+
data = {
75+
"model": "klingai/video-o1-image-to-video",
76+
"prompt": "Mona Lisa puts on glasses with her hands.",
77+
"image_url": "https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg",
78+
"duration": "5",
79+
}
80+
81+
response = requests.post(url, json=data, headers=headers)
82+
83+
if response.status_code >= 400:
84+
print(f"Error: {response.status_code} - {response.text}")
85+
else:
86+
response_data = response.json()
87+
return response_data
88+
89+
# Requesting the result of the task from the server using the generation_id
90+
def get_video(gen_id):
91+
url = f"{base_url}/video/generations"
92+
params = {
93+
"generation_id": gen_id,
94+
}
95+
96+
headers = {
97+
"Authorization": f"Bearer {api_key}",
98+
"Content-Type": "application/json"
99+
}
100+
101+
response = requests.get(url, params=params, headers=headers)
102+
return response.json()
103+
104+
105+
def main():
106+
# Running video generation and getting a task id
107+
gen_response = generate_video()
108+
gen_id = gen_response.get("id")
109+
print("Generation ID: ", gen_id)
110+
111+
# Trying to retrieve the video from the server every 15 sec
112+
if gen_id:
113+
start_time = time.time()
114+
115+
timeout = 1000
116+
while time.time() - start_time < timeout:
117+
response_data = get_video(gen_id)
118+
119+
if response_data is None:
120+
print("Error: No response from API")
121+
break
122+
123+
status = response_data.get("status")
124+
print("Status:", status)
125+
126+
if status == "waiting" or status == "active" or status == "queued" or status == "generating":
127+
print("Still waiting... Checking again in 15 seconds.")
128+
time.sleep(15)
129+
else:
130+
print("Processing complete:/n", response_data)
131+
return response_data
132+
133+
print("Timeout reached. Stopping.")
134+
return None
135+
136+
137+
if __name__ == "__main__":
138+
main()
139+
```
140+
{% endcode %}
141+
{% endtab %}
142+
{% endtabs %}
143+
144+
<details>
145+
146+
<summary>Response</summary>
147+
148+
{% code overflow="wrap" %}
149+
```json5
150+
```
151+
{% endcode %}
152+
153+
</details>
154+
155+
**Processing time**: \~ 1 min 50 sec.
156+
157+
**Generated video** (1180x1756, with sound):

docs/api-references/video-models/pixverse/v5-5-text-to-video.md

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -154,130 +154,6 @@ if __name__ == "__main__":
154154
{% tab title="JavaScript" %}
155155
{% code overflow="wrap" %}
156156
```javascript
157-
// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
158-
const apiKey = "<YOUR_AIMLAPI_KEY>";
159-
const baseUrl = "https://api.aimlapi.com/v2";
160-
const https = require("https");
161-
const { URL } = require("url");
162-
163-
// Creating and sending a video generation task to the server
164-
function generateVideo(callback) {
165-
const data = JSON.stringify({
166-
model: "pixverse/v5.5/text-to-video",
167-
prompt: `
168-
A menacing evil dragon appears in a distance above the tallest mountain, then rushes toward the camera with its jaws open, revealing massive fangs. We see it's coming.
169-
`,
170-
resolution: '1080p',
171-
duration: 5,
172-
});
173-
174-
const url = new URL(`${baseUrl}/generate/video/pixverse/generation`);
175-
const options = {
176-
method: "POST",
177-
headers: {
178-
"Authorization": `Bearer ${apiKey}`,
179-
"Content-Type": "application/json",
180-
"Content-Length": Buffer.byteLength(data)
181-
}
182-
};
183-
184-
const req = https.request(url, options, (res) => {
185-
let body = "";
186-
res.on("data", (chunk) => body += chunk);
187-
res.on("end", () => {
188-
if (res.statusCode >= 400) {
189-
console.error(`Error: ${res.statusCode} - ${body}`);
190-
callback(null);
191-
} else {
192-
const result = JSON.parse(body);
193-
callback(result);
194-
}
195-
});
196-
});
197-
198-
req.on("error", (err) => {
199-
console.error("Request error:", err);
200-
callback(null);
201-
});
202-
203-
req.write(data);
204-
req.end();
205-
}
206-
207-
// Requesting the result of the task from the server using the generation_id
208-
function getVideo(genId, callback) {
209-
const url = new URL(`${baseUrl}/generate/video/pixverse/generation`);
210-
url.searchParams.append("generation_id", genId);
211-
212-
const options = {
213-
method: "GET",
214-
headers: {
215-
"Authorization": `Bearer ${apiKey}`,
216-
"Content-Type": "application/json"
217-
}
218-
};
219-
220-
const req = https.request(url, options, (res) => {
221-
let body = "";
222-
res.on("data", (chunk) => body += chunk);
223-
res.on("end", () => {
224-
const result = JSON.parse(body);
225-
callback(result);
226-
});
227-
});
228-
229-
req.on("error", (err) => {
230-
console.error("Request error:", err);
231-
callback(null);
232-
});
233-
234-
req.end();
235-
}
236-
237-
// Initiates video generation and checks the status every 10 seconds until completion or timeout
238-
function main() {
239-
generateVideo((genResponse) => {
240-
if (!genResponse || !genResponse.id) {
241-
console.error("No generation ID received.");
242-
return;
243-
}
244-
245-
const genId = genResponse.id;
246-
console.log("Generation ID:", genId);
247-
248-
const timeout = 1000 * 1000; // 1000 sec
249-
const interval = 10 * 1000; // 10 sec
250-
const startTime = Date.now();
251-
252-
const checkStatus = () => {
253-
if (Date.now() - startTime >= timeout) {
254-
console.log("Timeout reached. Stopping.");
255-
return;
256-
}
257-
258-
getVideo(genId, (responseData) => {
259-
if (!responseData) {
260-
console.error("Error: No response from API");
261-
return;
262-
}
263-
264-
const status = responseData.status;
265-
console.log("Status:", status);
266-
267-
if (["waiting", "active", "queued", "generating"].includes(status)) {
268-
console.log("Still waiting... Checking again in 10 seconds.");
269-
setTimeout(checkStatus, interval);
270-
} else {
271-
console.log("Processing complete:\n", responseData);
272-
}
273-
});
274-
};
275-
276-
checkStatus();
277-
});
278-
}
279-
280-
main();
281157
```
282158
{% endcode %}
283159
{% endtab %}

0 commit comments

Comments
 (0)