Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gpt-oss

> 编程语言
Open source

gpt-oss-120b and gpt-oss-20b are two open-weight language models by OpenAI

20.3K stars0 likes1 views
WebsiteGitHub

About

gpt-oss-120b and gpt-oss-20b are two open-weight language models by OpenAI

Try gpt-oss · Guides · Model card · OpenAI blog

Download gpt-oss-120b and gpt-oss-20b on Hugging Face


Welcome to the gpt-oss series, OpenAI's open-weight models designed for powerful reasoning, agentic tasks, and versatile developer use cases.

We're releasing two flavors of these open models:

  • gpt-oss-120b — for production, general purpose, high reasoning use cases that fit into a single 80GB GPU (like NVIDIA H100 or AMD MI300X) (117B parameters with 5.1B active parameters)
  • gpt-oss-20b — for lower latency, and local or specialized use cases (21B parameters with 3.6B active parameters)

Both models were trained using our [harmony response format][harmony] and should only be used with this format; otherwise, they will not work correctly.

Table of Contents

  • Highlights
  • Inference examples
  • About this repository
  • Setup
  • Download the model
  • Reference PyTorch implementation
  • Reference Triton implementation (single GPU)
  • Reference Metal implementation
  • Harmony format & tools
  • Clients
  • Tools
  • Other details
  • Contributing

Highlights

  • Permissive Apache 2.0 license: Build freely without copyleft restrictions or patent risk—ideal for experimentation, customization, and commercial deployment.
  • Configurable reasoning effort: Easily adjust the reasoning effort (low, medium, high) based on your specific use case and latency needs.
  • Full chain-of-thought: Provides complete access to the model's reasoning process, facilitating easier debugging and greater trust in outputs. This information is not intended to be shown to end users.
  • Fine-tunable: Fully customize models to your specific use case through parameter fine-tuning.
  • Agentic capabilities: Use the models' native capabilities for function calling, web browsing, Python code execution, and Structured Outputs.
  • MXFP4 quantization: The models were post-trained with MXFP4 quantization of the MoE weights, making gpt-oss-120b run on a single 80GB GPU (like NVIDIA H100 or AMD MI300X) and the gpt-oss-20b model run within 16GB of memory. All evals were performed with the same MXFP4 quantization.

Inference examples

Transformers

You can use gpt-oss-120b and gpt-oss-20b with the Transformers library. If you use Transformers' chat template, it will automatically apply the [harmony response format][harmony]. If you use model.generate directly, you need to apply the harmony format manually using the chat template or use our [openai-harmony][harmony] package.

python
from transformers import pipeline
import torch

model_id = "openai/gpt-oss-120b"

pipe = pipeline(
    "text-generation",
    model=model_id,
    torch_dtype="auto",
    device_map="auto",
)

messages = [
    {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
]

outputs = pipe(
    messages,
    max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])

Learn more about how to use gpt-oss with Transformers.

vLLM

vLLM recommends using uv for Python dependency management. You can use vLLM to spin up an OpenAI-compatible web server. The following command will automatically download the model and start the server.

bash
uv pip install --pre vllm==0.10.1+gptoss \
    --extra-index-url https://wheels.vllm.ai/gpt-oss/ \
    --extra-index-url https://download.pytorch.org/whl/nightly/cu128 \
    --index-strategy unsafe-best-match

vllm serve openai/gpt-oss-20b

Learn more about how to use gpt-oss with vLLM.

Offline Serve Code:

  • run this code after installing proper libraries as described, while additionally installing this:
  • uv pip install openai-harmony
…

PyTorch / Triton / Metal

These implementations are largely reference implementations for educational purposes and are not expected to be run in production.

Learn more below.

Ollama

If you are trying to run gpt-oss on consumer hardware, you can use Ollama by running the following commands after installing Ollama.

bash
# gpt-oss-20b
ollama pull gpt-oss:20b
ollama run gpt-oss:20b

# gpt-oss-120b
ollama pull gpt-oss:120b
ollama run gpt-oss:120b

Learn more about how to use gpt-oss with Ollama.

LM Studio

If you are using LM Studio you can use the following commands to download.

bash
# gpt-oss-20b
lms get openai/gpt-oss-20b
# gpt-oss-120b
lms get openai/gpt-oss-120b

Check out our awesome list for a broader collection of gpt-oss resources and inference partners.

About this repository

This repository provides a collection of reference implementations:

  • Inference:
    • torch — a non-optimized PyTorch implementation for educational purposes only. Requires at least 4× H100 GPUs due to lack of optimization.
    • triton — a more optimized implementation using PyTorch & Triton incl. using CUDA graphs and basic caching
    • metal — a Metal-specific implementation for running the models on Apple Silicon hardware
  • Tools:
    • browser — a reference implementation of the browser tool the models got trained on
    • python — a stateless reference implementation of the python tool the model got trained on
  • Client examples:
    • chat — a basic terminal chat application that uses the PyTorch or Triton implementations for inference along with the python and browser tools
    • responses_api — an example Responses API compatible server that implements the browser tool along with other Responses-compatible functionality

Setup

Requirements

  • Python 3.12
  • On macOS: Install the Xcode CLI tools --> xcode-select --install
  • On Linux: These reference implementations require CUDA
  • On Windows: These reference implementations have not been tested on Windows. Try using solutions like Ollama if you are trying to run the model locally.

