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

cache_control is optional and forwarded to the provider when supported.

Image part

The model must support image inputs. URL attachments must be https, carry no credentials, and must not point at private or loopback hosts.

File part

Files are parsed request-locally to text before the model sees them (text, PDF, DOCX, PPTX, XLSX, XLS). Supply file_url or file_data with filename, nested under file, or at the top level of an input_file part. 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.