Skip to main content
POST
/
v1beta
/
models
/
gemini-2.5-flash-image-hd:generateContent
gemini-2.5-flash-image-hd (text to image)
curl --request POST \
  --url https://api.example.com/v1beta/models/gemini-2.5-flash-image-hd:generateContent
Gemini’s official format for the text to image API.
curl -X POST "https://gptproto.com/v1beta/models/gemini-2.5-flash-image-hd:generateContent" \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  }
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
contentsarray❌ No[{"role": "user", "parts": [{"text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"}]}]Contents parameter
generationConfigobject❌ No{"responseModalities": ["TEXT", "IMAGE"]}Generationconfig parameter