Image Generation

Official Documentation: https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn

Endpoint

POST http://v98store.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent

cURL Command

curl -X POST 'http://v98store.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -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" ] } }'

Parameters

NameInDescriptionRequired
keyqueryYes
Content-TypeheaderYes

Request Body

Example

{
  "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"
    ]
  }
}

Responses

200 -

Example

undefined