Skip to content

Commit da96175

Browse files
authored
feat: add snippets for magic models
feat: add snippets for magic models
2 parents 988d44e + 6f7f7ec commit da96175

12 files changed

Lines changed: 175 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "Generate a 3d image",
3+
"docs": "https://docs.aimlapi.com/api-references/image-models",
4+
"payload": {
5+
"baseUrl": "https://api.aimlapi.com/v1",
6+
"apiKey": "<YOUR_API_KEY>"
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const main = async () => {
2+
const response = await fetch('{{baseUrl}}/images/generations', {
3+
method: 'POST',
4+
headers: {
5+
Authorization: 'Bearer {{apiKey}}',
6+
'Content-Type': 'application/json',
7+
},
8+
body: JSON.stringify({
9+
model: '{{model}}',
10+
front_image_url: 'https://img.webcdn.ru/catalog/Photo/00-00013154.jpg',
11+
}),
12+
}).then((res) => res.json());
13+
14+
console.log('Generation:', response);
15+
};
16+
17+
main();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import requests
2+
3+
4+
def main():
5+
response = requests.post(
6+
"{{baseUrl}}/images/generations",
7+
headers={
8+
"Authorization": "Bearer {{apiKey}}",
9+
"Content-Type": "application/json",
10+
},
11+
json={
12+
"model": "{{model}}",
13+
"front_image_url": "https://img.webcdn.ru/catalog/Photo/00-00013154.jpg",
14+
},
15+
)
16+
17+
response.raise_for_status()
18+
data = response.json()
19+
20+
print("Generation:", data)
21+
22+
23+
if __name__ == "__main__":
24+
main()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "Generate a video",
3+
"docs": "https://docs.aimlapi.com/api-references/video-models",
4+
"payload": {
5+
"baseUrl": "https://api.aimlapi.com/v2",
6+
"apiKey": "<YOUR_API_KEY>"
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const main = async () => {
2+
const response = await fetch('{{baseUrl}}/video/generations', {
3+
method: 'POST',
4+
headers: {
5+
Authorization: 'Bearer {{apiKey}}',
6+
'Content-Type': 'application/json',
7+
},
8+
body: JSON.stringify({
9+
model: '{{model}}',
10+
image_url: 'https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg',
11+
}),
12+
}).then((res) => res.json());
13+
14+
console.log('Generation:', response);
15+
};
16+
17+
main()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import requests
2+
3+
4+
def main():
5+
url = "{{baseUrl}}/video/generations"
6+
payload = {
7+
"model": "{{model}}",
8+
"image_url": "https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg",
9+
}
10+
headers = {"Authorization": "Bearer {{apiKey}}", "Content-Type": "application/json"}
11+
12+
response = requests.post(url, json=payload, headers=headers)
13+
print("Generation:", response.json())
14+
15+
16+
if __name__ == "__main__":
17+
main()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "Generate a video",
3+
"docs": "https://docs.aimlapi.com/api-references/video-models",
4+
"payload": {
5+
"baseUrl": "https://api.aimlapi.com/v2",
6+
"apiKey": "<YOUR_API_KEY>"
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const main = async () => {
2+
const response = await fetch('{{baseUrl}}/video/generations', {
3+
method: 'POST',
4+
headers: {
5+
Authorization: 'Bearer {{apiKey}}',
6+
'Content-Type': 'application/json',
7+
},
8+
body: JSON.stringify({
9+
model: '{{model}}',
10+
prompt: 'Hello world!',
11+
}),
12+
}).then((res) => res.json());
13+
14+
console.log('Generation:', response);
15+
};
16+
17+
main()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import requests
2+
3+
4+
def main():
5+
url = "{{baseUrl}}/video/generations"
6+
payload = {
7+
"model": "{{model}}",
8+
"prompt": "Hello world!",
9+
}
10+
headers = {"Authorization": "Bearer {{apiKey}}", "Content-Type": "application/json"}
11+
12+
response = requests.post(url, json=payload, headers=headers)
13+
print("Generation:", response.json())
14+
15+
16+
if __name__ == "__main__":
17+
main()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "Generate a video",
3+
"docs": "https://docs.aimlapi.com/api-references/video-models",
4+
"payload": {
5+
"baseUrl": "https://api.aimlapi.com/v2",
6+
"apiKey": "<YOUR_API_KEY>"
7+
}
8+
}

0 commit comments

Comments
 (0)