# Nano Banana API: Edit Images with Gemini in Code

DevFeed: [Nano Banana API: Edit Images with Gemini in Code](<https://devfeed.tech/articles/nano-banana-api-edit-images-with-gemini-in-code-78661.md>)

Original publisher: [Read original article](<https://openrouter.ai/blog/tutorials/nano-banana/>)

Author: OpenRouter

Published: 2026-09-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [OpenRouter](<https://devfeed.tech/sources/openrouter.md>)

Topics: [Chat completions endpoints](<https://devfeed.tech/topics/chat-completions-endpoints.md>), [Generative AI](<https://devfeed.tech/topics/generative-ai.md>), [Image](<https://devfeed.tech/topics/image.md>), [vercel ai sdk](<https://devfeed.tech/topics/vercel-ai-sdk.md>)

Tags: [ai-api](<https://devfeed.tech/tags/ai-api.md>), [ai-model](<https://devfeed.tech/tags/ai-model.md>), [api](<https://devfeed.tech/tags/api.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [images](<https://devfeed.tech/tags/images.md>), [python](<https://devfeed.tech/tags/python.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

A tutorial demonstrates editing an existing image through the OpenRouter API using Gemini image models. It includes Python and TypeScript requests, explains sending images as URLs or base64 data URLs, retrieving edited images, iterating with follow-up prompts, switching models, and handling common errors and costs.

## Source excerpt

Send a source image and an edit prompt in one request, get the edited image back, and change the editing model by editing a single field. Runnable Python and TypeScript included.