> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gptproto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini-2.5-Flash-Image-Hd - Image Edit - gptproto

> HD gemini 2.5 flash image edit. Quick, high-definition photo retouching and creative adjustments with professional AI speed.

## Authentication

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

## Initiate Request

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://gptproto.com/api/v3/google/gemini-2.5-flash-image-hd/image-edit' \
  --header 'Authorization: GPTPROTO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "Put a hat on the cat",
    "images": [
      "https://tos.gptproto.com/resource/cat.png"
    ],
    "output_format": "jpeg",
    "aspect_ratio": "1:1",
    "temperature": 1,
    "topP": 0.95,
    "enable_base64_output": false,
    "enable_sync_mode": false
  }'

  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');
  let data = JSON.stringify({
    "prompt": "Put a hat on the cat",
    "images": [
      "https://tos.gptproto.com/resource/cat.png"
    ],
    "output_format": "jpeg",
    "aspect_ratio": "1:1",
    "temperature": 1,
    "topP": 0.95,
    "enable_base64_output": false,
    "enable_sync_mode": false
  });

  let config = {
    method: 'post',
    maxBodyLength: Infinity,
    url: 'https://gptproto.com/api/v3/google/gemini-2.5-flash-image-hd/image-edit',
    headers: { 
      'Authorization': 'GPTPROTO_API_KEY', 
      'Content-Type': 'application/json'
    },
    data : data
  };

  axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });


  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/api/v3/google/gemini-2.5-flash-image-hd/image-edit"

  payload = json.dumps({
    "prompt": "Put a hat on the cat",
    "images": [
      "https://tos.gptproto.com/resource/cat.png"
    ],
    "output_format": "jpeg",
    "aspect_ratio": "1:1",
    "temperature": 1,
    "topP": 0.95,
    "enable_base64_output": False,
    "enable_sync_mode": False
  })
  headers = {
    'Authorization': 'GPTPROTO_API_KEY',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)


  ```

  ```go Go theme={null}
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://gptproto.com/api/v3/google/gemini-2.5-flash-image-hd/image-edit"
    method := "POST"

    payload := strings.NewReader(`{
    "prompt": "Put a hat on the cat",
    "images": [
      "https://tos.gptproto.com/resource/cat.png"
    ],
    "output_format": "jpeg",
    "aspect_ratio": "1:1",
    "temperature": 1,
    "topP": 0.95,
    "enable_base64_output": false,
    "enable_sync_mode": false
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Authorization", "GPTPROTO_API_KEY")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }

  ```
</CodeGroup>

## Query Result

If the request that generated your content includes the parameter `enable_sync_mode` set to `true` (some models do not support this parameter, but you still need to query the result by id), you **must** call the Query Result endpoint to retrieve the final output.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://gptproto.com/api/v3/predictions/{id}/result" \
    -H "Authorization: GPTPROTO_API_KEY" \
    -H "Content-Type: application/json"
  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/api/v3/predictions/{id}/result"
  headers = {
      "Authorization: GPTPROTO_API_KEY",
      "Content-Type": "application/json"
  }

  response = requests.get(url, headers=headers)
  result = response.json()
  print(json.dumps(result, indent=2))
  ```

  ```javascript JavaScript theme={null}
  const url = "https://gptproto.com/api/v3/predictions/{id}/result";
  const headers = {
    "Authorization: GPTPROTO_API_KEY",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "GET",
    headers: headers
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error("Error:", error));
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://gptproto.com/api/v3/predictions/{id}/result"

      req, _ := http.NewRequest("GET", url, nil)
      req.Header.Set("Authorization", "GPTPROTO_API_KEY")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</CodeGroup>

After submitting your prediction request, the response will contain the id you need.\
You can find it in either:

* `data.id` – the unique identifier of the prediction
* `data.urls[0].get` – a ready-to-use GET URL that already embeds the id

<Accordion title="Response Example">
  ```json theme={null}
  {
      "data": {
          "id": "abc",
          "model": "model_name",
          "outputs": [],
          "urls": {
              "get": "https://gptproto.com/api/v3/predictions/abc/result"
          },
          "status": "completed",
          "error": null,
          "executionTime": 0,
          "timings": {
              "inference": 0
          },
          "has_nsfw_contents": [],
          "created_at": "2026-01-01 00:00:00"
      },
      "message": "success",
      "code": 200
  }
  ```
</Accordion>

## Parameters

### Path Parameters

Endpoint: `https://gptproto.com/api/v3/google/{model}/{scene}`
<Note>Body parameters may vary depending on the scene. Incorrect scene selection may cause parameters to fail. Please choose the appropriate scene based on your actual needs.</Note>

| scene            | example                                                                       |
| ---------------- | ----------------------------------------------------------------------------- |
| `text-to-video`  | `https://gptproto.com/api/v3/google/gemini-3-pro-image-preview/text-to-image` |
| `image-to-video` | `https://gptproto.com/api/v3/google/gemini-3-pro-image-preview/image-edit`    |

### Core Body Parameters

| Parameter | Type   | Required | Default | Range | Description                                                                                    |
| --------- | ------ | -------- | ------- | ----- | ---------------------------------------------------------------------------------------------- |
| `prompt`  | string | ✅ Yes    | -       | -     | A text description of the desired image(s). The maximum length is 32000 characters.            |
| `image`   | array  | ❌ No     | -       | -     | Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 14 images. |

### Advanced Body Parameters

| Parameter              | Type    | Required | Default | Range                                                                                                                                                   | Description                                                                                                                                                                                                                                                           |
| ---------------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `size`                 | string  | ❌ No     | -       | `0.5K`<br />`1K`<br />`2K`<br />`4K`                                                                                                                    | Approximate size of the generated image. If not specified, the model will use the default value of 1K. `0.5K` is only supported by Gemini 3.1 Flash Image Preview; `2K` and `4K` are only supported by Gemini 3.1 Flash Image Preview and Gemini 3 Pro Image Preview. |
| `aspect_ratio`         | string  | ❌ No     | `1:1`   | `1:1`<br />`2:3`<br />`3:2`<br />`3:4`<br />`4:3`<br />`4:5`<br />`5:4`<br />`9:16`<br />`16:9`<br />`21:9`<br />`1:4`<br />`4:1`<br />`1:8`<br />`8:1` | The aspect ratio of the generated image. `1:4`, `4:1`, `1:8`, `8:1` are only supported by Gemini 3.1 Flash Image Preview.                                                                                                                                             |
| `temperature`          | number  | ❌ No     | -       | 0.0-1.0                                                                                                                                                 | Controls the randomness of the output.                                                                                                                                                                                                                                |
| `top_p`                | number  | ❌ No     | -       | -                                                                                                                                                       | Controls the diversity of the output.                                                                                                                                                                                                                                 |
| `enable_sync_mode`     | boolean | ❌ No     | `false` | `true`<br />`false`                                                                                                                                     | Whether to enable synchronous mode for image generation.                                                                                                                                                                                                              |
| `enable_base64_output` | boolean | ❌ No     | `false` | `true`<br />`false`                                                                                                                                     | Whether to enable base64 output for image generation.                                                                                                                                                                                                                 |
| `output_format`        | string  | ❌ No     | `png`   | `png`<br />`jpg`<br />`jpeg`                                                                                                                            | The format in which the generated images are returned.                                                                                                                                                                                                                |

#### Model Comparison

| Feature                       | Gemini 2.5 Flash Image | Gemini 3.1 Flash Image Preview | Gemini 3 Pro Image Preview    |
| ----------------------------- | ---------------------- | ------------------------------ | ----------------------------- |
| Use case                      | Speed & efficiency     | Speed & high-volume            | Professional asset production |
| Supported sizes               | 1K                     | 0.5K, 1K, 2K, 4K               | 1K, 2K, 4K                    |
| Max reference images          | 3                      | 14                             | 14                            |
| Max object images             | —                      | 10                             | 6                             |
| Max portrait images           | —                      | 4                              | 5                             |
| Extra aspect ratios           | —                      | 1:4, 4:1, 1:8, 8:1             | —                             |
| Google Image Search Grounding | —                      | ✅                              | —                             |

**Note:**

* **Gemini 3.1 Flash Image Preview**: Optimized for speed and high-volume use cases. Supports 0.5K resolution and extra ultra-wide/tall aspect ratios (1:4, 4:1, 1:8, 8:1). Also supports Google Image Search Grounding.
* **Gemini 3 Pro Image Preview**: Optimized for professional asset production with advanced reasoning for complex creation tasks.
* **Gemini 2.5 Flash Image**: Supports a maximum of 3 reference images and 1K resolution only.

#### 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 ratio | Resolution | Tokens |
| ------------ | ---------- | ------ |
| 1:1          | 1024x1024  | 1290   |
| 2:3          | 832x1248   | 1290   |
| 3:2          | 1248x832   | 1290   |
| 3:4          | 864x1184   | 1290   |
| 4:3          | 1184x864   | 1290   |
| 4:5          | 896x1152   | 1290   |
| 5:4          | 1152x896   | 1290   |
| 9:16         | 768x1344   | 1290   |
| 16:9         | 1344x768   | 1290   |
| 21:9         | 1536x672   | 1290   |

**Gemini 3.1 Flash Image Preview**

| Aspect ratio | 512px resolution | 0.5K tokens | 1K resolution | 1K tokens | 2K resolution | 2K tokens | 4K resolution | 4K tokens |
| ------------ | ---------------- | ----------- | ------------- | --------- | ------------- | --------- | ------------- | --------- |
| 1:1          | 512x512          | 747         | 1024x1024     | 1120      | 2048x2048     | 1120      | 4096x4096     | 2000      |
| 1:4          | 256x1024         | 747         | 512x2048      | 1120      | 1024x4096     | 1120      | 2048x8192     | 2000      |
| 1:8          | 192x1536         | 747         | 384x3072      | 1120      | 768x6144      | 1120      | 1536x12288    | 2000      |
| 2:3          | 424x632          | 747         | 848x1264      | 1120      | 1696x2528     | 1120      | 3392x5056     | 2000      |
| 3:2          | 632x424          | 747         | 1264x848      | 1120      | 2528x1696     | 1120      | 5056x3392     | 2000      |
| 3:4          | 448x600          | 747         | 896x1200      | 1120      | 1792x2400     | 1120      | 3584x4800     | 2000      |
| 4:1          | 1024x256         | 747         | 2048x512      | 1120      | 4096x1024     | 1120      | 8192x2048     | 2000      |
| 4:3          | 600x448          | 747         | 1200x896      | 1120      | 2400x1792     | 1120      | 4800x3584     | 2000      |
| 4:5          | 464x576          | 747         | 928x1152      | 1120      | 1856x2304     | 1120      | 3712x4608     | 2000      |
| 5:4          | 576x464          | 747         | 1152x928      | 1120      | 2304x1856     | 1120      | 4608x3712     | 2000      |
| 8:1          | 1536x192         | 747         | 3072x384      | 1120      | 6144x768      | 1120      | 12288x1536    | 2000      |
| 9:16         | 384x688          | 747         | 768x1376      | 1120      | 1536x2752     | 1120      | 3072x5504     | 2000      |
| 16:9         | 688x384          | 747         | 1376x768      | 1120      | 2752x1536     | 1120      | 5504x3072     | 2000      |
| 21:9         | 792x336          | 747         | 1584x672      | 1120      | 3168x1344     | 1120      | 6336x2688     | 2000      |

**Gemini 3 Pro Image Preview**

| Aspect ratio | 1K resolution | 1K tokens | 2K resolution | 2K tokens | 4K resolution | 4K tokens |
| ------------ | ------------- | --------- | ------------- | --------- | ------------- | --------- |
| 1:1          | 1024x1024     | 1120      | 2048x2048     | 1120      | 4096x4096     | 2000      |
| 2:3          | 848x1264      | 1120      | 1696x2528     | 1120      | 3392x5056     | 2000      |
| 3:2          | 1264x848      | 1120      | 2528x1696     | 1120      | 5056x3392     | 2000      |
| 3:4          | 896x1200      | 1120      | 1792x2400     | 1120      | 3584x4800     | 2000      |
| 4:3          | 1200x896      | 1120      | 2400x1792     | 1120      | 4800x3584     | 2000      |
| 4:5          | 928x1152      | 1120      | 1856x2304     | 1120      | 3712x4608     | 2000      |
| 5:4          | 1152x928      | 1120      | 2304x1856     | 1120      | 4608x3712     | 2000      |
| 9:16         | 768x1376      | 1120      | 1536x2752     | 1120      | 3072x5504     | 2000      |
| 16:9         | 1376x768      | 1120      | 2752x1536     | 1120      | 5504x3072     | 2000      |
| 21:9         | 1584x672      | 1120      | 3168x1344     | 1120      | 6336x2688     | 2000      |

## Error Codes

### Common Error Codes

| Error Code | Error Name               | Description                                                                                                       |
| ---------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| 401        | Unauthorized             | API key is missing or invalid                                                                                     |
| 403        | Forbidden                | Your API key doesn't have permission to access this resource, or insufficient balance for the requested operation |
| 429        | Too Many Requests        | You've exceeded your rate limit                                                                                   |
| 500        | Internal server error    | An internal server error occurred                                                                                 |
| 503        | Content policy violation | Content blocked due to safety concerns (actual status code is 400)                                                |
