v1

latestOpenAPI 3.0.02026-07-174565114.3 KB
threads

get/threads/{id}/messages

Path parameters

idstring required
Example:thr_123.456

Id of the thread to get messages for

Query parameters

includeInternalboolean

Whether to include internal messages, must be true

Response

parentMessageIdstring

The id of the parent message, if the message was created during the generation of another message, such as during an agent call, MCP Elicitation, or MCP Sample

metadataobject
reasoningstring[]

Reasoning text from the LLM, if the model supports it.

reasoningDurationMSnumber

Duration of reasoning in milliseconds

componentStateobject required
tool_call_idstring

The unique id of the tool call. This is filled in only if the tool call is a client-side tool call.

actionType'tool_call' | 'tool_response'

Deprecated: use the role and the presence of tool calls to determine the action type

errorstring
isCancelledboolean

Whether the message has been cancelled

additionalContextobject

Additional context to provide to the AI beyond the user query, such as the info about the current page the user is visiting.

idstring required
threadIdstring required
role'user' | 'assistant' | 'system' | 'tool' required
tool_callsobject[]
createdAtstring date-time required

Example response

[
  {
    "content": [
      {
        "resource": {
          "uri": "file:///path/to/document.pdf",
          "name": "project-documentation.pdf",
          "description": "Project documentation for Q4 2024",
          "mimeType": "application/pdf",
          "text": "The contents of the document...",
          "blob": "SGVsbG8gV29ybGQh"
        }
      }
    ]
  }
]