在推出 GPT-5 时,我们新增了安全检查,用于识别危险信息并阻止用户获取这些信息。随着时间推移,一些用户很可能会尝试将您的应用用于违反 OpenAI 政策的活动,尤其是当应用支持多种用途时。
我们根据风险阈值对发往 GPT-5 的请求进行分级。
如果您的组织发出的请求多次达到高风险阈值,OpenAI 会返回错误并发送警告邮件。
如果指定期限(通常为七天)过后,您的组织仍在发送此类请求,我们会停止该组织对 GPT-5 的访问。届时,该组织发往 GPT-5 的请求都会失败。
如果您的组织存在违反我们安全政策的可疑活动,我们可能会返回错误、限制模型访问权限,甚至封禁您的账号。以下安全措施有助于我们确定高风险请求的来源,从而只封禁相关终端用户,避免封禁整个组织。
如果用户会在您的产品中直接与模型交互,建议为每位用户实施安全标识符 。这并非强制要求。
如果您在生命科学领域开展有益的应用项目,需要使用限制较少的服务版本,请查阅我们的特别访问计划 ,了解您是否符合条件。
如需将针对某个安全标识符的警告和停用通知转入您的调查或支持流程,请参阅安全政策执行通知 。
您可以在以下 API 的请求中使用 safety_identifier 参数:Responses API 、Chat Completions API 和 Images API 。Realtime API 通过 OpenAI-Safety-Identifier 请求头支持相同的功能。要使用安全标识符,请在每次请求中为同一终端用户提供稳定一致的 ID。请对用户的电子邮箱地址或内部用户 ID 进行哈希处理,以免传递任何个人信息。
安全标识符不会在不同 API 或会话之间自动传递。如果您的应用已在 Responses API 请求中发送 safety_identifier,还需在每次 Images API 请求中,以及每次创建或连接 Realtime 会话时,分别传入同一个稳定值。
使用 Images API 时,请在每次图像生成或编辑请求中传入 safety_identifier。标识符的长度不得超过 128 个字符。请参阅图像安全标识符 ,了解如何从已弃用的 user 参数迁移。
Responses API Chat Completions API Realtime API Responses API
1
2
3
4
5
6
7
8
9
10
11 import OpenAI from "openai" ;
const client = new OpenAI ();
const response = await client.responses. create ({
model: "gpt-6.1-terra" ,
input: "This is a test" ,
safety_identifier: "user_123456" ,
});
console. log (response.output_text); 1
2
3
4
5
6
7
8
9 from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-6.1-terra",
input="This is a test",
safety_identifier="user_123456",
) 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-6.1-terra",
Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("This is a test")},
SafetyIdentifier: openai.String("user_123456"),
})
if err != nil {
panic(err)
}
fmt.Println(response.OutputText())
} 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.ResponseCreateParams;
ResponseCreateParams params =
ResponseCreateParams.builder()
.model("gpt-6.1-terra")
.input("Help me plan a study schedule.")
.safetyIdentifier("user_1234")
.build();
client.responses().create(params).output().stream()
.flatMap(item -> item.message().stream())
.flatMap(message -> message.content().stream())
.flatMap(content -> content.outputText().stream())
.forEach(text -> System.out.println(text.text())); 1
2
3
4
5
6
7
8
9
10 require "openai"
client = OpenAI::Client.new
response = client.responses.create(
model: "gpt-6.1-terra",
input: "Help me plan a study schedule.",
safety_identifier: "user_1234"
)
puts(response.output_text) 1
2
3
4
5
6
7
8 curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-6.1-terra",
"input": "This is a test",
"safety_identifier": "user_123456"
}' Chat Completions API
1
2
3
4
5
6
7
8
9
10
11 import OpenAI from "openai" ;
const client = new OpenAI ();
const response = await client.chat.completions. create ({
model: "gpt-6.1-terra" ,
messages: [{ role: "user" , content: "This is a test" }],
safety_identifier: "user_123456" ,
});
console. log (response.choices[ 0 ].message.content); 1
2
3
4
5
6
7
8
9 from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-6.1-terra",
messages=[{"role": "user", "content": "This is a test"}],
safety_identifier="user_123456",
) 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package main
import (
"context"
"fmt"
"github.com/openai/openai-go/v3"
)
func main() {
client := openai.NewClient()
response, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: "gpt-6.1-terra",
Messages: []openai.ChatCompletionMessageParamUnion{openai.UserMessage("This is a test")},
SafetyIdentifier: openai.String("user_123456"),
})
if err != nil {
panic(err)
}
fmt.Println(response.Choices[0].Message.Content)
} 1
2
3
4
5
6
7
8
9
10
11
12
13
14 import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.chat.completions.ChatCompletionCreateParams;
ChatCompletionCreateParams params =
ChatCompletionCreateParams.builder()
.model("gpt-6.1-terra")
.addUserMessage("Help me plan a study schedule.")
.safetyIdentifier("user_1234")
.build();
client.chat().completions().create(params).choices().stream()
.flatMap(choice -> choice.message().content().stream())
.forEach(System.out::println); 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 require "openai"
client = OpenAI::Client.new
completion = client.chat.completions.create(
model: "gpt-6.1-terra",
messages: [
{
role: :user,
content: "Help me plan a study schedule."
}
],
safety_identifier: "user_1234"
)
puts(completion.choices.fetch(0).message.content) 1
2
3
4
5
6
7
8
9
10 curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-6.1-terra",
"messages": [
{"role": "user", "content": "This is a test"}
],
"safety_identifier": "user_123456"
}' Realtime API
1
2
3
4
5
6
7
8
9
10 curl https://api.openai.com/v1/realtime/client_secrets \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY " \
-H "OpenAI-Safety-Identifier: user_123456" \
-d '{
"session": {
"type": "realtime",
"model": "gpt-realtime-2.1"
}
}'
如果 OpenAI 的监控系统发现潜在滥用行为,我们可能会视情况采取不同程度的措施:
延迟流式响应
对于可能违反政策的用户,OpenAI 起初可能会采取影响较小的措施,暂缓流式响应,在向该用户返回完整响应前执行额外检查。
如果检查通过,流式响应就会开始。如果检查未通过,请求将终止,用户看不到任何 Token,流式响应也不会开始。
为改善终端用户体验,您可以考虑在流式响应延迟时显示加载动画。
禁止个别用户访问模型
如果 OpenAI 有充分把握判定用户违反了政策,就会彻底禁止通过相关 safety_identifier 访问 OpenAI 模型。
此后,所有使用该标识符的 GPT-5 请求都会收到 identifier blocked 错误。OpenAI 目前无法为单个标识符解除封禁。
为使这些封禁措施有效,请确保您的应用采取了相应措施,防止被封禁的用户注册新账号。请注意,如果您的组织多次违反政策,整个组织都可能失去访问权限。
随着实际使用情况的变化或新模型的发布,具体的执行标准可能会调整。目前,如果某个安全标识符关联的生物或化学活动存在风险或可疑之处,OpenAI 可能会限制或禁止通过该标识符访问模型。请参阅这篇博文 ,了解我们如何应对 AI 在生物学领域不断提升的能力。
有关工具和模型定制的专门防护措施,请参阅计算机使用中的用户确认与同意 和微调安全检查 。OpenAI 也会在模型评估中心 发布评估结果。