=encoding utf8

=head1 NAME

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

=head1 OPERATIONS

=head2 DELETE /chat/completions/{completion_id}

=head3 deleteChatCompletion

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

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

=head4 Path/query parameters

=over

=item * C<completion_id> (in path, required, string) - The ID of the chat completion to delete.

=back

=head4 Responses

B<200 - The chat completion was deleted successfully.>

Content-Type: application/json

Example:

    {
       "deleted" : false,
       "id" : "string",
       "object" : "chat.completion.deleted"
    }

=head2 GET /chat/completions/{completion_id}

=head3 getChatCompletion

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

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

=head4 Path/query parameters

=over

=item * C<completion_id> (in path, required, string) - The ID of the chat completion to retrieve.

=back

=head4 Responses

B<200 - A chat completion>

Content-Type: application/json

Example:

    {
       "choices" : [
          {
             "finish_reason" : "stop",
             "index" : 0,
             "logprobs" : null,
             "message" : {
                "annotations" : [],
                "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,
                "role" : "assistant"
             }
          }
       ],
       "created" : 1741570283,
       "id" : "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG",
       "model" : "gpt-4o-2024-08-06",
       "object" : "chat.completion",
       "service_tier" : "default",
       "system_fingerprint" : "fp_fc9f1d7035",
       "usage" : {
          "completion_tokens" : 46,
          "completion_tokens_details" : {
             "accepted_prediction_tokens" : 0,
             "audio_tokens" : 0,
             "reasoning_tokens" : 0,
             "rejected_prediction_tokens" : 0
          },
          "prompt_tokens" : 1117,
          "prompt_tokens_details" : {
             "audio_tokens" : 0,
             "cached_tokens" : 0
          },
          "total_tokens" : 1163
       }
    }

=head2 POST /chat/completions/{completion_id}

=head3 updateChatCompletion

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

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

=head4 Path/query parameters

=over

=item * C<completion_id> (in path, required, string) - The ID of the chat completion to update.

=back

=head4 Request body

Content-Type: application/json

Properties:

=over

=item * C<metadata> (Metadata, required)

See L</Metadata> below for shape.

=back

Example:

    {
       "metadata" : {}
    }

=head4 Responses

B<200 - A chat completion>

Content-Type: application/json

Example:

    {
       "choices" : [
          {
             "finish_reason" : "stop",
             "index" : 0,
             "logprobs" : null,
             "message" : {
                "annotations" : [],
                "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,
                "role" : "assistant"
             }
          }
       ],
       "created" : 1741570283,
       "id" : "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG",
       "model" : "gpt-4o-2024-08-06",
       "object" : "chat.completion",
       "service_tier" : "default",
       "system_fingerprint" : "fp_fc9f1d7035",
       "usage" : {
          "completion_tokens" : 46,
          "completion_tokens_details" : {
             "accepted_prediction_tokens" : 0,
             "audio_tokens" : 0,
             "reasoning_tokens" : 0,
             "rejected_prediction_tokens" : 0
          },
          "prompt_tokens" : 1117,
          "prompt_tokens_details" : {
             "audio_tokens" : 0,
             "cached_tokens" : 0
          },
          "total_tokens" : 1163
       }
    }

=head1 SCHEMAS

=head2 ChatCompletionDeleted

Properties:

=over

=item * C<deleted> (boolean, required) - Whether the chat completion was deleted.

=item * C<id> (string, required) - The ID of the chat completion that was deleted.

=item * C<object> (string, required) - The type of object being deleted.

Allowed values: chat.completion.deleted

=back

=head2 CompletionUsage

Properties:

=over

=item * C<completion_tokens> (integer, required) - Number of tokens in the generated completion.

Default: 0

=item * C<completion_tokens_details> (object) - Breakdown of tokens used in a completion.

=item * C<prompt_tokens> (integer, required) - Number of tokens in the prompt.

Default: 0

=item * C<prompt_tokens_details> (object) - Breakdown of tokens used in the prompt.

=item * C<total_tokens> (integer, required) - Total number of tokens used in the request (prompt + completion).

Default: 0

=back

=head2 CreateChatCompletionResponse

Properties:

=over

=item * C<choices> (array of object, required) - A list of chat completion choices. Can be more than one if C<n> is greater
than 1.

=item * C<created> (integer, required) - The Unix timestamp (in seconds) of when the chat completion was created.

=item * C<id> (string, required) - A unique identifier for the chat completion.

=item * C<model> (string, required) - The model used for the chat completion.

=item * C<object> (string, required) - The object type, which is always C<chat.completion> .

Allowed values: chat.completion

=item * C<service_tier> (ServiceTier)

See L</ServiceTier> below for shape.

=item * C<system_fingerprint> (string) - This fingerprint represents the backend configuration that the model runs
with.

Can be used in conjunction with the C<seed> request parameter to understand
when backend changes have been made that might impact determinism.

=item * C<usage> (CompletionUsage)

See L</CompletionUsage> below for shape.

=back

=head2 Metadata

Set of 16 key-value pairs that can be attached to an object. This can be
useful for storing additional information about the object in a structured
format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings
with a maximum length of 512 characters.

=head2 ServiceTier

Specifies the processing type used for serving the request. - If set to
'auto', then the request will be processed with the service tier configured in
the Project settings. Unless otherwise configured, the Project will use
'default'. - If set to 'default', then the request will be processed with the
standard pricing and performance for the selected model. - If set to
'L<flex|https://platform.openai.com/docs/guides/flex-processing>' or
'L<priority|https://openai.com/api-priority-processing/>', then the request
will be processed with the corresponding service tier. - When not set, the
default behavior is 'auto'.

When the C<service_tier> parameter is set, the response body will include the
C<service_tier> value based on the processing mode actually used to serve the
request. This response value may be different from the value set in the
parameter.

=head1 SEE ALSO

L<OpenAPI::Client::OpenAI::Path>

=head1 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.

=cut
