# Nano Banana image editing and multi-image: inlineData and /v1/images/edits Source: https://ofox.io/docs/develop/models/nano-banana/image-edit For model IDs and choosing an endpoint, see the [Nano Banana overview](https://ofox.io/docs/develop/models/nano-banana). **Key point**:The native API puts the image and the text in the same `parts`; the OpenAI-compatible API uses `/v1/images/edits`. **Python (native)** ```python filename="edit.py" from google import genai from google.genai import types client = genai.Client( api_key="YOUR_OFOX_API_KEY", http_options={"api_version": "v1beta", "base_url": "https://api.ofox.io/gemini"}, ) with open("apple.png", "rb") as f: image = types.Part.from_bytes(data=f.read(), mime_type="image/png") resp = client.models.generate_content( model="google/gemini-3.1-flash-image", contents=["Make the apple green, keep everything else the same", image], config=types.GenerateContentConfig( response_modalities=["IMAGE"], image_config=types.ImageConfig(aspect_ratio="1:1", image_size="1K"), ), ) for part in resp.candidates[0].content.parts: if part.inline_data: with open("apple_green.png", "wb") as f: f.write(part.inline_data.data) ``` **cURL (native)** ```bash filename="Terminal" # The image's base64 is long; putting it straight on the command line fails with # "Argument list too long", so write it to a file first base64 < apple.png | tr -d '\n' > apple.b64 jq -n --rawfile img apple.b64 '{ contents: [{ parts: [ { text: "Make the apple green, keep everything else the same" }, { inlineData: { mimeType: "image/png", data: $img } } ] }], generationConfig: { responseModalities: ["IMAGE"], imageConfig: { aspectRatio: "1:1", imageSize: "1K" } } }' > body.json curl 'https://api.ofox.io/gemini/v1beta/models/google/gemini-3.1-flash-image:generateContent' \ --max-time 600 \ -H "x-goog-api-key: $OFOX_API_KEY" \ -H 'Content-Type: application/json' \ -d @body.json \ | jq -r '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | base64 --decode > apple_green.png ``` **cURL (OpenAI-compatible)** ```bash filename="Terminal" curl https://api.ofox.io/v1/images/edits \ --max-time 600 \ -H "Authorization: Bearer $OFOX_API_KEY" \ -F model=google/gemini-3.1-flash-image \ -F prompt="Make the apple green, keep everything else the same" \ -F image=@apple.png \ | jq -r '.data[0].b64_json' | base64 --decode > apple_green.png ``` - **Multi-image composition**: put several `inlineData` items in the same `parts` and describe the role of each image in the text, e.g. "Place the person from the first image into the scene from the second image". - **Keeping the aspect ratio**: pass `aspectRatio` when editing too; otherwise the model decides the output ratio, which may not match the original. - **Reference image billing**: reference images are billed as input tokens. We measured 1,120 tokens for one 1024×1024 reference image; see the `IMAGE` entry of `promptTokensDetails` in the response. If you run into errors, see [Troubleshooting errors](https://ofox.io/docs/develop/models/nano-banana/errors).