Skip to main content

Gemini (OpenAI Format) - File Analysis

Gemini models support OpenAI request format with extended file analysis capabilities. Supports PDFs, images, audio, and video files.

Supported File Types

Request

Headers

Request Body

Content Types for File Analysis

For files over 20MB, use the URL method instead of base64.

Dynamic Thinking Models

When model name ends with thinking-* (e.g. gemini-3.8-flash-thinking-2000), it supports dynamic thinking token limits. The number after thinking- sets the max thinking tokens. Enable web search by either:
  1. Adding -search suffix to model name (e.g. gemini-3.8-flash-search)
  2. Adding googleSearch tool:

Example Request - Chat

Example Request - File Analysis

Python Example - Thinking Budget

Response