Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Delete chat completion

chat.completions.delete(completion_id) -> ChatCompletionDeleted { id, deleted, object }
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.

Parameters
completion_id: String
Returns
class ChatCompletionDeleted { id, deleted, object }
id: String

The ID of the chat completion that was deleted.

deleted: bool

Whether the chat completion was deleted.

object: :"chat.completion.deleted"

The type of object being deleted.

Delete chat completion

require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

chat_completion_deleted = openai.chat.completions.delete("completion_id")

puts(chat_completion_deleted)
Response example
{
  "object": "chat.completion.deleted",
  "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2",
  "deleted": true
}
Returns Examples
Response example
{
  "object": "chat.completion.deleted",
  "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2",
  "deleted": true
}