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.
stream: 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:
text/event-streamdata: followed by JSONfinish_reasontools 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
Function Calling
tools array:tools 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 as string, 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, use enum to 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 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
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"]})object values:properties: Object mapping property names to their schema definitionsrequired: Array of required property namesadditionalProperties: Controls whether properties not in properties are allowedstring 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 valuearray 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 arrayExample
Best Practices
description field in the schema to clearly explain what each property meansinteger, string, enum) whenever possibleAll APIs require authentication via Bearer Token.
Get API Key:
Usage: Add to request header: Authorization: Bearer YOUR_API_KEY
Note:
An array of message objects. Each message has a role and content.
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:
{"type": "function", "function": {"name": "googleSearch"}} - Enables real-time information retrieval via Google Search.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": "object",
"properties": {
"response": {
"type": "string"
}
}
}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-123"
Object type
"chat.completion"
Unix timestamp of when the completion was created
1677652288
Model name
"gemini-3-pro"
Array of completion choices