Ana içeriğe geç
google avatarı

Nano Banana 2 Image Editing API

google/nano-banana-2/edit

Görselleri metin prompt’larıyla düzenleyin. Nesne ekleyip çıkarmak, tarzı değiştirmek ya da belirli öğeleri düzenlemek gibi hedefli değişiklikler yapın; görselin geri kalanı korunur.

düzenleme
Megapiksele göre fiyatlandırılır

Model girdisi

Input

  • https://media.modelrunner.ai/02EUGEXqn5lSoHvJwjPrY.png

The input image(s) for editing. The model supports providing multiple images in a single request.

The text prompt for image editing.

Enables Google Search grounding to provide more accurate and up-to-date information in the generated image.

The size of the generated image. Use a preset string (e.g. '4_3_1k') or a custom {width, height} object.

The harm category to apply the setting to.

The threshold for blocking content in the specified category.

The harm category to apply the setting to.

The threshold for blocking content in the specified category.

The harm category to apply the setting to.

The threshold for blocking content in the specified category.

The harm category to apply the setting to.

The threshold for blocking content in the specified category.

A list of unique safety settings for blocking unsafe content. Supported categories: HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT. Supported thresholds: HARM_BLOCK_THRESHOLD_UNSPECIFIED, BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH, BLOCK_NONE. This setting can only be configured via the API.

You need to be logged in to run this model and view results.
Log in

Model çıktısı

Output

Generated image output
Generated in 109.919 seconds
Logs (1 lines)

Örnek istekler

Örnekler

Example output 1Example output 2Example output 3

Model fiyatlandırması

Fiyatlandırma

Fiyat, çıktı görselinizin megapiksel sayısına göre değişir.

0.5 MP’ye kadar
$0.0450
görsel megapikseli başına
yani yaklaşık $1 ile 22 megapiksel
1.5 MP’ye kadar
$0.0670
görsel megapikseli başına
yani yaklaşık $1 ile 15 megapiksel
5 MP’ye kadar
$0.1010
görsel megapikseli başına
yani yaklaşık $1 ile 10 megapiksel
18 MP’ye kadar
$0.1510
görsel megapikseli başına
yani yaklaşık $1 ile 7 megapiksel

Nano Banana 2 Image Editing API

Nano Banana 2 Image Editing is a image-to-image AI model by google. On ModelRunner it runs through a REST API or via MCP from any AI assistant with pay-per-use pricing.

