Skip to content

Commit dac4e3d

Browse files
authored
feat: add snippets for flux edit
feat: add snippets for flux edit
2 parents 9f08d8c + 48e43fd commit dac4e3d

3 files changed

Lines changed: 57 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 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+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
prompt: 'Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.',
11+
image_urls: [
12+
'https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png',
13+
'https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg',
14+
],
15+
}),
16+
}).then((res) => res.json());
17+
18+
console.log('Generation:', response);
19+
};
20+
21+
main();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
"prompt": "Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.",
14+
"image_urls": [
15+
"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png",
16+
"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.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()

0 commit comments

Comments
 (0)