Use Gemini models via OpenAI format with multi-file support
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
Extension
MIME Type
.pdf
application/pdf
.mp3
audio/mp3
.mp4
video/mp4
.wav
audio/wav
.png
image/png
.jpg / .jpeg
image/jpeg
.txt
text/plain
.mov
video/mov
.mpeg
video/mpeg
.mpg
video/mpg
.avi
video/avi
.wmv
video/wmv
.flv
video/flv
Request
Headers
Header
Required
Description
Content-Type
Yes
application/json
Authorization
Yes
Bearer sk-xxx
Request Body
Parameter
Type
Required
Description
model
string
Yes
Gemini model name
messages
array
Yes
Array of message objects
messages[].role
string
Yes
Role: user or assistant
messages[].content
string/array
Yes
Text or multimodal content
max_tokens
number
No
Maximum tokens to generate
temperature
number
No
Sampling temperature
stream
boolean
No
Enable streaming
tools
array
No
Function calling tools
reasoning_effort
string
No
Thinking level: high, medium, low
extra_body
object
No
Advanced config (thinking_config)
response_format
object
No
Structured output config
Content Types for File Analysis
Type
Fields
Description
text
text
Text prompt
file
file.filename, file.file_data
File (base64 or URL)
file_url
file_url.url
File URL (supports images and files)
image_url
image_url.url
Image URL (base64 or web URL)
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.
Web Search
Enable web search by either:
Adding -search suffix to model name (e.g. gemini-3.8-flash-search)