NAME

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

DESCRIPTION

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

PATHS

DELETE /chat/completions/{completion_id}

Delete a stored chat completion. Only Chat Completions that have been created with the store parameter set to true can be deleted.

Operation ID

deleteChatCompletion

$client->deleteChatCompletion( ... );

Parameters

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

    Type: string

Responses

Status Code: 200

The chat completion was deleted successfully.

Content Types:

GET /chat/completions/{completion_id}

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

Operation ID

getChatCompletion

$client->getChatCompletion( ... );

Parameters

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

    Type: string

Responses

Status Code: 200

A chat completion

Content Types:

  • application/json

    Example (See the OpenAI spec for more detail):

    {
      "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG",
      "object": "chat.completion",
      "created": 1741570283,
      "model": "gpt-4o-2024-08-06",
      "choices": [
        {
          "index": 0,
          "message": {
            "role": "assistant",
            "content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.",
            "refusal": null,
            "annotations": []
          },
          "logprobs": null,
          "finish_reason": "stop"
        }
      ],
      "usage": {
        "prompt_tokens": 1117,
        "completion_tokens": 46,
        "total_tokens": 1163,
        "prompt_tokens_details": {
          "cached_tokens": 0,
          "audio_tokens": 0
        },
        "completion_tokens_details": {
          "reasoning_tokens": 0,
          "audio_tokens": 0,
          "accepted_prediction_tokens": 0,
          "rejected_prediction_tokens": 0
        }
      },
      "service_tier": "default",
      "system_fingerprint": "fp_fc9f1d7035"
    }

POST /chat/completions/{completion_id}

Modify a stored chat completion. Only Chat Completions that have been created with the store parameter set to true can be modified. Currently, the only supported modification is to update the metadata field.

Operation ID

updateChatCompletion

$client->updateChatCompletion( ... );

Parameters

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

    Type: string

Request Body

Content Type: application/json

Responses

Status Code: 200

A chat completion

Content Types:

  • application/json

    Example (See the OpenAI spec for more detail):

    {
      "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG",
      "object": "chat.completion",
      "created": 1741570283,
      "model": "gpt-4o-2024-08-06",
      "choices": [
        {
          "index": 0,
          "message": {
            "role": "assistant",
            "content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.",
            "refusal": null,
            "annotations": []
          },
          "logprobs": null,
          "finish_reason": "stop"
        }
      ],
      "usage": {
        "prompt_tokens": 1117,
        "completion_tokens": 46,
        "total_tokens": 1163,
        "prompt_tokens_details": {
          "cached_tokens": 0,
          "audio_tokens": 0
        },
        "completion_tokens_details": {
          "reasoning_tokens": 0,
          "audio_tokens": 0,
          "accepted_prediction_tokens": 0,
          "rejected_prediction_tokens": 0
        }
      },
      "service_tier": "default",
      "system_fingerprint": "fp_fc9f1d7035"
    }

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.