Bridge by Wekoya / Docs / Media

Generating images

Updated

Create and edit images with Google's Gemini image models (Nano Banana), on OpenAI's /v1/images/generations and /v1/images/edits. Images come back as base64; Bridge keeps no copy, so there are no URLs. Up to four images a request, and up to ten to work from when editing. Masks are not supported: describe the change instead.

import base64

result = client.images.generate(
    model="gemini-3.1-flash-image",
    prompt="A yellow bridge over a calm river at sunrise, flat illustration",
    n=2,
    size="1792x1024",   # or extra_body={"aspect_ratio": "16:9", "image_size": "2K"}
)
open("bridge.jpg", "wb").write(base64.b64decode(result.data[0].b64_json))

# Edit: one or more images to work from, and what to change.
edit = client.images.edit(
    model="gemini-3.1-flash-image",
    image=[open("shop.png", "rb")],
    prompt="Make it night time, with the shop sign lit",
)
ModelAbout, per imageNotes
gemini-3.1-flash-image₦100The default. Good quality, about 12 seconds.
gemini-3.1-flash-lite-image₦50Cheapest; drafts and volume.
gemini-nano-banana-2.1₦50Strong at editing and keeping a subject consistent.
gemini-2.5-flash-image₦58One resolution (about 1K).
gemini-3-pro-image₦200 at 2K, ₦360 at 4KBest text in images and detail. 25 to 35 seconds.

Billed per token: image tokens at the model's image rate. aspect_ratio takes 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 or 21:9, and image_size 1K, 2K or 4K. A prompt the model will not draw is refused with content_policy, and costs nothing unless the model had already worked on it.