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"
)