Skip to content
Last updated

Represents a message input to the model with role-based instruction hierarchy.

Properties

role string required

The role of the message input. One of user, system, or assistant.

content string | array required

The message content. Can be provided as:

  • String — Simple text content (convenience format)
  • Array of content blocks — Structured content with text and/or file references
Show content block structure

Each content block:

type string required

Content type: text or file.

text string optional

Text content. Required when type is text.

file_id string optional

File ID reference (file_ prefix). Required when type is file.

files array optional

Array of file references for context retrieval. Upload files first via the Files API, then reference them here. The system retrieves relevant content from each file and injects it into the conversation context. Images are sent as visual input to vision-capable models. Maximum 10 files per message.

Show structure

Each file reference:

file_id string required

ID of an uploaded file (e.g., file_abc123def456...).

id string optional

The unique ID of the input message. Populated when items are returned via API.

Usage

This object is used in:

{
  "role": "user",
  "content": "What is the capital of France?"
}