Skip to main content
POST
/
v1beta
/
models
/
gemini-2.5-flash:generateContent
Text Generation (with Search)
curl --request POST \
  --url https://www.anyfast.ai/v1beta/models/gemini-2.5-flash:generateContent \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "What is the weather in Chongqing today?"
        }
      ]
    }
  ],
  "tools": [
    {
      "googleSearch": {}
    }
  ]
}
'
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Based on search results, the weather in Chongqing today..."
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "groundingMetadata": {
        "searchEntryPoint": {},
        "groundingChunks": [
          {}
        ]
      }
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  }
}

Query Parameters

key
string
required

API Key

Body

application/json
contents
object[]
required

Array of conversation contents.

Example:
[
  {
    "role": "user",
    "parts": [
      {
        "text": "What is the weather in Chongqing today?"
      }
    ]
  }
]
tools
object[]

Tool configuration to enable Google Search.

Example:
[{ "googleSearch": {} }]

Response

Response generated successfully

candidates
object[]
usageMetadata
object