Skip to content

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");
    }
}
{
  "id": "id",
  "deleted": true,
  "object": "chat.completion.deleted"
}
Returns Examples
{
  "id": "id",
  "deleted": true,
  "object": "chat.completion.deleted"
}