Skip to main content
POST

Gemini Native Format

Gemini Native Format preserves the Google Gemini API paths and request bodies. It is suitable for business integrations that already use the Gemini SDK, the contents/parts structure, or safety settings configuration.

Authentication

Google API Key style is also supported:
Or as a query parameter:

Paths

Request Body

contents
array<object>
required
List of conversation contents. Each content item contains role and parts.
contents[].parts
array<object>
required
Content parts. Supports text, inlineData, fileData, functionCall, functionResponse, and more.
contents[].parts[].videoMetadata
object
Video input metadata. Use it on the same part as video inlineData or fileData to control the time range and frame sampling rate the model reads.Supported fields:
  • startOffset: Video start offset, using Duration string format, such as "3s" or "3.5s".
  • endOffset: Video end offset, using Duration string format, such as "10s".
  • fps: Video sampling frame rate. Defaults to 1.0; valid range is 0 < fps <= 24.
When a request includes multiple videos, each video part can set its own videoMetadata.
systemInstruction
object
System-level instruction (System Prompt). Used to define model behavior, role setting, and response style. Compatible with both systemInstruction and system_instruction forms.
generationConfig
object
Generation configuration, used to control model output behavior. Supports the following fields:
  • temperature: Controls output randomness; higher values produce more diverse results.
  • topP: Nucleus Sampling probability threshold.
  • topK: Samples only from the top K most probable tokens.
  • candidateCount: Number of candidate results to return.
  • maxOutputTokens: Maximum number of output tokens.
  • stopSequences: Stops generation when the specified strings are encountered.
  • responseMimeType: Specifies the output format, e.g. text/plain, application/json.
  • responseSchema: JSON Schema structured output constraint.
  • presencePenalty: Reduces repetitive topics and encourages new content generation.
  • frequencyPenalty: Reduces repetitive words or sentences.
  • seed: Fixes the random seed for reproducible results.
  • responseLogprobs: Whether to return token probability information.
  • logprobs: Number of token probabilities to return.
  • audioTimestamp: Whether to return audio timestamps.
  • speechConfig: Speech output configuration (TTS).
  • thinkingConfig: Gemini Thinking model reasoning configuration.
safetySettings
array<object>
Safety policy configuration. Each item contains category (risk category) and threshold (risk blocking level).Supported risk categories: HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT.
tools
array<object>
Gemini tool declaration list, used to enable function calling, search, code execution, and other capabilities. Supports the following tool types:
  • functionDeclarations: Function Calling function declarations.
  • googleSearch: Google search capability.
  • codeExecution: Code execution capability.
  • urlContext: URL content parsing capability.
  • retrieval: Retrieval-Augmented Generation (RAG).
  • googleSearchRetrieval: Google retrieval augmentation.
toolConfig
object
Tool invocation configuration.Commonly used to configure functionCallingConfig.mode: AUTO (model automatically decides whether to call tools), ANY (force tool calling), NONE (disable tool calling).allowedFunctionNames: Specifies the list of functions allowed to be called.
cachedContent
string
Gemini Cached Content identifier. Used to reuse context cache, reducing token consumption and response latency for long-context requests.

Request Example

Multimodal Input

Video Input with videoMetadata

Put videoMetadata on the same part as the video data. It can be used to analyze only a video segment or adjust frame sampling density.

Streaming Generation

Response Example

Common Safety Settings