Integration guides ยท 2026-09-22
Gemini 2.5 Flash Image: a step-by-step editing flow and what the function-calling label means
Covers how to generate an image from text with google/gemini-2.5-flash-image and keep editing it through sequential instructions, how each step is priced, and what the catalog's function-calling label means on the image endpoint.
Generation and editing on the same endpoint
google/gemini-2.5-flash-image's catalog description states it's a good fit for teams wanting to combine text-to-image generation and sequential editing in the same workflow. On LLMTR both happen on the `/v1/images/generations` endpoint; you don't need to move to a separate editing API.
This endpoint keeps no conversation history: each request is processed only with the `prompt` and reference images sent in that request. To keep editing an image, you send the previous step's output again in the `image_url` field (or `file_id` for a file you uploaded) and write the new instruction, such as 'turn the background blue', as the `prompt`. A follow-up request sent without the reference image does not edit the previous image; it generates a new one from scratch.
- Step 1: generate the first image with a `prompt`.
- Step 2: attach the returned image as a reference with `image_url` or `file_id`, and write the edit instruction as the `prompt`.
- Send the latest image again as the reference on every new editing step.
How each editing step is priced
Pricing splits into three components: input text at $0.30 per million tokens, input image at $0.30 per million tokens, and output image at $0.039 per image. The input image is not a flat per-image fee; it is charged by how many tokens the reference image corresponds to, so the cost of one reference image typically stays well under a cent.
In an editing loop every step is a new request with its own input and output cost. The dominant line in a multi-step flow's total is usually the $0.039 output image per step; budget by multiplying the expected number of steps by that amount, then adding the text and reference-image tokens.
The catalog's function-calling label is not usable on the image endpoint
`function_calling` appears in the model's catalog capability list, but the `/v1/images/generations` endpoint does not accept the `tools` and `tool_choice` fields; you cannot build a flow that calls a tool during image generation through this endpoint. If you need to pull a reference image from a product catalog, for example, do that step in your own application and add the image you found to the request as an `image_url`.
The catalog description positions the model for rapid iteration, product visuals, and creative assistant scenarios; the reference-image flow above fits directly into a design tool or an e-commerce image editor where a user fine-tunes an image through several sequential instructions.
Frequently asked questions
Do I need to resend the previous image to edit it?
Yes. `/v1/images/generations` keeps no conversation history; on every editing request you need to send the previous image as a reference with `image_url` or `file_id`. A request sent without the reference generates a new image.
Can I use function calling while generating images?
No. The image endpoint does not accept the `tools` field. Do the step you wanted a tool for (finding a reference image, for example) in your own application and add the result to the request as a reference image.