Skip to main content
POST
/
v1beta
/
models
/
gemini-2.0-flash:generateContent
Image Editing
curl --request POST \
  --url https://www.anyfast.ai/v1beta/models/gemini-2.0-flash:generateContent \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Change the background to blue sky with clouds"
        },
        {
          "inline_data": {
            "mime_type": "image/png",
            "data": "BASE64_IMAGE_DATA"
          }
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "IMAGE"
    ]
  }
}
'
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "inline_data": {
              "mime_type": "image/png",
              "data": "iVBORw0KGgo..."
            },
            "text": "<string>"
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  }
}

Query Parameters

key
string
required

API Key

Body

application/json
contents
object[]
required

Array of contents with editing instructions and source images.

Example:
[
  {
    "role": "user",
    "parts": [
      {
        "text": "Change the background to blue sky with clouds"
      },
      {
        "inline_data": {
          "mime_type": "image/png",
          "data": "BASE64_IMAGE_DATA"
        }
      }
    ]
  }
]
generationConfig
object
required

Response

Image edited successfully

candidates
object[]
usageMetadata
object