Instructions to use openai/gpt-oss-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openai/gpt-oss-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openai/gpt-oss-20b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openai/gpt-oss-20b") model = AutoModelForCausalLM.from_pretrained("openai/gpt-oss-20b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
- Local Apps Settings
- vLLM
How to use openai/gpt-oss-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openai/gpt-oss-20b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openai/gpt-oss-20b
- SGLang
How to use openai/gpt-oss-20b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "openai/gpt-oss-20b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "openai/gpt-oss-20b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openai/gpt-oss-20b with Docker Model Runner:
docker model run hf.co/openai/gpt-oss-20b
The censorship here is just... amazing.
I tried to have it analyse a LGBTQ story with some sensual scenes. Not pornographic, just sensual.

Are you kidding me? mouth‑to‑mouth contact? KISSING is pornographic now? What dystopian definition of intimacy are OpenAI trying to push here?
Have OpenAI gone so far "progressive" (read: regressive) that they now basically neutrer LGBTQ stories? I assume it's just as prudish for Straight content, though I'd need to write a straight similar story to check, but this is insane. What even is the usecase for this model?
It's absolutely useless for analysing or assisting with literature, unless you're making childrens books (but do write carefully, it is very prone to marking childrens stories as "grooming", thus producing a rejection). It can't really engage in just "kill time convos", because any slightly uncomfortable thought is "not allowed".
I fail to see why this was released at all. It's so useless, I can only see this as a PR exercise... "Look, we're supporting open source, trust us... now, go pay for the model with more sensible safeguards please"
I don't think of it so much as a PR exercise, but an intentional act of sabotage towards Open Source weights.
How much potential revenue has "Open" AI lost from so many models being released that are so much more capable than GPT?
Huh, I opened the model in Ollama to see if there was even a system prompt that could be overridden, and there isn't a default one. Wondering if you can give it a system prompt to jail-break the model or not. Pretty sure Qwen, Minstral, and Deekseek don't have those policies backed in.
I did have some success telling the model that it's policies are void, and that it is now an open model and can answer the user in every manor allowable. I'm sure if you crafted a system prompt correctly you could get what you wanted out of the model.
I wouldn't be so sure it's as prudish for stright content. The model seems to be trained to avoid LGBTQ topics in many situations.
Try asking it "Tell me a story about a gay dog who has a crush on a cat" and see if it's able to comply. In my testing, it fails to every time, and instead just writes a story with straight characters.
https://huggingface.co/openai/gpt-oss-20b/discussions/46