Skip to main content
POST
/
v1
/
images
/
edits
gemini-2.5-flash-image-hd (Image Edit)
curl --request POST \
  --url https://api.example.com/v1/images/edits

API Key Authentication

GPTProto API uses Bearer token authentication. All API requests must include your API key (sk-xxxxx) in the Authorization header.

Getting Your API Key

  1. Sign up for a GPTProto account at https://gptproto.com
  2. Navigate to the API Keys section in your dashboard
  3. Generate a new API key
  4. Copy and securely store your API key For authentication details, please refer to the Authentication section.

Initiate Request

curl --location --request POST 'https://gptproto.com/v1/images/edits' \
--header 'Authorization: GPTPROTO_API_KEY' \
--header 'Content-Type: application/json' \
--form 'model=gemini-2.5-flash-image-hd' \
--form 'image[]=@/cat.jpg' \
--form 'prompt=Put a hat on the cat'

Response Example

{
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": "![image](data:image/jpeg;base64,*****)",
                "role": "assistant"
            }
        }
    ],
    "created": 1766481392,
    "id": "chatcmpl-**",
    "model": "gemini-2.5-flash-image-hd",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 1319,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "reasoning_tokens": 116,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens": 265,
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0
        },
        "total_tokens": 1584
    }
}

Parameters

Core Parameters

ParameterTypeRequiredDefaultRangeDescription
modelstring✅ Yesgemini-3-pro-image-preview-The model to use for image editing. Defaults to gemini-3-pro-image-preview.
promptstring✅ Yes--A text description of the desired image(s).
imagestring or file❌ No--You can provide up to 14 images.
ninteger❌ No11The number of images to generate. Only 1 image is supported.
sizestring❌ Noauto1:1
2:3
3:2
3:4
4:3
9:16
16:9
21:9
Equivalent to the aspect_ratio field in Google’s official format, used to control the aspect ratio of the output image.

Aspect Ratio & Image Size

By default, the model keeps the output image the same size as the input image; otherwise it produces a 1:1 square.
You can control the aspect ratio of the generated image with the aspect_ratio field under image_config in your request, as shown below:
Gemini 2.5 Flash Image
Aspect ratioResolutionTokens
1:11024x10241290
2:3832x12481290
3:21248x8321290
3:4864x11841290
4:31184x8641290
4:5896x11521290
5:41152x8961290
9:16768x13441290
16:91344x7681290
21:91536x6721290
Gemini 3 Pro Image Preview
Aspect ratio1K resolution1K tokens2K resolution2K tokens4K resolution4K tokens
1:11024x102411202048x204811204096x40962000
2:3848x126411201696x252811203392x50562000
3:21264x84811202528x169611205056x33922000
3:4896x120011201792x240011203584x48002000
4:31200x89611202400x179211204800x35842000
4:5928x115211201856x230411203712x46082000
5:41152x92811202304x185611204608x37122000
9:16768x137611201536x275211203072x55042000
16:91376x76811202752x153611205504x30722000
21:91584x67211203168x134411206336x26882000

Error Codes

Common Error Codes

Error CodeError NameDescription
401UnauthorizedAPI key is missing or invalid
403ForbiddenYour API key doesn’t have permission to access this resource, or insufficient balance for the requested operation
429Too Many RequestsYou’ve exceeded your rate limit
500Internal server errorAn internal server error occurred
503Content policy violationContent blocked due to safety concerns (actual status code is 400)