Skip to content

Commit 5e786f9

Browse files
authored
Merge pull request #103 from aimlapi/stelyatko/feat-add-bytedance-image-snippet
feat: add bytedance image to image snippet
2 parents a029623 + 846ec6b commit 5e786f9

4 files changed

Lines changed: 62 additions & 1 deletion

File tree

packages/openapi/descriptions/image.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ If transparent, the output format needs to support transparency, so it should be
9191
desc: `The compression level (0-100%) for the generated images.`,
9292
},
9393
image: {
94-
desc: `The image(s) to edit. Must be a supported image file or an array of images. Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images.`
94+
default: {
95+
desc: `The image(s) to edit. Must be a supported image file or an array of images. Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images.`
96+
},
97+
seededit: {
98+
desc: `The image to be edited. Enter the Base64 encoding of the picture or an accessible URL. Image URL: Make sure that the image URL is accessible.Base64-encoded content: The format must be data:image/<image format>;base64,<Base64-encoded content>. Note <image format> must be in lowercase, for example data:image/png;base64,<base64_image>.`
99+
},
95100
},
96101
mask: {
97102
desc: `An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.`
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/bytedance/seededit-3.0-image-to-image",
4+
"payload": {
5+
"baseUrl": "https://api.aimlapi.com/v1",
6+
"apiKey": "<YOUR_API_KEY>"
7+
}
8+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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: 'Make the bubbles heart-shaped',
14+
image: 'https://ark-doc.tos-ap-southeast-1.bytepluses.com/seededit_i2i.jpeg',
15+
size: 'adaptive',
16+
}),
17+
}).then((res) => res.json());
18+
19+
console.log('Generation:', response);
20+
};
21+
22+
main();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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": "A jellyfish in the ocean",
13+
"model": "{{model}}",
14+
"image": "https://ark-doc.tos-ap-southeast-1.bytepluses.com/seededit_i2i.jpeg",
15+
"size": "adaptive",
16+
},
17+
)
18+
19+
response.raise_for_status()
20+
data = response.json()
21+
22+
print("Generation:", data)
23+
24+
25+
if __name__ == "__main__":
26+
main()

0 commit comments

Comments
 (0)