Gemini 3 Pro
Gemini 3 Pro API is Google DeepMind’s next-generation multimodal model with exceptional reasoning capabilities, seamlessly understanding text, images, video, and audio, with support for large-scale long-context processing.
Streaming Support
Whenstream: true is set in the request, the API returns responses as server-sent events (SSE) with Content-Type: text/event-stream. This allows for progressive response delivery, where message deltas are sent incrementally as they are generated. Each event contains partial message content, enabling real-time display of responses in your application.
Streaming Response Format:
- Content-Type:
text/event-stream - Each event line starts with
data:followed by JSON - Events contain incremental message deltas
- Final event indicates completion with
finish_reason
Multimodal
Real-time Search
Streaming
Flexible Roles
Unified Media File Format
Tools Parameter
Thetools parameter is an optional array that allows you to define functions the model can call. The array can contain multiple objects. When using function calling, you can define multiple functions in the array.
Google Search
Google Search
Function Calling
Function Calling
tools array:Function Declaration Requirements
When implementing function calling in your prompt, you need to create atools array containing one or more function declarations. You can define functions using JSON (specifically, a selected subset of OpenAPI schema format).A single function declaration can include the following parameters:-
name(string, required): The unique name of the function (e.g.,get_weather_forecast,send_email). Use descriptive names without spaces or special characters (use underscores or camelCase). -
description(string, optional but recommended): A clear and detailed description of what the function does and its purpose. This is crucial for the model to understand when to use the function. Be specific and provide examples when necessary (e.g., “Find movie theaters by location, with an option to also find movies currently showing at those theaters.”). -
parameters(object, required): Defines the input parameters expected by the function. Contains:type(string): Specifies the overall data type, must be"object".properties(object): Lists individual parameters, each with:type(string): The parameter’s data type, such asstring,integer,boolean,array.description(string): Description of the parameter’s purpose and format. Provide examples and constraints (e.g., “City and state, e.g. ‘San Francisco, CA’ or a postal code like ‘95616’.”).enum(array, optional): If parameter values come from a fixed set, useenumto list allowed values rather than just describing them in the description. This helps improve accuracy (e.g.,"enum": ["daylight", "cool", "warm"]).
required(array): An array of strings listing the parameter names required for the function to run.
Response Format Parameter
Theresponse_format parameter is an optional JSON Schema object that defines the structure of the response. When provided, the model will generate responses that conform to this schema.
JSON Schema Support
JSON Schema Support
response_format follows the JSON Schema specification. Supported types include:string: For text valuesnumber: For floating-point numbersinteger: For whole numbersboolean: For true/false valuesobject: For structured data with key-value pairsarray: For lists of itemsnull: To allow null values, add"null"to the type array (e.g.,{"type": ["string", "null"]})
Type-Specific Properties
Forobject values:properties: Object mapping property names to their schema definitionsrequired: Array of required property namesadditionalProperties: Controls whether properties not inpropertiesare allowed
string values:enum: List of specific possible string values for classificationformat: Specifies string syntax (e.g.,date-time,date,time)
number and integer values:enum: List of specific possible numeric valuesminimum: Inclusive minimum valuemaximum: Inclusive maximum value
array values:items: Schema definition for all array elementsprefixItems: List of schemas for the first N items (tuple-like structures)minItems: Minimum number of items in the arraymaxItems: Maximum number of items in the array
Example
Example
Best Practices
Best Practices
- Clear descriptions: Use the
descriptionfield in the schema to clearly explain what each property means - Strong typing: Use specific types (
integer,string,enum) whenever possible - Prompt engineering: Clearly state in your prompt what you want the model to extract or structure
- Validation: While structured output ensures JSON is syntactically correct, always validate the semantic correctness of values in your application code
Authorizations
All APIs require authentication via Bearer Token.
Get API Key:
- Visit API Key Management Page to get your API Key
Usage: Add to request header: Authorization: Bearer YOUR_API_KEY
Note:
- Keep your API Key secure and do not share it with others
- If you suspect your API Key has been compromised, reset it immediately in the management page
Body
An array of message objects. Each message has a role and content.
Unified Media File Format:
In the content array, whether it's images, videos, audio, or other document types, all media files use the same format structure:
- The
typefield is always"image_url" - The
image_urlfield name remains unchanged - The only thing that changes is the
urlvalue, which points to the corresponding media file address
For example: images, videos, audio, PDFs, and other documents all use the same { type: 'image_url', image_url: { url: '...' } } structure.
1If set to true, partial message deltas will be sent as server-sent events. Default is true.
An optional array of tools the model may call. The array can contain multiple objects. Supports two formats:
- Google Search:
{"type": "function", "function": {"name": "googleSearch"}}- Enables real-time information retrieval via Google Search. - Function calling: Define your own functions with name, description, and parameters. You can define multiple functions in the array. Functions are defined using JSON (specifically, a selected subset of OpenAPI schema format).
Important: Google Search and function calling are mutually exclusive - you cannot use both in the same request. When using function calling, you can include multiple function definitions. Function calling and response_format are also mutually exclusive - you cannot use both in the same request.
Whether to include thoughts in the response. If set to true, thoughts will be included in the response, otherwise they will not be included. Default is true.
The effort level for the model to use for reasoning. Low effort is faster to respond, high effort is slower to respond but solves more complex problems. Default is "high".
low, high Optional JSON Schema object defining the structure of the response. When provided, the model will generate responses that conform to this schema. response_format and function calling are mutually exclusive - you cannot use both in the same request.
Example:
{
"type": "json_schema",
"properties": {
"response": {
"type": "string"
}
}
}Response
Request successful. When response_format is provided, the response will conform to the specified JSON schema. Otherwise, returns the standard chat completion format.
Unique identifier for the chat completion
"chatcmpl-example-123"
Object type
"chat.completion"
Unix timestamp of when the completion was created
1677652288
Model name
"gemini-3-pro"
Array of completion choices
