Bridge by Wekoya / Docs / Media
Generating images
Updated
Create and edit images with Google's Gemini image models (Nano Banana) and OpenAI's GPT Image, 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 (five on gpt-image-1.5). GPT Image takes a mask: a PNG whose fully transparent pixels mark where the picture may change. With Gemini, 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",
)
# GPT Image: choose the quality; a mask limits the change to its transparent pixels.
poster = client.images.edit(
model="gpt-image-2.5-sunburst",
image=[open("shop.png", "rb")],
mask=open("sign-mask.png", "rb"),
prompt="Replace the sign with one that reads MAMA T'S KITCHEN",
quality="high",
)| Model | About, per image | Notes |
|---|---|---|
gemini-3.1-flash-image | ₦100 | The default. Good quality, about 12 seconds. |
gemini-3.1-flash-lite-image | ₦50 | Cheapest; drafts and volume. |
gemini-nano-banana-2.1 | ₦50 | Strong at editing and keeping a subject consistent. |
gemini-2.5-flash-image | ₦58 | One resolution (about 1K). |
gemini-3-pro-image | ₦200 at 2K, ₦360 at 4K | Best text in images and detail. 25 to 35 seconds. |
gpt-image-2.5-flare | ₦178 (high, 1K); ₦32 low to ₦671 max | OpenAI. Fast, for everyday and high-volume pictures. 2K ₦347, 4K ₦568. |
gpt-image-2.5-sunburst | ₦178 (high, 1K); ₦32 low to ₦671 max | OpenAI. The most detailed, and the most precise at editing. 2K ₦347, 4K ₦568. |
gpt-image-2 | ₦173 (medium, 1K); ₦27 low, ₦666 high | OpenAI. Sharp text in pictures. 2K ₦343, 4K ₦564. |
gpt-image-1.5 | ₦157 (medium, square); ₦206 at 3:2 or 2:3 | OpenAI. Photo edits that keep the rest of the picture; transparent backgrounds. 1:1, 3:2 and 2:3 only. |
Gemini is 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.
GPT Image is billed per picture made, by quality and image_size, plus about ₦100 for each picture it works from when editing. quality is low, medium or high, and on the 2.5 models also xhigh and max; leave it out for the default shown above. size takes OpenAI's sizes (1024x1024, 1536x1024, 3840x2160 and the like), or send aspect_ratio (auto, 1:1, 4:5, 5:4, 3:4, 4:3, 2:3, 3:2, 1:2, 2:1, 9:16, 16:9, 21:9, 1:3, 3:1) and image_size. background: "transparent" works on gpt-image-1.5. A high-quality picture can take a minute or two. Exact prices for every quality and size: GET /v1/models?type=image.