Ana içeriğe geç
google avatarı

Nano Banana 2 Text to Image API

google/nano-banana-2

Nano Banana 2, hızlı ve çok yönlü bir text-to-image modelidir. Fotogerçekçi sahnelerden doğru metinli karmaşık infografiklere kadar yüksek kaliteli görseller üretmekte üstündür; isteğe bağlı olarak Google Search ile gerçek zamanlı bilgiye dayanan içerik de üretebilir.

Megapiksele göre fiyatlandırılır

Model girdisi

Input

The text prompt for image generation.

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

Use Google Search to generate images based on recent or real-time information. Send an empty object to enable.

The category for this safety setting.

The probability threshold at which content is blocked.

The category for this safety setting.

The probability threshold at which content is blocked.

The category for this safety setting.

The probability threshold at which content is blocked.

The category for this safety setting.

The probability threshold at which content is blocked.

A list of unique safety settings for blocking unsafe content. 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 111.406 seconds
Logs (1 lines)

Örnek istekler

Örnekler

Example output 1Example output 2Example output 3Example output 4Example output 5Example output 6Example output 7Example output 8

Model fiyatlandırması

Fiyatlandırma

Fiyat, çıktı görselinizin çözünürlüğüne göre değişir.

512
$0.0450
görsel başına
1K
$0.0670
görsel başına
2K
$0.1010
görsel başına
4K
$0.1510
görsel başına

Nano Banana 2 Text to Image API

Nano Banana 2 Text to Image is a text-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

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 \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A photorealistic wide-angle view of the current weather conditions at the summit of Mount Everest, showing extreme wi…",
    "image_size": "21_9_2k",
    "google_search": true,
    "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"
      }
    ],
    "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/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/google/nano-banana-2/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

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

const result = await modelrunner.subscribe("google/nano-banana-2", {
  input: {
    "prompt": "A photorealistic wide-angle view of the current weather conditions at the summit of Mount Everest, showing extreme wi…",
    "image_size": "21_9_2k",
    "google_search": true,
    "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"
      }
    ]
  },
});
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",
    headers=headers,
    json={
      "prompt": "A photorealistic wide-angle view of the current weather conditions at the summit of Mount Everest, showing extreme wi…",
      "image_size": "21_9_2k",
      "google_search": true,
      "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"
        }
      ]
    },
).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 Text to Image
NameTypeRequiredDescription
promptstringyesThe text prompt for image generation.
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_1k".
google_searchbooleannoUse Google Search to generate images based on recent or real-time information. Send an empty object to enable. Default: false.
safety_settingsarraynoA list of unique safety settings for blocking unsafe content. 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 Text to Image from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Nano Banana 2 Text to Image 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.

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 on ModelRunner to generate image”. MCP setup guide.

Model Detayları

Model Detayları

Nano Banana 2; hız, kalite ve maliyet arasında denge kurmak üzere optimize edilmiş, son derece verimli ve çok yönlü bir text-to-image modelidir. Pazarlama materyalleri üretmekten basit metin prompt’larıyla fotogerçekçi sahneler ve sanatsal illüstrasyonlar oluşturmaya kadar çok çeşitli yaratıcı ve ticari kullanımlar için mükemmel bir seçimdir.

Modelin derin dil anlayışı, ayrıntılı ve anlatı biçimindeki açıklamaları yorumlayıp tutarlı, yüksek kaliteli görseller üretmesini sağlar. Öne çıkan yetenekleri şunlardır:

- **Fotogerçekçilik ve sanatsal çok yönlülük:** Çarpıcı, gerçekçi ürün mockup’ları ve profesyonel görünümlü fotoğraflar oluşturun; kamera açılarını, ışığı ve kompozisyonu tarif ederek geniş bir sanatsal stil yelpazesini keşfedin. - **Doğru metin basma:** Görselin içinde doğrudan okunaklı ve stilize metin gerektiren logolar, infografikler ve başka tasarımlar üretin. - **Google Search ile gerçek zamanlı üretim:** `google_search` seçeneğini etkinleştirdiğinizde model gerçek zamanlı bilgiye erişerek güncel ve konuyla ilgili görseller üretebilir — örneğin mevcut hava koşullarını gösteren bir grafik ya da yakın zamanda gerçekleşen bir spor etkinliğine ait bir görsel.

En iyi sonuç için yalnızca anahtar kelimeleri sıralamak yerine tarif edici, anlatı biçiminde prompt’lar yazın. Görselin bağlamını ve amacını açıklayın; çıktıyı iyileştirmek için takip prompt’larıyla yineleme yapmaktan çekinmeyin.

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

const result = await modelrunner.subscribe("google/nano-banana-2", { input: { prompt: "Create a modern, minimalist logo for a coffee shop called 'The Daily Grind' in a clean, bold, sans-serif font. The color scheme is black and white.", aspect_ratio: "1:1", resolution: "2K", google_search: false }, }); ```

## Güvenlik ve İçerik Denetimi `safety_settings` parametresi, isteklerinizin içerik denetimi filtrelerini ayarlamanızı sağlar. Potansiyel olarak zararlı içeriğin dört farklı kategorisi için bir engelleme eşiği yapılandırabilirsiniz. Bu, belirli kullanım senaryolarında daha ince bir kontrol sağlar — örneğin bir video oyunu için diyalog ya da sahne üretirken daha "tehlikeli" içeriğe izin vermek gibi. Bu ayar yalnızca API üzerinden yapılandırılabilir.

Kullanılabilir `category` seçenekleri şunlardır: - `HARM_CATEGORY_HARASSMENT` - `HARM_CATEGORY_HATE_SPEECH` - `HARM_CATEGORY_SEXUALLY_EXPLICIT` - `HARM_CATEGORY_DANGEROUS_CONTENT`

`threshold`, içeriğin hangi olasılık düzeyinde engelleneceğini belirler: - `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 olan içeriği engeller. - `BLOCK_MEDIUM_AND_ABOVE`: Güvensiz olma olasılığı orta ya da yüksek olan içeriği engeller. - `BLOCK_LOW_AND_ABOVE`: Güvensiz olma olasılığı düşük, orta ya da yüksek olan içeriği engeller. - `OFF`: Güvenlik filtresini kapatır.

```javascript const result = await modelrunner.subscribe("google/nano-banana-2", { input: { prompt: "A gritty, noir art style comic panel of a detective in the rain.", safety_settings: [ { category: "HARM_CATEGORY_DANGEROUS_CONTENT", threshold: "BLOCK_MEDIUM_AND_ABOVE" }, { category: "HARM_CATEGORY_HATE_SPEECH", threshold: "BLOCK_LOW_AND_ABOVE" } ] }, }); ```