Skip to main content
POST
Some model guides specify the native path POST /v1/models/{model}:generateContent. For those models, keep the version in the model guide and use the same native contents request structure. Do not assume both paths are enabled for every model.

Introduction

The Gemini Native API uses Google Gemini’s request and response format, suitable for Google official clients (such as google-generativeai SDK) or scenarios requiring direct use of Gemini data structures. If using OpenAI-compatible clients (such as OpenAI SDK), please use the /v1/chat/completions endpoint.

Differences from OpenAI Format

API Endpoints

Authentication

Two authentication methods are supported:

Request Parameters

generationConfig Parameters

Basic Examples

Advanced Features

Thinking Mode

Gemini 2.5 Pro and Gemini 3 Pro support thinking mode, allowing the model to perform deep reasoning before answering.Gemini 2.5 Pro - Using thinkingBudget:
Gemini 3 Pro - Using thinkingLevel:

Embedding API

Single Embedding

Response Example:

Batch Embedding

Response Example:

Response Format

Error Handling

Error Response Example:

Comparison with OpenAI Format