Skip to content

Commit 8d2006a

Browse files
feat: gen fluxes 2
1 parent ddbaa28 commit 8d2006a

7 files changed

Lines changed: 1436 additions & 7 deletions

File tree

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "AIML API",
5+
"version": "1.0.0"
6+
},
7+
"servers": [
8+
{
9+
"url": "https://api.aimlapi.com"
10+
}
11+
],
12+
"paths": {
13+
"/v1/images/generations": {
14+
"post": {
15+
"operationId": "_v1_images_generations",
16+
"requestBody": {
17+
"required": true,
18+
"content": {
19+
"application/json": {
20+
"schema": {
21+
"type": "object",
22+
"properties": {
23+
"model": {
24+
"type": "string",
25+
"enum": [
26+
"blackforestlabs/flux-2-edit"
27+
]
28+
},
29+
"prompt": {
30+
"type": "string",
31+
"maxLength": 4000,
32+
"description": "The text prompt describing the content, style, or composition of the image to be generated."
33+
},
34+
"image_urls": {
35+
"type": "array",
36+
"items": {
37+
"type": "string",
38+
"format": "uri"
39+
},
40+
"minItems": 1,
41+
"maxItems": 3,
42+
"description": "List of URLs or local Base64 encoded images to edit."
43+
},
44+
"image_size": {
45+
"anyOf": [
46+
{
47+
"type": "object",
48+
"properties": {
49+
"width": {
50+
"type": "integer",
51+
"minimum": 512,
52+
"maximum": 2048,
53+
"default": 1024
54+
},
55+
"height": {
56+
"type": "integer",
57+
"minimum": 512,
58+
"maximum": 2048,
59+
"default": 768
60+
}
61+
},
62+
"description": "For both height and width, the value must be a multiple of 32."
63+
},
64+
{
65+
"type": "string",
66+
"enum": [
67+
"square_hd",
68+
"square",
69+
"portrait_4_3",
70+
"portrait_16_9",
71+
"landscape_4_3",
72+
"landscape_16_9"
73+
],
74+
"description": "The size of the generated image."
75+
}
76+
],
77+
"default": "landscape_4_3"
78+
},
79+
"output_format": {
80+
"type": "string",
81+
"enum": [
82+
"jpeg",
83+
"png",
84+
"webp"
85+
],
86+
"default": "png",
87+
"description": "The format of the generated image."
88+
},
89+
"enable_prompt_expansion": {
90+
"type": "boolean",
91+
"default": true,
92+
"description": "If set to True, prompt will be upsampled with more details."
93+
},
94+
"guidance_scale": {
95+
"type": "number",
96+
"minimum": 0,
97+
"maximum": 20,
98+
"description": "The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you."
99+
},
100+
"num_inference_steps": {
101+
"type": "integer",
102+
"minimum": 4,
103+
"maximum": 50,
104+
"description": "The number of inference steps to perform."
105+
},
106+
"acceleration": {
107+
"type": "string",
108+
"enum": [
109+
"none",
110+
"regular",
111+
"high"
112+
],
113+
"default": "regular",
114+
"description": "The speed of the generation. The higher the speed, the faster the generation."
115+
},
116+
"seed": {
117+
"type": "integer",
118+
"minimum": 1,
119+
"description": "The same seed and the same prompt given to the same version of the model will output the same image every time."
120+
},
121+
"num_images": {
122+
"type": "number",
123+
"minimum": 1,
124+
"maximum": 4,
125+
"default": 1,
126+
"description": "The number of images to generate."
127+
},
128+
"enable_safety_checker": {
129+
"type": "boolean",
130+
"default": true,
131+
"description": "If set to True, the safety checker will be enabled."
132+
}
133+
},
134+
"required": [
135+
"model",
136+
"prompt",
137+
"image_urls"
138+
],
139+
"title": "blackforestlabs/flux-2-edit"
140+
}
141+
}
142+
}
143+
},
144+
"responses": {
145+
"200": {
146+
"content": {
147+
"application/json": {
148+
"schema": {
149+
"type": "object",
150+
"properties": {
151+
"data": {
152+
"type": "array",
153+
"nullable": true,
154+
"items": {
155+
"type": "object",
156+
"properties": {
157+
"url": {
158+
"type": "string",
159+
"nullable": true,
160+
"description": "The URL where the file can be downloaded from.",
161+
"example": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png"
162+
},
163+
"b64_json": {
164+
"type": "string",
165+
"nullable": true,
166+
"description": "The base64-encoded JSON of the generated image.",
167+
"example": null
168+
}
169+
}
170+
},
171+
"description": "The list of generated images."
172+
},
173+
"meta": {
174+
"type": "object",
175+
"nullable": true,
176+
"properties": {
177+
"usage": {
178+
"type": "object",
179+
"nullable": true,
180+
"properties": {
181+
"tokens_used": {
182+
"type": "number",
183+
"description": "The number of tokens consumed during generation.",
184+
"example": 120000
185+
}
186+
},
187+
"required": [
188+
"tokens_used"
189+
]
190+
}
191+
},
192+
"description": "Additional details about the generation."
193+
}
194+
}
195+
}
196+
}
197+
}
198+
}
199+
},
200+
"x-hideTryItPanel": true,
201+
"x-codeSamples": [
202+
{
203+
"lang": "JavaScript",
204+
"source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n \"model\": \"blackforestlabs/flux-2-edit\",\n \"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.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();"
205+
},
206+
{
207+
"lang": "Python",
208+
"source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Authorization\": \"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\": \"blackforestlabs/flux-2-edit\",\n \"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.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }\n)\n\ndata = response.json()\nprint(data)"
209+
},
210+
{
211+
"lang": "cURL",
212+
"source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"blackforestlabs/flux-2-edit\",\n \"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.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }'"
213+
},
214+
{
215+
"lang": "HTTP",
216+
"source": "POST / HTTP/1.1\nHost: test.com\nAuthorization: Bearer <YOUR_AIMLAPI_KEY>\nContent-Type: application/json\nAccept: */*\n\n{\n \"model\": \"blackforestlabs/flux-2-edit\",\n \"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.\",\n \"image_urls\": [\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n \"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n}"
217+
}
218+
]
219+
}
220+
}
221+
},
222+
"components": {
223+
"securitySchemes": {
224+
"access-token": {
225+
"scheme": "bearer",
226+
"bearerFormat": "<YOUR_AIMLAPI_KEY>",
227+
"type": "http",
228+
"description": "Bearer key"
229+
}
230+
}
231+
}
232+
}

0 commit comments

Comments
 (0)