Nbility logoNbility Docs

Search documentation

Search guides and API reference content

Gemini models with image output can generate or edit images through the native generateContent path. “Nano Banana” is a product label; requests must use the actual model ID returned by the console or models API.

Endpoint

POST https://api.nbility.ai/v1beta/models/YOUR_IMAGE_MODEL:generateContent

Text to image

curl "https://api.nbility.ai/v1beta/models/YOUR_IMAGE_MODEL:generateContent" \
  -H "x-goog-api-key: $NBILITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{"text": "Create a cinematic poster of Shanghai in the rain, with no text."}]
    }],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"]
    }
  }'

Image output normally appears in a part with inlineData under candidates[].content.parts[]. inlineData.data contains base64 data and mimeType identifies the image format. Iterate over all parts instead of assuming that the image is first.

Image editing

Put the instruction and source image in the same parts array:

{
  "contents": [{
    "role": "user",
    "parts": [
      {"text": "Keep the composition and change the sky to sunset."},
      {
        "inlineData": {
          "mimeType": "image/png",
          "data": "BASE64_IMAGE_DATA"
        }
      }
    ]
  }],
  "generationConfig": {
    "responseModalities": ["TEXT", "IMAGE"]
  }
}

Input formats, sizes, aspect ratios, and editing capabilities vary by model. Select an image-capable model from the live catalog and validate with a small image first. Do not blindly replace the Google hostname while depending on provider-specific fields that the selected channel has not been tested to support.

For the OpenAI Images request format, see Images API.