SPB Git

Repository Public

safety-checks.md 9.2 KB 277 lines markdown

1# Safety classifiers23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45With the introduction of [GPT-5](https://developers.openai.com/api/docs/models/gpt-5), we added some checks to find and halt hazardous information from being accessed. It's likely some users will eventually try to use your application for things outside of OpenAI’s policies, especially in applications with a wide range of use cases.67## The safety classifier process891. We classify requests to GPT-5 into risk thresholds.101. If your org hits high thresholds repeatedly, OpenAI returns an error and sends a warning email.111. If the requests continue past the stated time threshold (usually seven days), we stop your org's access to GPT-5. Requests will no longer work.1213## How to avoid errors, latency, and bans1415If your org engages in suspicious activity that violates our safety policies, we may return an error, limit model access, or even block your account. The following safety measures help us identify where high-risk requests are coming from and block individual end users, rather than blocking your entire org.1617- [Implement safety identifiers](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers) for products where individual users interact with a model. Safety identifiers are recommended but not required.18- If your use case depends on accessing a less restricted version of our services in order to engage in beneficial applications across the life sciences, read about our [special access program](https://help.openai.com/en/articles/11826767-life-science-research-special-access-program) to see if you meet criteria.1920## Implementing safety identifiers for individual users2122The `safety_identifier` parameter is available in both the [Responses API](https://developers.openai.com/api/reference/resources/responses/methods/create) and older [Chat Completions API](https://developers.openai.com/api/reference/resources/chat). The Realtime API supports the same concept through the `OpenAI-Safety-Identifier` header. To use safety identifiers, provide a stable ID for your end user on each request. Hash user email or internal user IDs to avoid passing any personal information.2324Safety identifiers do not carry over between APIs or sessions. If your application already sends `safety_identifier` with Responses API requests, pass the same stable value separately when you create or connect each Realtime session.25262728Responses API2930    Providing a safety identifier with the Responses API3132```javascript33import OpenAI from "openai";3435const client = new OpenAI();3637const response = await client.responses.create({38  model: "gpt-5.6-terra",39  input: "This is a test",40  safety_identifier: "user_123456",41});4243console.log(response.output_text);44```4546```python47from openai import OpenAI4849client = OpenAI()5051response = client.responses.create(52    model="gpt-5.6-terra",53    input="This is a test",54    safety_identifier="user_123456",55)56```5758```go59package main6061import (62	"context"63	"fmt"6465	"github.com/openai/openai-go/v3"66	"github.com/openai/openai-go/v3/responses"67)6869func main() {70	client := openai.NewClient()71	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{72		Model:            "gpt-5.6-terra",73		Input:            responses.ResponseNewParamsInputUnion{OfString: openai.String("This is a test")},74		SafetyIdentifier: openai.String("user_123456"),75	})76	if err != nil {77		panic(err)78	}79	fmt.Println(response.OutputText())80}81```8283```java84import com.openai.client.OpenAIClient;85import com.openai.client.okhttp.OpenAIOkHttpClient;86import com.openai.models.responses.ResponseCreateParams;8788ResponseCreateParams params =89    ResponseCreateParams.builder()90        .model("gpt-5.6-terra")91        .input("Help me plan a study schedule.")92        .safetyIdentifier("user_1234")93        .build();9495client.responses().create(params).output().stream()96    .flatMap(item -> item.message().stream())97    .flatMap(message -> message.content().stream())98    .flatMap(content -> content.outputText().stream())99    .forEach(text -> System.out.println(text.text()));100```101102```ruby103require "openai"104105client = OpenAI::Client.new106response = client.responses.create(107  model: "gpt-5.6-terra",108  input: "Help me plan a study schedule.",109  safety_identifier: "user_1234"110)111112puts(response.output_text)113```114115```bash116curl https://api.openai.com/v1/responses \117-H "Content-Type: application/json" \118-H "Authorization: Bearer $OPENAI_API_KEY" \119-d '{120"model": "gpt-5.6-terra",121"input": "This is a test",122"safety_identifier": "user_123456"123}'124```125126  127128  129130    131Chat Completions API132133    Providing a safety identifier with the Chat Completions API134135```javascript136import OpenAI from "openai";137138const client = new OpenAI();139140const response = await client.chat.completions.create({141  model: "gpt-5.6-terra",142  messages: [{ role: "user", content: "This is a test" }],143  safety_identifier: "user_123456",144});145146console.log(response.choices[0].message.content);147```148149```python150from openai import OpenAI151152client = OpenAI()153154response = client.chat.completions.create(155    model="gpt-5.6-terra",156    messages=[{"role": "user", "content": "This is a test"}],157    safety_identifier="user_123456",158)159```160161```go162package main163164import (165	"context"166	"fmt"167168	"github.com/openai/openai-go/v3"169)170171func main() {172	client := openai.NewClient()173	response, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{174		Model:            "gpt-5.6-terra",175		Messages:         []openai.ChatCompletionMessageParamUnion{openai.UserMessage("This is a test")},176		SafetyIdentifier: openai.String("user_123456"),177	})178	if err != nil {179		panic(err)180	}181	fmt.Println(response.Choices[0].Message.Content)182}183```184185```java186import com.openai.client.OpenAIClient;187import com.openai.client.okhttp.OpenAIOkHttpClient;188import com.openai.models.chat.completions.ChatCompletionCreateParams;189190ChatCompletionCreateParams params =191    ChatCompletionCreateParams.builder()192        .model("gpt-5.6-terra")193        .addUserMessage("Help me plan a study schedule.")194        .safetyIdentifier("user_1234")195        .build();196197client.chat().completions().create(params).choices().stream()198    .flatMap(choice -> choice.message().content().stream())199    .forEach(System.out::println);200```201202```ruby203require "openai"204205client = OpenAI::Client.new206completion = client.chat.completions.create(207  model: "gpt-5.6-terra",208  messages: [209    {210      role: :user,211      content: "Help me plan a study schedule."212    }213  ],214  safety_identifier: "user_1234"215)216217puts(completion.choices.fetch(0).message.content)218```219220```bash221curl https://api.openai.com/v1/chat/completions \222-H "Content-Type: application/json" \223-H "Authorization: Bearer $OPENAI_API_KEY" \224-d '{225"model": "gpt-5.6-terra",226"messages": [227{"role": "user", "content": "This is a test"}228],229"safety_identifier": "user_123456"230}'231```232233  234235  236237    238Realtime API239240    Providing a safety identifier with the Realtime API241242```bash243curl https://api.openai.com/v1/realtime/client_secrets \244-H "Content-Type: application/json" \245-H "Authorization: Bearer $OPENAI_API_KEY" \246-H "OpenAI-Safety-Identifier: user_123456" \247-d '{248"session": {249"type": "realtime",250"model": "gpt-realtime-2.1"251}252}'253```254255256257## Potential consequences258259If OpenAI monitoring systems identify potential abuse, we may take different levels of action:260261- **Delayed streaming responses**262  - As an initial, lower-consequence intervention for a user potentially violating policies, OpenAI may delay streaming responses while running additional checks before returning the full response to that user.263  - If the check passes, streaming begins. If the check fails, the request stops—no tokens show up, and the streamed response does not begin.264  - For a better end user experience, consider adding a loading spinner for cases where streaming is delayed.265- **Blocked model access for individual users**266  - In a high confidence policy violation, the associated `safety_identifier` is completely blocked from OpenAI model access.267  - The safety identifier receives an `identifier blocked` error on all future GPT-5 requests for the same identifier. OpenAI cannot currently unblock an individual identifier.268269For these blocks to be effective, ensure you have controls in place to prevent blocked users from opening a new account. As a reminder, repeated policy violations from your organization can lead to losing access for your entire organization.270271## Why we're doing this272273The specific enforcement criteria may change based on evolving real-world usage or new model releases. Currently, OpenAI may restrict or block access for safety identifiers with risky or suspicious biology or chemical activity. See the [blog post](https://openai.com/index/preparing-for-future-ai-capabilities-in-biology/) for more information about how we’re approaching higher AI capabilities in biology.274275## Other types of safety checks276277For safeguards specific to tools and model customization, see [computer use confirmation and consent](https://developers.openai.com/api/docs/guides/tools-computer-use#handle-user-confirmation-and-consent) and [fine-tuning safety](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#safety-checks). OpenAI also publishes results in the [model evaluations hub](https://openai.com/safety/evaluations-hub).
Files main
Menu

Theme