NAME

OpenAPI::Client::OpenAI::Path::chat-completions-completion_id-messages - Documentation for the /chat/completions/{completion_id}/messages path.

OPERATIONS

GET /chat/completions/{completion_id}/messages

getChatCompletionMessages

$client->get_chat_completion_messages({
    body => { ... },
});

Get the messages in a stored chat completion. Only Chat Completions that have been created with the store parameter set to true will be returned.

Path/query parameters

  • completion_id (in path, required, string) - The ID of the chat completion to retrieve messages from.

  • after (in query, optional, string) - Identifier for the last message from the previous pagination request.

  • limit (in query, optional, integer) - Number of messages to retrieve.

    Default: 20

  • order (in query, optional, string) - Sort order for messages by timestamp. Use asc for ascending order or desc for descending order. Defaults to asc .

    Allowed values: asc, desc

    Default: asc

Responses

200 - A list of messages

Content-Type: application/json

Example:

{
   "data" : [
      {
         "content" : "write a haiku about ai",
         "content_parts" : null,
         "id" : "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0",
         "name" : null,
         "role" : "user"
      }
   ],
   "first_id" : "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0",
   "has_more" : false,
   "last_id" : "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0",
   "object" : "list"
}

SCHEMAS

ChatCompletionMessageList

Properties:

  • data (array of object, required) - An array of chat completion message objects.

  • first_id (string, required) - The identifier of the first chat message in the data array.

  • has_more (boolean, required) - Indicates whether there are more chat messages available.

  • last_id (string, required) - The identifier of the last chat message in the data array.

  • object (string, required) - The type of this object. It is always set to "list".

    Allowed values: list

    Default: list

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.