Gemini API reference
发布时间:2026-09-11 | 浏览:1
Español – América Latina
Português – Brasil
This API reference describes the unary, streaming, and real-time APIs you can use to interact with the Gemini models. You can use the REST APIs in any environment that supports HTTP requests. Refer to the Get started guide for how to get started with your first API call. If you're looking for the references for our language-specific libraries and SDKs, go to the link for that language in the left navigation under SDK references .
Primary endpoints
The Gemini API is organized around the following major endpoints:
Interactions ( CreateInteraction ) (Recommended): The recommended standard primitive for building with Gemini, optimized for agentic workflows, server-side state management, and complex multi-modal, multi-turn conversations.
Standard content generation ( generateContent ): A standard REST endpoint that processes your request and returns the model's full response in a single package. This is best for non-interactive tasks where you can wait for the entire result.
Streaming content generation ( streamGenerateContent ): Uses Server-Sent Events (SSE) to push chunks of the response to you as they are generated. This provides a faster, more interactive experience for applications like chatbots.
Live API ( BidiGenerateContent ): A stateful WebSocket-based API for bi-directional streaming, designed for real-time conversational use cases.
Batch mode ( batchGenerateContent ): A standard REST endpoint for submitting batches of generateContent requests.
Embeddings ( embedContent ): A standard REST endpoint that generates a text embedding vector from the input Content .
Gen Media APIs: Endpoints for generating media with our specialized models such as Imagen for image generation , and Veo for video generation . Gemini also has these capabilities built in which you can access using the generateContent API.
Platform APIs: Utility endpoints that support core capabilities such as uploading files , and counting tokens .
All requests to the Gemini API must include a x-goog-api-key header with your API key. Create one with a few clicks in Google AI Studio .
The following is an example request with the API key included in the header:
For instructions on how to pass your key to the API using Gemini SDKs, see the Using Gemini API keys guide.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-09-04 UTC.