Skip to main content
POST
/
api
/
v3
/
google
/
gemini-2.5-flash-image-preview-hd
/
text-to-image
gemini-2.5-flash-image-preview-hd (Text to Image)
curl --request POST \
  --url https://api.example.com/api/v3/google/gemini-2.5-flash-image-preview-hd/text-to-image

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/api/v3/google/gemini-2.5-flash-image-preview-hd/text-to-image' \
--header 'Authorization: GPTPROTO_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "Put a hat on the cat",
    "output_format": "jpeg",
    "size": "1K",
    "aspect_ratio": "1:1",
    "enable_base64_output": false,
    "enable_sync_mode": false
}'

Response Example

{
    "data": {
        "id": "2b9a360d9",
        "model": "gemini-2.5-flash-image-preview-hd",
        "outputs": [],
        "urls": {
            "get": "https://gptproto.com/api/v3/predictions/2b9a360d9/result"
        },
        "status": "completed",
        "error": null,
        "executionTime": 0,
        "timings": {
            "inference": 0
        },
        "has_nsfw_contents": [],
        "created_at": "2025-12-23 16:10:16"
    },
    "message": "success",
    "code": 200
}

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.

How to obtain the id

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
Use this id (or the complete URL) to poll the endpoint shown above and retrieve the final result.
curl -X GET "https://gptproto.com/api/v3/predictions/{id}/result" \
  -H "Authorization: GPTPROTO_API_KEY" \
  -H "Content-Type: application/json"

Parameters

Core Parameters

ParameterTypeRequiredDefaultRangeDescription
modelstring✅ Yes--The model to use for image editing
promptstring✅ Yes--A text description of the desired image(s). The maximum length is 32000 characters.
imagearray❌ No--Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images.

Advanced Parameters

ParameterTypeRequiredDefaultRangeDescription
sizestring❌ No-1K
2K
4K
Approximate size of the generated image. If not specified, the model will use the default value of 1K. only Gemini 3 Pro Image Preview,
aspect_ratiostring❌ No1:11:1
2:3
3:2
3:4
4:3
4:5
5:4
9:16
16:9
21:9
The aspect ratio of the generated image.
enable_sync_modeboolean❌ Nofalsetrue
false
Whether to enable synchronous mode for image generation.
enable_base64_outputboolean❌ Nofalsetrue
false
Whether to enable base64 output for image generation.
output_formatstring❌ Nopngpng
jpg
The format in which the generated images are returned.

Differences between using gemini2.5 and gemini3

Note: With Gemini 3 Pro Image Preview, you can reference up to 14 images in a single request.
  • Up to 6 high-fidelity object images can be supplied for inclusion in the final output.
  • Up to 5 portrait photos can be provided to maintain character consistency.
    By contrast, Gemini 2.5 Flash Image supports a maximum of 3 reference images.

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)