OpenAI 获取项目安全警报

2026-11-11 09:54 更新

获取项目安全警报

get /safety/alerts/{id}

获取属于当前通过身份验证的 API 项目的安全警报。

路径参数

  • id: string

项目安全警报 ID。

maxLength: 38

返回值

  • SafetyAlert object { id, created_at, error_type, 7 more }

  • id: string

  • created_at: integer

format: unixtime

  • error_type: "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"

  • "potentially_unintended_data_transfer"

  • "potentially_unintended_data_access"

  • "potentially_unintended_destructive_activity"

  • "other"

  • model: string

  • object: "safety.alert" (default: "safety.alert")

  • "safety.alert"

  • reason: string or null

根据 error_type 生成的、适合向客户展示的描述。零数据保留请求中为 null。

  • request_id: string

  • request_paused: boolean

表示是否成功为该请求登记阻止操作。此字段不确认响应执行是否已经停止。

  • response_id: string

  • detailed_explanation: optional string or null

生成的解释,仅对符合条件的零数据保留警报临时提供。不可用时省略此字段。

请求示例

## 先设置 OPENAI_API_KEY,并替换文件路径或资源 ID 后再运行。
curl https://api.openai.com/v1/safety/alerts/$ID \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "id": "id",
  "created_at": 0,
  "error_type": "potentially_unintended_data_transfer",
  "model": "model",
  "object": "safety.alert",
  "reason": "reason",
  "request_id": "request_id",
  "request_paused": true,
  "response_id": "response_id",
  "detailed_explanation": "detailed_explanation"
}

请求示例

## 先设置 OPENAI_API_KEY,并替换文件路径或资源 ID 后再运行。
curl https://api.openai.com/v1/safety/alerts/alert_0123456789abcdef0123456789abcdef \
  -H "Authorization: Bearer $OPENAI_API_KEY"

响应示例

{
  "id": "alert_0123456789abcdef0123456789abcdef",
  "object": "safety.alert",
  "created_at": 1787659200,
  "request_id": "req_123",
  "response_id": "resp_123",
  "model": "gpt-6-astra",
  "request_paused": true,
  "error_type": "potentially_unintended_data_access",
  "reason": "Potentially unintended data access."
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号