Gemini Generate Content
Create text, multimodal, tool, and code-execution responses with Gemini Content and Parts.
The Generate Content API uses Content and Parts for text, multimodal, function-calling, and code-execution requests. It returns generated output through Candidates, Usage Metadata, and safety information. Requests use Bearer API key authentication. Supported input modalities, tools, and advanced generation parameters depend on the selected model.
/v1beta/models/{model}:generateContentUse Gemini Content and Parts structures to generate text, multimodal, function calls, or code execution responses.
Authorization
bearerAuth Use Bearer your-api-key in the Authorization Header.
In: header
Path Parameters
Model ID used to generate content. The path automatically forms models/{model}.
"MODEL_ID"Request Body
Gemini uses Content and Parts to represent text, multimodal input, tools, and generation settings.
application/jsonUse user and model Content objects to organize single-turn or multi-turn text conversations.
- contents[]
- Conversation content in chronological order.
- parts[].text
- Text content in each message.
- role
- Message author; commonly user or model.
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hello! Please introduce yourself."
}
]
}
]
}Use Content objects and text Parts to organize single-turn or multi-turn text conversations.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json