OpenAI
页面内容为机器翻译。查看英文原文

如何纳入安全标识符

更新于:8 days ago

OpenAI 安全最佳实践旨在限制滥用的可能性。

在请求中发送安全标识符,有助于 OpenAI 监控和检测滥用行为。这样,如果我们在您的应用中检测到任何违反政策的行为,OpenAI 就能为您的团队提供更具可操作性的反馈。

安全标识符应为可唯一标识每位用户的字符串。请对用户名或电子邮件地址进行哈希处理,以免向我们发送任何身份识别信息。如果您向未登录用户提供产品预览,也可以改为发送会话 ID。

安全标识符取代了此前出于相同目的而设置的 user 参数。

请使用 safety_identifier 参数,在 API 请求中加入安全标识符:

Python — Chat Completions API

from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
model="gpt-5-mini",
messages=[
{"role": "user", "content": "This is a test"}
],
safety_identifier="user_123456"
)

Python — Responses API

from openai import OpenAI
client = OpenAI()

response = client.responses.create(
model="gpt-5-mini",
input="This is a test",
safety_identifier="user_123456"
)

这篇文章对你有帮助吗?