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

Delete chat completion

ChatCompletionDeleted chat().completions().delete(ChatCompletionDeleteParamsparams = ChatCompletionDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
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.

ParametersExpand Collapse
ChatCompletionDeleteParams params
Optional<String> completionId
ReturnsExpand Collapse
class ChatCompletionDeleted:
String id

The ID of the chat completion that was deleted.

boolean deleted

Whether the chat completion was deleted.

JsonValue; object_ "chat.completion.deleted"constant"chat.completion.deleted"constant

The type of object being deleted.

Delete chat completion

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.chat.completions.ChatCompletionDeleteParams;
import com.openai.models.chat.completions.ChatCompletionDeleted;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        ChatCompletionDeleted chatCompletionDeleted = client.chat().completions().delete("completion_id");
    }
}
{
  "object": "chat.completion.deleted",
  "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2",
  "deleted": true
}
Returns Examples
{
  "object": "chat.completion.deleted",
  "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2",
  "deleted": true
}