NAME

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

DESCRIPTION

This document describes the API endpoint at /chat/completions/{completion_id}/messages.

PATHS

GET /chat/completions/{completion_id}/messages

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.

Operation ID

getChatCompletionMessages

$client->getChatCompletionMessages( ... );

Parameters

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

    Type: string

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

    Type: string

  • limit (in query) (Optional) - Number of messages to retrieve.

    Type: integer

    Default: 20

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

    Type: string

    Allowed values: asc, desc

    Default: asc

Responses

Status Code: 200

A list of messages

Content Types:

  • application/json

    Example (See the OpenAI spec for more detail):

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

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2025 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.