POST https://queue.modelrunner.run/google/nano-banana-2/edit

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/google/nano-banana-2/edit \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "images": [
      "https://media.modelrunner.ai/02EUGEXqn5lSoHvJwjPrY.png"
    ],
    "prompt": "Using the provided image of the map on the table, change the map to show a fantastical city with crystal spires and g…",
    "resolution": "512",
    "aspect_ratio": "1:1",
    "google_search": false,
    "safetySettings": [
      {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      }
    ],
    "safety_settings": [
      {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      }
    ],
    "google_search_grounding": false,
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/google/nano-banana-2/edit/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/google/nano-banana-2/edit/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("google/nano-banana-2/edit", {
  input: {
    "images": [
      "https://media.modelrunner.ai/02EUGEXqn5lSoHvJwjPrY.png"
    ],
    "prompt": "Using the provided image of the map on the table, change the map to show a fantastical city with crystal spires and g…",
    "resolution": "512",
    "aspect_ratio": "1:1",
    "google_search": false,
    "safetySettings": [
      {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      }
    ],
    "safety_settings": [
      {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      },
      {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_LOW_AND_ABOVE"
      }
    ],
    "google_search_grounding": false
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/google/nano-banana-2/edit",
    headers=headers,
    json={
      "images": [
        "https://media.modelrunner.ai/02EUGEXqn5lSoHvJwjPrY.png"
      ],
      "prompt": "Using the provided image of the map on the table, change the map to show a fantastical city with crystal spires and g…",
      "resolution": "512",
      "aspect_ratio": "1:1",
      "google_search": false,
      "safetySettings": [
        {
          "category": "HARM_CATEGORY_HARASSMENT",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        },
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        },
        {
          "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        },
        {
          "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        }
      ],
      "safety_settings": [
        {
          "category": "HARM_CATEGORY_HARASSMENT",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        },
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        },
        {
          "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        },
        {
          "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
          "threshold": "BLOCK_LOW_AND_ABOVE"
        }
      ],
      "google_search_grounding": false
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

Input parameters of Nano Banana 2 Image Editing
NameTypeRequiredDescription
imagesarrayyesThe input image(s) for editing. The model supports providing multiple images in a single request.
promptstringyesThe text prompt for image editing.
google_search_groundingbooleannoEnables Google Search grounding to provide more accurate and up-to-date information in the generated image. Default: false.
image_sizeenumnoThe size of the generated image. Use a preset string (e.g. '4_3_1k') or a custom {width, height} object. One of: 1_1_512, 1_1_1k, 1_1_2k, 1_1_4k, 16_9_512, 16_9_1k, 16_9_2k, 16_9_4k, 9_16_512, 9_16_1k, 9_16_2k, 9_16_4k, 4_3_512, 4_3_1k, 4_3_2k, 4_3_4k, 3_4_512, 3_4_1k, 3_4_2k, 3_4_4k, 3_2_512, 3_2_1k, 3_2_2k, 3_2_4k, 2_3_512, 2_3_1k, 2_3_2k, 2_3_4k, 4_5_512, 4_5_1k, 4_5_2k, 4_5_4k, 5_4_512, 5_4_1k, 5_4_2k, 5_4_4k, 4_1_512, 4_1_1k, 4_1_2k, 4_1_4k, 1_4_512, 1_4_1k, 1_4_2k, 1_4_4k, 8_1_512, 8_1_1k, 8_1_2k, 8_1_4k, 1_8_512, 1_8_1k, 1_8_2k, 1_8_4k, 21_9_512, 21_9_1k, 21_9_2k, 21_9_4k, auto. Default: "1_1_2k".
safety_settingsarraynoA list of unique safety settings for blocking unsafe content. Supported categories: HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT. Supported thresholds: HARM_BLOCK_THRESHOLD_UNSPECIFIED, BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH, BLOCK_NONE. This setting can only be configured via the API. Default: [{"category":"HARM_CATEGORY_HARASSMENT","threshold":"BLOCK_LOW_AND_ABOVE"},{"category":"HARM_CATEGORY_HATE_SPEECH","threshold":"BLOCK_LOW_AND_ABOVE"},{"category":"HARM_CATEGORY_SEXUALLY_EXPLICIT","threshold":"BLOCK_LOW_AND_ABOVE"},{"category":"HARM_CATEGORY_DANGEROUS_CONTENT","threshold":"BLOCK_LOW_AND_ABOVE"}].

Machine-readable: OpenAPI schema · llms.txt

Use Nano Banana 2 Image Editing from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Nano Banana 2 Image Editing becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint google/nano-banana-2/edit.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run google/nano-banana-2/edit on ModelRunner to generate image”. MCP setup guide.

Model Detayları

Model Detayları

Nano Banana 2/Edit, görselleri metin prompt’larıyla düzenlemek için tasarlanmış yüksek verimli bir modeldir. Basit eklemelerden bütünsel stil dönüşümlerine kadar, görsellerinizde bağlama duyarlı ve hedefli değişiklikler yapmakta üstündür. Bir ya da daha fazla görsel ve tarif edici bir prompt verin; özgün görselin ışığını, perspektifini ve genel bütünlüğünü korurken öğeleri değiştirin, yeni stiller uygulayın ya da birleşik sahneler kurun.

Bu model, aşağıdakiler de dahil olmak üzere pek çok yaratıcı ve ticari iş için idealdir: - **Inpainting ve maskeleme:** Görselin belirli bir bölümünü düzenlerken geri kalanına dokunmamak için bir "maske"yi sohbet eder gibi tanımlayın. Örneğin modele "yalnızca mavi koltuğu vintage, kahverengi deri bir chesterfield yap" deyin; odanın geri kalanını koruyacaktır. - **Öğe ekleme ve çıkarma:** Görsellerinize yeni nesneleri kusursuzca ekleyin ya da istemediklerinizi kaldırın. Model, özgün fotoğrafın stilini, ışığını ve perspektifini akıllıca eşleştirir; böylece düzenlemeler doğal görünür. - **Stil aktarımı:** Bir fotoğrafı farklı bir sanatsal tarza dönüştürün. Bir referans görsel verin ve modele, onu ünlü bir sanatçının ya da belirli bir sanat akımının tarzında yeniden üretmesini söyleyin.

### Örnek Kullanım ```javascript import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("google/nano-banana-2/edit", { input: { images: ["https://ai.google.dev/static/gemini-api/docs/images/cat_photo.png"], prompt: "Using the provided image of my cat, please add a small, knitted wizard hat on its head. Make it look like it's sitting comfortably and matches the soft lighting of the photo.", aspect_ratio: "1:1", resolution: "2K" }, }); ```

## Güvenlik ve İçerik Denetimi

`safety_settings` parametresi, içerik denetimi filtrelerini kendi kullanım senaryonuza göre ayarlamanızı sağlar. Bu ayar yalnızca API üzerinden yapılandırılabilir. Dört zarar kategorisi için bir engelleme eşiği belirleyebilirsiniz: taciz, nefret söylemi, cinsel içerik ve tehlikeli içerik.

Her güvenlik ayarı bir `category` ve bir `threshold` değerinden oluşur.

- **`threshold`**: İlgili kategoride içeriğin engelleneceği güven düzeyi. - `BLOCK_NONE`: Güvensiz olma olasılığı ne olursa olsun içeriği her zaman gösterir. - `BLOCK_ONLY_HIGH`: Güvensiz olma olasılığı yüksek olduğunda içeriği engeller. - `BLOCK_MEDIUM_AND_ABOVE`: Güvensiz olma olasılığı orta ya da yüksek olduğunda içeriği engeller. - `BLOCK_LOW_AND_ABOVE`: Güvensiz olma olasılığı düşük, orta ya da yüksek olduğunda içeriği engeller.

```javascript import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("google/nano-banana-2/edit", { input: { images: ["https://ai.google.dev/static/gemini-api/docs/images/cat_photo.png"], prompt: "A cat wearing a wizard hat.", safety_settings: [ { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_ONLY_HIGH" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE" } ] }, }); ```