File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ const main = async () => {
66 'Content-Type': 'application/json',
77 },
88 body: JSON.stringify({
9- prompt: 'A jellyfish in the ocean',
109 model: '{{ model }} ',
10+ prompt: 'A jellyfish in the ocean',
1111 }),
1212 }).then((res) => res.json());
1313
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ def main():
99 "Content-Type": "application/json",
1010 },
1111 json={
12- "prompt": "A jellyfish in the ocean",
1312 "model": "{{ model }} ",
13+ "prompt": "A jellyfish in the ocean",
1414 },
1515 )
1616
Original file line number Diff line number Diff line change 1+ {
2+ "title" : " Generate an 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+ }
Original file line number Diff line number Diff line change 1+ const fs = require('fs');
2+ const path = require('path');
3+
4+ const main = async () => {
5+ const response = await fetch('{{ baseUrl }} /images/generations', {
6+ method: 'POST',
7+ headers: {
8+ Authorization: 'Bearer {{ apiKey }} ',
9+ 'Content-Type': 'application/json',
10+ },
11+ body: JSON.stringify({
12+ model: '{{ model }} ',
13+ prompt: 'Mona Lisa with glasses',
14+ image_urls: [
15+ 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/960px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg',
16+ 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Glasses_black.jpg/960px-Glasses_black.jpg',
17+ ]
18+ }),
19+ }).then((res) => res.json());
20+
21+ console.log('Generation:', response);
22+ };
23+
24+ main();
Original file line number Diff line number Diff line change 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+ "prompt": "Mona Lisa with glasses",
13+ "model": "{{ model }} ",
14+ "image_urls": [
15+ "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/960px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg",
16+ "https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Glasses_black.jpg/960px-Glasses_black.jpg",
17+ ]
18+ },
19+ )
20+
21+ response.raise_for_status()
22+ data = response.json()
23+
24+ print("Generation:", data)
25+
26+
27+ if __name__ == "__main__":
28+ main()
You can’t perform that action at this time.
0 commit comments