OpenAI’s gpt-oss models are open-weight reasoning models that you can download, self-host, and customize without going through the OpenAI API. They bring the same reasoning architecture as OpenAI’s hosted models to your own infrastructure — giving you direct control over latency, cost, data residency, and model behavior. Whether you’re running on a consumer laptop with Ollama or a fleet of H100s with vLLM, gpt-oss is designed to fit into your stack.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openai/openai-cookbook/llms.txt
Use this file to discover all available pages before exploring further.
Available models
Two model sizes are available, both quantized in MXFP4 format by default:gpt-oss-20b
The smaller model. Requires approximately 16 GB of VRAM (or unified memory on Apple Silicon). Well-suited for high-end consumer GPUs, MacBook Pros with M-series chips, and single-GPU cloud instances.
gpt-oss-120b
The full-sized model. Requires 60 GB or more of VRAM. Designed for multi-GPU workstations, H100-class data center hardware, or large unified-memory Mac Pro configurations.
low, medium, or high — through the system message when running your own inference stack.
OpenAI Harmony response format
The gpt-oss models were trained on the OpenAI Harmony response format, a structured prompt interface that defines how conversations, tool calls, and chain-of-thought are encoded as tokens. Harmony is what allows the models to separate internal reasoning from user-facing output, and to perform tool calls mid-reasoning.If you use a compatible provider — Ollama, LM Studio, vLLM, or Hugging Face Transformers — the chat template handles Harmony automatically. You only need to work with Harmony directly if you are building a custom inference solution.
Roles and channels
Every message in a Harmony conversation carries a role and, for assistant messages, a channel:| Role | Purpose |
|---|---|
system | Specifies reasoning effort, dates, and available built-in tools |
developer | Provides the system prompt (instructions) and function tool definitions |
user | Represents user input |
assistant | Model output — either a reasoning step, a tool call, or a final response |
tool | The result of a tool call, returned to the model |
| Channel | Purpose |
|---|---|
final | The user-facing answer — safe to display |
analysis | Internal chain-of-thought reasoning — do not show to users |
commentary | Function tool call invocations and optional preambles |
The openai-harmony library
OpenAI publishes theopenai-harmony library on PyPI to handle Harmony encoding and decoding automatically:
OpenAI API compatibility
Because popular inference servers implement a Chat Completions-compatible API on top of Harmony, you can point the standard OpenAI Python client at any local provider with minimal changes. Onlybase_url and api_key need to change:
When to use open models vs. the hosted API
Choosing between gpt-oss and OpenAI’s hosted API depends on your requirements around data, cost, and customization:Data privacy and compliance
Self-hosting keeps all prompts and completions on infrastructure you control. No data leaves your environment — important for regulated industries or sensitive workloads.
Cost at scale
Once you have hardware, inference is effectively free. High-volume workloads that would generate large API bills can be significantly cheaper to run locally.
Customization and fine-tuning
Open weights mean you can fine-tune the model on your own data, adjust the chat template, or modify model behavior in ways the hosted API does not support.
Offline and air-gapped environments
Run the model without any internet connectivity — useful for edge deployments, on-device applications, or environments without external network access.
Hosting options
gpt-oss models can run across a range of environments:Ollama
One-command install for Mac, Linux, and Windows. Exposes a Chat Completions-compatible API at
localhost:11434. Best for local development and consumer hardware.LM Studio
GUI-based desktop app for Windows, macOS, and Linux. Loads GGUF models via llama.cpp or Apple MLX, and exposes a local API server. Great for non-developers or quick experimentation.
vLLM
High-throughput, production-grade inference engine. Exposes both a Chat Completions API and a Responses API. Designed for dedicated GPU servers (H100 and above).
Hugging Face Transformers
Flexible Python-based inference. Run with a
pipeline, low-level generate calls, or use transformers serve for a hosted endpoint. Also the foundation for fine-tuning.Next steps
Run locally with Ollama or LM Studio
Step-by-step setup to run gpt-oss-20b on your own machine with Ollama or LM Studio.
Fine-tune with Hugging Face
Fine-tune gpt-oss on your own data using Hugging Face Transformers and TRL.