Przejdź do głównej zawartości

Ta przeglądarka nie jest już obsługiwana.

Przejdź na przeglądarkę Microsoft Edge, aby korzystać z najnowszych funkcji, aktualizacji zabezpieczeń i pomocy technicznej.

Pobieranie przeglądarki Microsoft Edge Więcej informacji o przeglądarkach Internet Explorer i Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Chat

Delete a chat completion

DELETE /openai/v1/chat/completions/{completion_id}

Deletes a chat completion by its identifier.

Parametry ścieżki

completion_id string wymagane

The ID of the chat completion to delete.

Odpowiedzi

The request has succeeded.

Treść

Content-Type: application/json
object enum wymagane

The type of object being deleted.

chat.completion.deleted
id string wymagane

The ID of the chat completion that was deleted.

deleted boolean wymagane

Whether the chat completion was deleted.

Client error

Treść

Content-Type: application/json
error OpenAI.Error wymagane
code string | null wymagane
message string wymagane
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Którekolwiek z poniższych:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string wymagane

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Treść

Content-Type: application/json
error OpenAI.Error wymagane
code string | null wymagane
message string wymagane
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Którekolwiek z poniższych:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string wymagane

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Żądanie

curl -X DELETE https://api.openai.com/v1/chat/completions/chat_abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
chat_completion_deleted = client.chat.completions.delete(
    "completion_id",
)
print(chat_completion_deleted.id)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const chatCompletionDeleted = await client.chat.completions.delete('completion_id');

console.log(chatCompletionDeleted.id);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    chatCompletionDeleted, err := client.Chat.Completions.Delete(context.TODO(), "completion_id")
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", chatCompletionDeleted.ID)
}
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");
    }
}
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

{
  "object": "chat.completion.deleted",
  "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2",
  "deleted": true
}
pl-pl
Wybrane przez Ciebie opcje dotyczące prywatności
  • Zastrzeżenie dotyczące sztucznej inteligencji
  • Poprzednie wersje
  • Blog
  • Współtworzenie
  • Prywatność
  • Prywatność kondycji konsumenta
  • Warunki użytkowania
  • Znaki towarowe
  • © Microsoft 2026