Skip to main content
POST
/
v1
/
images
/
generations
gemini-2.5-flash-image (text to image)
curl --request POST \
  --url https://api.example.com/v1/images/generations
Gemini’s GPTProto format for the text to image API.

Supported inputs & outputs :

Inputs: Text Outputs: Text and image
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
modelstring✅ Yesgemini-2.5-flash-imageThe model to use for the request
promptstring✅ YesCreate a picture of a nano banana dish in a fancy restaurant with a Gemini themeThe prompt for the generation.
sizestring❌ No1:11:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. default 1:1sizeResolution:-----------:---------1:11024x10242:3832x12483:21248x8323:4864x11844:31184x8644:5896x11525:41152x8969:16768x134416:91344x76821: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
    }
}