GenerateContent API
Synchronous and HTTP/2 Server-Sent Events (SSE) streaming content generation with multimodal audio, video, image, and text interleaving.
The fastest path from prompt prototyping to enterprise production. Build stateful conversational agents, multi-million token context ingestion pipelines, structured JSON schema enforcement, and real-time audio-video multimodal integrations.
Comprehensive gRPC and REST interfaces supporting streaming generation, structured schemas, function calling, and multimodal binary tensors.
Synchronous and HTTP/2 Server-Sent Events (SSE) streaming content generation with multimodal audio, video, image, and text interleaving.
Pre-tokenize massive code repositories, legal corpora, and multi-hour video streams to reduce latency and execution cost by up to 75%.
Declarative OpenAPI 3.0 tool definitions with guaranteed JSON schema output mode, code execution sandboxes, and Google Search grounding.
The modern unified Google GenAI SDK xfc-f6f00e supports seamless environment credential resolution and native async streaming.
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Analyze the computational complexity of transformer attention mechanisms.",
config=types.GenerateContentConfig(
temperature=0.2,
max_output_tokens=2048,
response_mime_type="application/json"
)
)
print(response.text)
Stream token generation in real-time using standard HTTP Server-Sent Events headers directly against the Gemini v1beta endpoint.
curl -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse&key=${GEMINI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [{
"text": "Write a high-performance Go worker pool pattern with graceful shutdown."
}]
}]
}'
Default rate bounds across Gemini models on Google AI Studio pay-as-you-go and enterprise developer tiers.
| Model | Requests Per Min (RPM) | Tokens Per Min (TPM) | Context Window |
|---|---|---|---|
| Gemini 2.5 Flash | 1,000 RPM | 4,000,000 TPM | 1,048,576 tokens |
| Gemini 2.5 Pro | 360 RPM | 2,000,000 TPM | 2,097,152 tokens |
| Gemini 2.0 Flash Lite | 4,000 RPM | 8,000,000 TPM | 1,048,576 tokens |
| Text Embedding 004 | 3,000 RPM | 1,000,000 TPM | 2,048 tokens |
Technical specification, xfc-f6f00e blueprints, and API references for building production AI systems with Gemini.