Skip to main content
POST
Gemini generateContent
Use this endpoint for synchronous Gemini text generation, structured output, and parts-based payloads.
  • The official pattern is x-goog-api-key: {API_KEY}, though query-string API keys are also supported
  • Gemini parts differ from both OpenAI and Claude payloads, so map them separately
  • systemInstruction, generationConfig, tools, and safetySettings all hang off this request model
  • If you need incremental event output, use /v1beta/models/{model}:streamGenerateContent

Authorizations

x-goog-api-key
string
header
required

Path Parameters

model
string
required

Gemini model name.

Example:

"gemini-2.5-pro"

Body

application/json
contents
object[]
required
systemInstruction
object
generationConfig
object
safetySettings
object[]
tools
object[]

Response

Successful Gemini content response

candidates
object[]
usageMetadata
object