メイン コンテンツにスキップ

このブラウザーはサポートされなくなりました。

Microsoft Edge にアップグレードすると、最新の機能、セキュリティ更新プログラム、およびテクニカル サポートを利用できます。

Microsoft Edge をダウンロードする Internet Explorer と 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.

パス パラメーター

completion_id string 必須

The ID of the chat completion to delete.

応答

The request has succeeded.

本文

Content-Type: application/json
object enum 必須

The type of object being deleted.

chat.completion.deleted
id string 必須

The ID of the chat completion that was deleted.

deleted boolean 必須

Whether the chat completion was deleted.

Client error

本文

Content-Type: application/json
error OpenAI.Error 必須
code string | null 必須
message string 必須
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
次のいずれか:
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 必須

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

本文

Content-Type: application/json
error OpenAI.Error 必須
code string | null 必須
message string 必須
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
次のいずれか:
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 必須

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

要求

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)

回答

{
  "object": "chat.completion.deleted",
  "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2",
  "deleted": true
}
ja-jp
プライバシーの選択
  • AI 免責事項
  • 以前のバージョン
  • ブログ
  • 投稿
  • プライバシー
  • コンシューマーの健康に関するプライバシー
  • 利用条件
  • 商標
  • © Microsoft 2026