Prompt example extracted from OpenAI Cookbook.
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": "
" },
{ "role": "user", "content": "
" }
]
}'
```
Additional use cases, like integrating transformers serve with Cursor and other tools, are detailed in [the documentation](https://huggingface.co/docs/transformers/main/serving).