Skip to main content

The message object

Roles

Content

A plain string:
Or an array of parts. The part kinds are text, image_url, and file (or input_file).

Text part

Image part

The model must support image inputs.

File part

Files are parsed request-locally to text before the model sees them (text, PDF, DOCX, PPTX, XLSX, XLS). Supply file_data with filename, nested under file, or at the top level of an input_file part. The model receives text, so documents work with any chat model. file_id is rejected; there is no Files API.

Rejected part kinds

Tool Pairing

An assistant message that requests tools carries tool_calls. Each result goes back as a tool message whose tool_call_id matches. See Tool calling.