Skip to content

Commit 4bb24b4

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-558: docs: add 6 flux 2 models
1 parent 8cb5c45 commit 4bb24b4

16 files changed

Lines changed: 773 additions & 2 deletions
1.08 MB
Loading
1.23 MB
Loading
1.01 MB
Loading
1.29 MB
Loading
1.07 MB
Loading
1.44 MB
Loading
1.12 MB
Loading

docs/SUMMARY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@
163163
* [flux/kontext-pro/image-to-image](api-references/image-models/flux/flux-kontext-pro-image-to-image.md)
164164
* [flux/srpo/text-to-image](api-references/image-models/flux/flux-srpo-text-to-image.md)
165165
* [flux/srpo/image-to-image](api-references/image-models/flux/flux-srpo-image-to-image.md)
166+
* [flux-2](api-references/image-models/flux/flux-2.md)
167+
* [flux-2-edit](api-references/image-models/flux/flux-2-edit.md)
168+
* [flux-2-lora](api-references/image-models/flux/flux-2-lora.md)
169+
* [flux-2-lora-edit](api-references/image-models/flux/flux-2-lora-edit.md)
170+
* [flux-2-pro](api-references/image-models/flux/flux-2-pro.md)
171+
* [flux-2-pro-edit](api-references/image-models/flux/flux-2-pro-edit.md)
166172
* [Google](api-references/image-models/google/README.md)
167173
* [Imagen 3](api-references/image-models/google/imagen-3.0.md)
168174
* [Imagen 4 Preview](api-references/image-models/google/imagen-4-preview.md)

docs/api-references/image-models/README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# flux-2-edit
2+
3+
{% columns %}
4+
{% column width="66.66666666666666%" %}
5+
{% hint style="info" %}
6+
This documentation is valid for the following list of our models:
7+
8+
* `blackforestlabs/flux-2-edit`
9+
{% endhint %}
10+
{% endcolumn %}
11+
12+
{% column width="33.33333333333334%" %}
13+
<a href="https://aimlapi.com/app/?model=blackforestlabs/flux-2-edit&#x26;mode=image" class="button primary">Try in Playground</a>
14+
{% endcolumn %}
15+
{% endcolumns %}
16+
17+
## Model Overview
18+
19+
A 4MP photorealistic, production-grade editor with advanced multi-reference control capabilities.
20+
21+
## Setup your API Key
22+
23+
If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).
24+
25+
## API Schema
26+
27+
{% openapi-operation spec="flux-2-edit" path="/v1/images/generations" method="post" %}
28+
[OpenAPI flux-2-edit](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/flux/flux-2-edit.json)
29+
{% endopenapi-operation %}
30+
31+
## Quick Example
32+
33+
Let's generate a new image using the one from the [flux/dev Quick Example](flux-dev.md#quick-example) as a reference — and make a simple change to it with a prompt.
34+
35+
{% tabs %}
36+
{% tab title="Python" %}
37+
{% code overflow="wrap" %}
38+
```python
39+
import requests
40+
import json # for getting a structured output with indentation
41+
42+
def main():
43+
response = requests.post(
44+
"https://api.aimlapi.com/v1/images/generations",
45+
headers={
46+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
47+
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
48+
"Content-Type": "application/json",
49+
},
50+
json={
51+
"model": "blackforestlabs/flux-2-edit",
52+
"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.",
53+
"image_urls": [
54+
"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png",
55+
"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg"
56+
],
57+
"guidance_scale": 19
58+
}
59+
)
60+
61+
data = response.json()
62+
print(json.dumps(data, indent=2, ensure_ascii=False))
63+
64+
if __name__ == "__main__":
65+
main()
66+
```
67+
{% endcode %}
68+
{% endtab %}
69+
70+
{% tab title="JS" %}
71+
{% code overflow="wrap" %}
72+
```javascript
73+
async function main() {
74+
const response = await fetch('https://api.aimlapi.com/v1/images/generations', {
75+
method: 'POST',
76+
headers: {
77+
// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
78+
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
79+
'Content-Type': 'application/json',
80+
},
81+
body: JSON.stringify({
82+
model: 'blackforestlabs/flux-2-edit',
83+
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.',
84+
image_urls: [
85+
"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png",
86+
"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg"
87+
],
88+
guidance_scale: 19
89+
}),
90+
});
91+
92+
const data = await response.json();
93+
console.log(data);
94+
}
95+
96+
main();
97+
```
98+
{% endcode %}
99+
{% endtab %}
100+
{% endtabs %}
101+
102+
<details>
103+
104+
<summary>Response</summary>
105+
106+
{% code overflow="wrap" %}
107+
```json5
108+
{
109+
"data": [
110+
{
111+
"url": "https://cdn.aimlapi.com/flamingo/files/b/0a847ab7/KtavVJcI8jz5cN49wXF0e.png"
112+
}
113+
],
114+
"meta": {
115+
"usage": {
116+
"tokens_used": 75601
117+
}
118+
}
119+
}
120+
```
121+
{% endcode %}
122+
123+
</details>
124+
125+
<table data-full-width="true"><thead><tr><th width="442.0667724609375" valign="top">Reference Images</th><th valign="top">Generated Image</th></tr></thead><tbody><tr><td valign="top"><div><figure><img src="../../../.gitbook/assets/t-rex (1) (1).png" alt=""><figcaption><p>Image #1</p></figcaption></figure></div></td><td valign="top"><div><figure><img src="../../../.gitbook/assets/KtavVJcI8jz5cN49wXF0e.png" alt=""><figcaption><p><kbd><code>"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."</code></kbd></p></figcaption></figure></div></td></tr><tr><td valign="top"><div><figure><img src="../../../.gitbook/assets/blue-mug (1).jpg" alt=""><figcaption><p>Image #2</p></figcaption></figure></div></td><td valign="top"></td></tr></tbody></table>

0 commit comments

Comments
 (0)