Image Edit API

FastRouter’s Image Edit API lets you send an image and a natural-language instruction to generate an AI-edited version using the openai/gpt-image-1 model.

Image Edit API

Use FastRouter.ai to edit and transform images using the openai/gpt-image-1 model. Provide an input image along with a natural-language instruction, and FastRouter will generate an edited version of the image.


Endpoint

POST https://go.fastrouter.ai/api/v1/images/edits

Base URL

https://go.fastrouter.ai/api/v1

Required Parameters

Parameter
Type
Description

image

file or file[]

The image(s) to edit. Must be PNG, WEBP, or JPG and smaller than 50MB each. Supports up to 16 images.

prompt

string

Text description of the desired modification. Max length: 32,000 characters for gpt-image-1.

model

string

Must be "openai/gpt-image-1"


Optional Parameters

Parameter
Type
Default
Description

n

integer

1

Number of images to generate (1–10).

size

string

1024x1024

Output size: 1024x1024, 1536x1024, 1024x1536, or auto.

output_compression

integer

100

Compression (0–100) for JPEG or WEBP outputs.

output_format

string

png

Output format: png, jpeg, or webp.

mask

file

PNG mask file (< 4MB). Transparent areas indicate regions to edit. Must match dimensions of the first input image.

background

string

auto

Controls background transparency: transparent, opaque, or auto. If transparent, output format must be png or webp.


cURL Example


Python Example (OpenAI SDK)


Image Edit via Chat Completions (Nano Banana)

FastRouter also supports image editing through the Chat Completions API using Google Gemini Nano Banana, accessible as google/gemini-2.5-flash-image.

Instead of calling the /images/edits endpoint, you send a chat completion request to /chat/completions with:

  • model set to "google/gemini-2.5-flash-image"

  • A messages array where the user message content contains:

    • An image_url block pointing to the input image. FastRouter supports both direct URLs and base64-encoded data for images.

    • A text block describing the desired edit in natural language

cURL Example (Nano Banana Chat Completion)

This call will return a response from Nano Banana where the model has applied the requested visual edit to the provided image via the Chat Completions API.

Last updated