# User guide for gpt-oss-safeguard
## Introduction & Overview
ROOST and OpenAI have prepared a guide that explains how to write policy prompts that maximize [gpt-oss-safeguard's](https://github.com/openai/gpt-oss-safeguard) reasoning power, choose the right policy length for deep analysis, and integrate oss-safeguard's reasoning outputs into production Trust & Safety systems.
### What is gpt-oss-safeguard?
gpt-oss-safeguard is a first open weight reasoning model specifically trained for safety classification tasks to help classify text content based on customizable policies. As a fine-tuned version of [gpt-oss](https://openai.com/index/introducing-gpt-oss/), gpt-oss-safeguard is designed to follow explicit written policies that you provide. This enables **bring-your-own-policy** Trust & Safety AI, where your own taxonomy, definitions, and thresholds guide classification decisions. Well crafted policies unlock gpt-oss-safeguard's reasoning capabilities, enabling it to handle nuanced content, explain borderline decisions, and adapt to contextual factors.
You can read more about how OpenAI uses the internal version of gpt-oss-safeguard [here](https://openai.com/index/introducing-gpt-oss-safeguard/).
Large language models can be considered safety models in two main ways:
- Fine-tuned safety models start as general reasoning models (like gpt-oss) and are trained to respond safely within user interactions.
- Prebaked safety models (like ShieldGemma, LlamaGuard, RoGuard, etc) come with built-in definitions of what counts as “unsafe” and fixed policy taxonomies.
gpt-oss-safeguard was purpose-built for Trust & Safety workflows and is a policy-following model that can reliably interpret and enforce **your own written standards and tell you why it made the decision it made**. The reasoning behind the model makes it well-suited for integration with a larger safety system that is rooted in auditability and customization.
### How to Use gpt-oss-safeguard
Like the [gpt-oss family of models](https://openai.com/open-models/), this is an open source model with open weights that you run locally or integrate into your own infrastructure. It is designed to work with the [harmony response format](https://github.com/openai/harmony). Harmony is the structured prompt interface that gives gpt-oss-safeguard access to its full reasoning stack and ensures consistent, well-formed outputs.
The gpt-oss family of models, including gpt-oss-safeguard, can be run on servers using:
- [vLLM](https://docs.vllm.ai/projects/recipes/en/latest/OpenAI/GPT-OSS.html#gpt-oss-vllm-usage-guide) (for dedicated GPUs like NVIDIA’s H100s)
- [HuggingFace Transformers](https://cookbook.openai.com/articles/gpt-oss/run-locally-lmstudio) (for consumer GPUs)
- [Google Colab](https://cookbook.openai.com/articles/gpt-oss/run-colab)
And locally using:
- [LM Studio](https://cookbook.openai.com/articles/gpt-oss/run-locally-lmstudio)
- [Ollama](https://cookbook.openai.com/articles/gpt-oss/run-locally-ollama)
### Who Should Use gpt-oss-safeguard?
gpt-oss-safeguard is designed for users who need real-time context and automation at scale, including:
- **ML/AI Engineers** working on Trust & Safety systems who need flexible content moderation
- **Trust & Safety Engineers** building or improving moderation, Trust & Safety, or platform integrity pipelines
- **Technical Program Managers** overseeing content safety initiatives
- **Developers** building projects/applications that require contextual, policy-based content moderation
- **Policy Crafters** defining what is accepted by an organization who want to test out policy lines, generate examples, and evaluate content
Safety-tuned models excel at content moderation when given clear, structured prompts. This guide covers key learnings from deploying moderation systems in production, focusing on prompt structure, output formatting, and length optimization.
### Using gpt-oss-safeguards with HuggingFace Transformers
The Transformers library by Hugging Face provides a flexible way to load and run large language models locally or on a server. [This guide](https://cookbook.openai.com/articles/gpt-oss/run-transformers) takes you through running [OpenAI gpt-oss](https://huggingface.co/openai/gpt-oss-20b) models using Transformers, either with a high-level pipeline or via low-level generate calls with raw token IDs. The simplest way to interact with the server is through the transformers chat CLI
```bash
transformers chat localhost:8000 --model-name-or-path openai/gpt-oss-safeguard-20b
```
or by sending an HTTP request with cURL, e.g.
```bash
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-oss-safeguard-20b",
"stream": true,
"messages": [
{ "role": "system", "content": "<your policy>" },
{ "role": "user", "content": "<user content to verify>" }
]
}'
```
Additional use cases, like integrating transformers serve with Cursor and other tools, are detailed in [the documentation](https://huggingface.co/docs/transformers/main/serving).
### Running gpt-oss-safeguard with Ollama
[Ollama](https://ollama.com/download) supports gpt-oss-safeguard 20B and 120B models directly. The following commands will automatically download the model and run it on your device.
#### gpt-oss-safeguard:20b
```bash
ollama run gpt-oss-safeguard:20b
```
#### gpt-oss-safeguard:120b
```bash
ollama run gpt-oss-safeguard:120b
```
Ollama supports [OpenAI API](https://docs.ollama.com/api/openai-compatibility), [Ollama's API](https://docs.ollama.com/api), [Python](https://github.com/ollama/ollama-python) and [JavaScript](https://github.com/ollama/ollama-js) SDKs for building applications or tools using the gpt-oss-safeguard models. Please learn more from [Ollama's documentation](https://docs.ollama.com/).
### Running gpt-oss-safeguard with LM Studio
Alternatively, you can use [LM Studio](https://lmstudio.ai/) to run the models