v1

latestOpenAPI 3.1.02026-07-2611077199.5 KB

Generate Gemini content

Generates a Gemini response using the native generateContent REST request and response format.

post/v1beta/models/{model}:generateContent

Path parameters

modelstring required
Example:gemini-3.5-flash

Gemini model ID.

Request body

toolsobject[]

Tools the model may use, such as function declarations, code execution, or supported built-in tools.

toolConfigobject

Configuration shared by the tools in this request.

cachedContentstring

Cached content resource to use as context. Format: cachedContents/{cachedContent}.

serviceTier'unspecified' | 'standard' | 'flex' | 'priority'

Service tier for this request.

storeboolean

Overrides the project-level request logging configuration.

Example request

{
  "contents": [
    {
      "parts": [
        {
          "inlineData": {
            "mimeType": "image/jpeg"
          }
        }
      ]
    }
  ],
  "systemInstruction": {
    "parts": [
      {
        "inlineData": {
          "mimeType": "image/jpeg"
        }
      }
    ]
  },
  "cachedContent": "cachedContents/abc123"
}

Response

Successful Gemini GenerateContentResponse.

modelVersionstring
responseIdstring
modelStatusobject

Example response

{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "inlineData": {
              "mimeType": "image/jpeg"
            }
          }
        ]
      }
    }
  ]
}