Skip to content

Commit 87ef44b

Browse files
docs: add google/nano-banana-edit (#482)
1 parent bbb400d commit 87ef44b

3 files changed

Lines changed: 192 additions & 26 deletions

File tree

docs/api-references/image-models/Google/gemini-2.5-flash-image-edit.json

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"model": {
2424
"type": "string",
2525
"enum": [
26-
"google/gemini-2.5-flash-image-edit"
26+
"google/nano-banana-edit"
2727
]
2828
},
2929
"prompt": {
@@ -36,31 +36,65 @@
3636
"type": "string",
3737
"format": "uri"
3838
},
39+
"maxItems": 3,
3940
"description": "List of URLs or local Base64 encoded images to edit."
4041
},
42+
"aspect_ratio": {
43+
"type": "string",
44+
"enum": [
45+
"1:1",
46+
"9:16",
47+
"16:9",
48+
"3:4",
49+
"4:3"
50+
],
51+
"description": "The aspect ratio of the generated image. It is taken from this parameter or from the provided reference image. If the parameter is not set and no reference image is provided, the default value is 16:9."
52+
},
53+
"enhance_prompt": {
54+
"type": "boolean",
55+
"default": true,
56+
"description": "Optional parameter to use an LLM-based prompt rewriting feature for higher-quality images that better match the original prompt. Disabling it may affect image quality and prompt alignment."
57+
},
4158
"num_images": {
42-
"type": "number",
43-
"minimum": 1,
59+
"type": "integer",
4460
"maximum": 4,
4561
"default": 1,
4662
"description": "The number of images to generate."
4763
},
48-
"aspect_ratio": {
64+
"seed": {
65+
"type": "integer",
66+
"minimum": 0,
67+
"maximum": 4294967295,
68+
"description": "The same seed and the same prompt given to the same version of the model will output the same image every time."
69+
},
70+
"person_generation": {
4971
"type": "string",
5072
"enum": [
51-
"21:9",
52-
"1:1",
53-
"4:3",
54-
"3:2",
55-
"2:3",
56-
"5:4",
57-
"4:5",
58-
"3:4",
59-
"16:9",
60-
"9:16"
73+
"dont_allow",
74+
"allow_adult"
6175
],
62-
"default": "1:1",
63-
"description": "The aspect ratio of the generated image."
76+
"default": "allow_adult",
77+
"description": "Allow generation of people."
78+
},
79+
"safety_setting": {
80+
"type": "string",
81+
"enum": [
82+
"block_low_and_above",
83+
"block_medium_and_above",
84+
"block_only_high"
85+
],
86+
"default": "block_medium_and_above",
87+
"description": "Adds a filter level to safety filtering."
88+
},
89+
"add_watermark": {
90+
"type": "boolean",
91+
"default": false,
92+
"description": "Add an invisible watermark to the generated images."
93+
},
94+
"convert_base64_to_url": {
95+
"type": "boolean",
96+
"default": true,
97+
"description": "If True, the URL to the image will be returned; otherwise, the file will be provided in base64 format."
6498
},
6599
"provider": {
66100
"type": "string",
@@ -70,10 +104,9 @@
70104
},
71105
"required": [
72106
"model",
73-
"prompt",
74-
"image_urls"
107+
"prompt"
75108
],
76-
"title": "google/gemini-2.5-flash-image-edit"
109+
"title": "google/nano-banana-edit"
77110
}
78111
}
79112
}
@@ -119,10 +152,16 @@
119152
"type": "number",
120153
"description": "The number of tokens consumed during generation.",
121154
"example": 120000
155+
},
156+
"usd_spent": {
157+
"type": "number",
158+
"description": "The total amount of money spent by the user in USD.",
159+
"example": 0.06
122160
}
123161
},
124162
"required": [
125-
"credits_used"
163+
"credits_used",
164+
"usd_spent"
126165
]
127166
}
128167
},
@@ -131,22 +170,23 @@
131170
}
132171
}
133172
}
134-
}
173+
},
174+
"description": "Successful response."
135175
}
136176
},
137177
"x-hideTryItPanel": true,
138178
"x-codeSamples": [
139179
{
140180
"lang": "cURL",
141-
"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\": \"google/gemini-2.5-flash-image-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 }'"
181+
"source": "curl --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 '{\"model\": \"google/nano-banana-edit\", \"prompt\": \"Describe what you want the model to generate.\"}'"
142182
},
143183
{
144184
"lang": "JavaScript",
145-
"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\": \"google/gemini-2.5-flash-image-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();"
185+
"source": "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\": \"google/nano-banana-edit\",\n \"prompt\": \"Describe what you want the model to generate.\"\n}),\n});\n\nconsole.log(await response.json());"
146186
},
147187
{
148188
"lang": "Python",
149-
"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\": \"google/gemini-2.5-flash-image-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)"
189+
"source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Authorization\": \"Bearer <YOUR_AIMLAPI_KEY>\",\n \"Content-Type\": \"application/json\",\n },\n json={'model': 'google/nano-banana-edit', 'prompt': 'Describe what you want the model to generate.'},\n)\n\nprint(response.json())"
150190
}
151191
]
152192
}
@@ -162,4 +202,4 @@
162202
}
163203
}
164204
}
165-
}
205+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Nano Banana 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+
* `google/nano-banana-edit`
9+
{% endhint %}
10+
{% endcolumn %}
11+
12+
{% column width="33.33333333333334%" %}
13+
<a href="https://aimlapi.com/app/google/nano-banana-edit" class="button primary">Try in Playground</a>
14+
{% endcolumn %}
15+
{% endcolumns %}
16+
17+
## Model Overview
18+
19+
Nano Banana Edit is available through the AI/ML API.
20+
21+
{% hint style="success" %}
22+
[Create AI/ML API Key](https://aimlapi.com/app/keys)
23+
{% endhint %}
24+
25+
<details>
26+
27+
<summary>How to make the first API call</summary>
28+
29+
**1️⃣ Required setup (don’t skip this)**\
30+
**Create an account:** Sign up on the AI/ML API website (if you don’t have one yet).\
31+
**Generate an API key:** In your account dashboard, create an API key and make sure it’s **enabled** in the UI.
32+
33+
**2️ Copy the code example**\
34+
At the bottom of this page, pick the snippet for your preferred programming language (Python / Node.js) and copy it into your project.
35+
36+
**3️ Update the snippet for your use case**\
37+
**Insert your API key:** replace `<YOUR_AIMLAPI_KEY>` with your real AI/ML API key.\
38+
**Select a model:** set the `model` field to the model you want to call.\
39+
**Provide input:** fill in the request input field(s) shown in the example.
40+
41+
**4️ (Optional) Tune the request**\
42+
See the API schema below for optional generation settings.
43+
44+
**5️ Run your code**\
45+
Run the updated code in your development environment.
46+
47+
{% hint style="success" %}
48+
For a detailed walkthrough, use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).
49+
{% endhint %}
50+
51+
</details>
52+
53+
## API Schema
54+
55+
{% openapi-operation spec="gemini-2-5-flash-image-edit" path="/v1/images/generations" method="post" %}
56+
[OpenAPI gemini-2-5-flash-image-edit](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/Google/gemini-2.5-flash-image-edit.json)
57+
{% endopenapi-operation %}
58+
59+
## Code Example
60+
61+
{% tabs %}
62+
{% tab title="Python" %}
63+
{% code overflow="wrap" %}
64+
```python
65+
import requests
66+
67+
response = requests.post(
68+
"https://api.aimlapi.com/v1/images/generations",
69+
headers={
70+
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
71+
"Content-Type": "application/json",
72+
},
73+
json={'model': 'google/nano-banana-edit', 'prompt': 'Describe what you want the model to generate.'},
74+
)
75+
76+
print(response.json())
77+
```
78+
{% endcode %}
79+
{% endtab %}
80+
81+
{% tab title="JavaScript" %}
82+
{% code overflow="wrap" %}
83+
```javascript
84+
const response = await fetch('https://api.aimlapi.com/v1/images/generations', {
85+
method: 'POST',
86+
headers: {
87+
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
88+
'Content-Type': 'application/json',
89+
},
90+
body: JSON.stringify({
91+
"model": "google/nano-banana-edit",
92+
"prompt": "Describe what you want the model to generate."
93+
}),
94+
});
95+
96+
console.log(await response.json());
97+
```
98+
{% endcode %}
99+
{% endtab %}
100+
{% endtabs %}
101+
102+
<details>
103+
104+
<summary>Response</summary>
105+
106+
{% code overflow="wrap" %}
107+
```json
108+
{
109+
"data": [
110+
{
111+
"url": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png",
112+
"b64_json": null
113+
}
114+
],
115+
"meta": {
116+
"usage": {
117+
"credits_used": 120000,
118+
"usd_spent": 0.06
119+
}
120+
},
121+
"model": "google/nano-banana-edit"
122+
}
123+
```
124+
{% endcode %}
125+
126+
</details>

0 commit comments

Comments
 (0)