Skip to main content
POST
/
v1
/
images
/
generations
Image to Image
curl --request POST \
  --url https://gptproto.com/v1/images/generations \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "<string>",
  "prompt": "<string>",
  "size": "<string>"
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Overview

Google Gemini 2.5 Flash Image preview, a powerful new image generation and editing model with advanced features and creative control.

Supported inputs & outputs :

Inputs: Text and Images Outputs: Text and image

Authentication

This endpoint requires authentication using a Bearer token.
Authorization
string
default:"sk-***********"
required
Your API key in the format: YOUR_API_KEY

Request Body

model
string
default:"gemini-2.5-flash-image-preview"
required
The model to use for the request
prompt
string
required
Prompt can add image url
size
string
default:"16:9"
1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. default 1:1

Image to Image

curl -X POST "https://gptproto.com/v1/images/generations" \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini-2.5-flash-image-preview",
  "prompt": "image_url1 , image_url2. Create a professional e-commerce fashion photo. Take the blue floral dress from the first image and let the woman from the second image wear it. Generate a realistic, full-body shot of the woman wearing the dress, with the lighting and shadows adjusted to match the outdoor environment.",
  "size": "16:9"
}'

Size

The model defaults to matching the output image size to that of your input image, or otherwise generates 1:1 squares. The size of the image generated are listed in this table:
Aspect ratioResolution
1:11024x1024
2:3832x1248
3:21248x832
3:4864x1184
4:31184x864
4:5896x1152
5:41152x896
9:16768x1344
16:91344x768
21:91536x672

Response

  {
      "created": 1762156444807,
      "data": [
          {
              "b64_json": "image_base64"
          }
      ],
      "output_format": "png",
      "quality": "high",
      "size": "16:9",
      "usage": {
          "input_tokens": 535,
          "input_tokens_details": {
              "image_tokens": 516,
              "text_tokens": 19
          },
          "output_tokens": 1291,
          "total_tokens": 1826
      }
  }
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}