NAME
OpenAPI::Client::OpenAI::Path::chat-completions-completion_id - Documentation for the /chat/completions/{completion_id} path.
OPERATIONS
DELETE /chat/completions/{completion_id}
deleteChatCompletion
$client->delete_chat_completion({
body => { ... },
});
Delete a stored chat completion. Only Chat Completions that have been created with the store parameter set to true can be deleted.
Path/query parameters
completion_id(in path, required, string) - The ID of the chat completion to delete.
Responses
200 - The chat completion was deleted successfully.
Content-Type: application/json
Example:
{
"deleted" : false,
"id" : "string",
"object" : "chat.completion.deleted"
}
GET /chat/completions/{completion_id}
getChatCompletion
$client->get_chat_completion({
body => { ... },
});
Get 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.
Responses
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
}
}
POST /chat/completions/{completion_id}
updateChatCompletion
$client->update_chat_completion({
body => { ... },
});
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.
Path/query parameters
completion_id(in path, required, string) - The ID of the chat completion to update.
Request body
Content-Type: application/json
Properties:
metadata(Metadata, required)See "Metadata" below for shape.
Example:
{
"metadata" : {}
}
Responses
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
}
}
SCHEMAS
ChatCompletionDeleted
Properties:
deleted(boolean, required) - Whether the chat completion was deleted.id(string, required) - The ID of the chat completion that was deleted.object(string, required) - The type of object being deleted.Allowed values: chat.completion.deleted
CompletionUsage
Properties:
completion_tokens(integer, required) - Number of tokens in the generated completion.Default: 0
completion_tokens_details(object) - Breakdown of tokens used in a completion.prompt_tokens(integer, required) - Number of tokens in the prompt.Default: 0
prompt_tokens_details(object) - Breakdown of tokens used in the prompt.total_tokens(integer, required) - Total number of tokens used in the request (prompt + completion).Default: 0
CreateChatCompletionResponse
Properties:
choices(array of object, required) - A list of chat completion choices. Can be more than one ifnis greater than 1.created(integer, required) - The Unix timestamp (in seconds) of when the chat completion was created.id(string, required) - A unique identifier for the chat completion.model(string, required) - The model used for the chat completion.object(string, required) - The object type, which is alwayschat.completion.Allowed values: chat.completion
service_tier(ServiceTier)See "ServiceTier" below for shape.
system_fingerprint(string) - This fingerprint represents the backend configuration that the model runs with.Can be used in conjunction with the
seedrequest parameter to understand when backend changes have been made that might impact determinism.usage(CompletionUsage)See "CompletionUsage" below for shape.
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.
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 'flex' or 'priority', then the request will be processed with the corresponding service tier. - When not set, the default behavior is 'auto'.
When the service_tier parameter is set, the response body will include the 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.
SEE ALSO
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.