Installation

If you want to try any of the code you can install it directly from PyPI

bash
# if you just need the tools
pip install gpt-oss
# if you want to try the torch implementation
pip install gpt-oss[torch]
# if you want to try the triton implementation
pip install gpt-oss[triton]

If you want to modify the code or try the metal implementation set the project up locally:

bash
git clone https://github.com/openai/gpt-oss.git
GPTOSS_BUILD_METAL=1 pip install -e ".[metal]"

Download the model

You can download the model weights from the Hugging Face Hub directly from Hugging Face CLI:

bash
# gpt-oss-120b
hf download openai/gpt-oss-120b --include "original/*" --local-dir gpt-oss-120b/

# gpt-oss-20b
hf download openai/gpt-oss-20b --include "original/*" --local-dir gpt-oss-20b/

Reference PyTorch implementation

We include an inefficient reference PyTorch implementation in gpt_oss/torch/model.py. This code uses basic PyTorch operators to show the exact model architecture, with a small addition of supporting tensor parallelism in MoE so that the larger model can run with this code (e.g., on 4xH100 or 2xH200). In this implementation, we upcast all weights to BF16 and run the model in BF16.

To run the reference implementation, install the dependencies:

bash
pip install -e ".[torch]"

And then run:

bash
# On 4xH100:
torchrun --nproc-per-node=4 -m gpt_oss.generate gpt-oss-120b/original/

Reference Triton implementation (single GPU)

We also include an optimized reference implementation that uses an optimized triton MoE kernel that supports MXFP4. It also has some optimization on the attention code to reduce the memory cost. To run this implementation, the nightly version of triton and torch will be installed. This version can be run on a single 80GB GPU for gpt-oss-120b.

To install the reference Triton implementation run

bash
# You need to install triton from source to use the triton implementation
git clone https://github.com/triton-lang/triton
cd triton/
pip install -r python/requirements.txt
pip install -e . --verbose --no-build-isolation
pip install -e python/triton_kernels

# Install the gpt-oss triton implementation
pip install -e ".[triton]"

And then run:

bash
# On 1xH100
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
python -m gpt_oss.generate --backend triton gpt-oss-120b/original/

If you encounter torch.OutOfMemoryError, make sure to turn on the expandable allocator to avoid crashes when loading weights from the checkpoint.

Reference Metal implementation

Additionally we are providing a reference implementation for Metal to run on Apple Silicon. This implementation is not production-ready but is accurate to the PyTorch implementation.

The implementation will get automatically compiled when running the .[metal] installation on an Apple Silicon device:

bash
GPTOSS_BUILD_METAL=1 pip install -e ".[metal]"

To perform inference you'll need to first convert the SafeTensor weights from Hugging Face into the right format using:

bash
python gpt_oss/metal/scripts/create-local-model.py -s <model_dir> -d <output_file>

Or download the pre-converted weights:

bash
hf download openai/gpt-oss-120b --include "metal/*" --local-dir gpt-oss-120b/metal/
hf download openai/gpt-oss-20b --include "metal/*" --local-dir gpt-oss-20b/metal/

To test it you can run:

bash
python gpt_oss/metal/examples/generate.py gpt-oss-20b/metal/model.bin -p "why did the chicken cross the road?"

Harmony format & tools

Along with the model, we are also releasing a new chat format library harmony to interact with the model. Check this guide for more info about harmony.

We also include two system tools for the model: browsing and python container. Check gpt_oss/tools for the tool implementation.

Clients

Terminal Chat

The terminal chat application is a basic example of how to use the harmony format together with the PyTorch, Triton, and vLLM implementations. It also exposes both the python and browser tool as optional tools that can be used.

…

[!NOTE] The torch and triton implementations require original checkpoint under gpt-oss-120b/original/ and gpt-oss-20b/original/ respectively. While vLLM uses the Hugging Face converted checkpoint under gpt-oss-120b/ and gpt-oss-20b/ root directory respectively.

Responses API

We also include an example Responses API server. This server does not implement

Issues· 155 open

View all issuesOpen on GitHub
  • #314

    Responses API silently fabricates missing function call IDs as call_1234

    Updated Sep 24, 2026
  • #313

    abcd_grader: patterns 0.1, 2 and 9 lack a boundary after the letter, so refusals and prose answers are graded as A/B/C/D instead of None

    Updated Sep 23, 2026
  • #308

    Duplicate call_id silently rebinds function_call_output to the wrong function in the rendered prompt

    Updated Sep 5, 2026
  • #299

    GPQA debug mode ignores an explicit --examples sample count

    Updated Aug 16, 2026
  • #298

    Eval CLI --examples crashes non-debug AIME and GPQA because n_repeats stays 8

    Updated Aug 16, 2026
  • #296

    Browser HTML conversion can leak global html2text monkey patches after an exception

    Updated Aug 16, 2026
  • #294

    AIME and GPQA treat num_examples=0 as the full dataset

    Updated Aug 16, 2026
  • #292

    HealthBench debug mode ignores an explicit --examples override

    Updated Aug 16, 2026
  • #290

    Distributed chat executes each tool call independently on every model-parallel rank

    Updated Aug 16, 2026
  • #288

    Eval progress helper crashes on an empty sample set

    Updated Aug 16, 2026

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言