Endpoint
Request Parameters
Message Format
Each message has arole and content:
Vision (multimodal)
Use a content array to include images or video:Audio understanding
Send audio to a model that supports audio input with anaudio_url content
part:
400. Place the audio part before the
text part for the best results.
Supported formats vary by provider. OpenAI audio models (e.g.
gpt-audio)
accept only wav and mp3; an unsupported format returns a 400. Gemini models
(e.g. gemini-3-1-pro-preview) additionally accept m4a, aac, ogg, and
flac.Files and documents (PDFs)
Attach a document to a message with afile content part. Pass the file inline
as a base64 data URL
in file.file_data:
file_data (a base64 data URL) or file_url. The
URL must be publicly accessible (and unexpired, if presigned). A document must be
24 MB or smaller; larger files return a 400. Place the document before the text
part for the best results.
Supported file types:
application/pdf. Requesting an unsupported file type
returns a 400 error. Referencing files by OpenAI file_id is not supported.
Inline the file with file_data or pass file_url.Examples
Basic text generation
Response
Analyze a PDF
Understand audio
data: URL:
Python
Streaming
delta instead of a full message:
Tool calling
finish_reason is "tool_calls":