Engineering17 min readUpdated Nov 22, 2026

How to run gpt-oss-20b and gpt-oss-120b locally: memory, setup and the effort setting

Run gpt-oss-20b and gpt-oss-120b locally: memory per machine, exact commands, and why low effort drops the 20b from 75% to 39% on AIME 2025.

Charafeddine Mouzouni
Charafeddine Mouzouni
Bar chart of gpt-oss-20b scores on AIME 2025 at three reasoning effort levels from vLLM's reproduction: 38.8 at low, the default in LM Studio's config, 75.0 at medium, the default in Ollama and llama.cpp, and 85.8 at high, showing that the same weights answer very differently depending on one setting

Yes, you can run gpt-oss locally. gpt-oss-20b needs about 16 GB of memory, so it fits a 16 GB graphics card or a Mac with more than 16 GB, and gpt-oss-120b needs a single 80 GB GPU or a Mac with more than 96 GB of unified memory. The quickest setup is Ollama: ollama run gpt-oss:20b pulls a 14 GB model and ollama run gpt-oss:120b a 65 GB one, while LM Studio, llama.cpp and vLLM run the same weights. Everything below was checked on 22 November 2026 against Ollama v0.40.17, llama.cpp b12631 and vLLM 0.34.0. The August 2025 pair are still OpenAI's latest open-weight chat models.

Once it runs, check reasoning effort first. gpt-oss reasons at low, medium or high effort, and the default depends on the app: Ollama and llama.cpp use medium, while LM Studio's published config for the model uses low. In vLLM's own reproduction, gpt-oss-20b scores 38.8% on AIME 2025 at low effort and 75.0% at medium. Set the effort yourself, use the temperature 1.0 and top_p 1.0 that OpenAI recommends, and give the model at least a 32K window so its reasoning has room.

Picture a developer who reads OpenAI's launch post, which says gpt-oss-20b delivers results similar to o3-mini on common benchmarks, and installs it in LM Studio on a 32 GB laptop. The first test is a real problem from work: a rota with six people, four shifts and a handful of rules about who cannot follow whom.

The answer comes back almost at once, nicely formatted and wrong. A second try gives a different wrong answer. The developer closes the app, tells the team the benchmarks were generous, and goes back to paying for an API.

What they mostly tested was a setting. LM Studio's config for the model sets reasoning effort to low and adds a repeat penalty, which suits quick chat and hurts a puzzle. The same weights under Ollama would have reasoned at medium with temperature 1, and the chat window gave no hint of any of this.

So this guide does two jobs. It gets gpt-oss running on the machine you have, and it makes sure the model you end up judging is the one OpenAI shipped.

What gpt-oss is, and what is current in November 2026

gpt-oss is OpenAI's pair of open-weight reasoning models, released on 5 August 2025 under the Apache 2.0 license. Both are mixture-of-experts models: each token is routed through 4 of the model's experts, so only a small share of the parameters works on any given token. That is how a 117B model runs at the speed of a much smaller one.

gpt-oss-20bgpt-oss-120b
Total parameters21B117B
Active per token3.6B5.1B
Layers2436
Experts (4 used per token)32128
Context window131,072 tokens131,072 tokens
Ollama download14 GB65 GB
OpenAI's memory target16 GBone 80 GB GPU

The memory numbers work because of MXFP4. OpenAI post-trained the expert weights, which make up over 90% of the parameters, at about 4.25 bits each, and ran its own evaluations at that precision. There is no better quantization to hunt for. The llama.cpp maintainers' guide tells you to use the original MXFP4 files, and Ollama runs the format natively.

Two other details matter later. The models alternate full attention with attention over a 128-token sliding window, and they were trained on a chat format called harmony, which OpenAI says they need in order to work correctly. Your runtime normally handles harmony for you, and a section below covers the cases where it does not.

As for what is new, OpenAI has published no successor. Its Hugging Face organization lists no newer chat model. The only gpt-oss addition is gpt-oss-safeguard, released on 29 October 2025: fine-tunes that classify content against a safety policy you write.

How much memory gpt-oss-20b and gpt-oss-120b need

The most useful numbers come from that llama.cpp guide, because it measured the whole bill: the weights, the compute buffers and the cache that holds your conversation.

Measured by llama.cppgpt-oss-20bgpt-oss-120b
Model data12.0 GB61.0 GB
Total at 8K tokens14.9 GB64.0 GB
Total at 32K tokens15.5 GB64.9 GB
Total at 128K tokens17.9 GB68.5 GB

Look at how little the window costs. Going from 8K to the full 128K adds 3 GB on the 20b and 4.5 GB on the 120b. Only half the layers keep a cache that grows with the conversation, and each stores 8 key-value heads of size 64, according to the published config. At 16-bit precision that comes to 24 KiB per token on the 20b, or about 3.2 GB for a full window, which matches the measurement.

An ordinary dense 8B model, the Qwen3 8B behind deepseek-r1:8b, needs 144 KiB per token, six times more. With gpt-oss the window is cheap and the weights decide whether it fits.

Two practical notes. Ollama packages the 20b as a 14 GB file, a little larger than llama.cpp's, so leave yourself some headroom. And on a Mac, the guide recommends keeping the model under about 70% of total memory, because macOS does not hand all of it to the GPU. A 16 GB Mac therefore cannot hold the whole 20b on its GPU.

Which machine runs which gpt-oss model

Your machineWhat runsHow
8 GB GPU20b, part on CPUllama.cpp, --n-cpu-moe 16 at 32K
16 GB GPU20bfully on the card at 32K with llama.cpp
24 to 32 GB GPU20bfull 128K window
16 GB Mac20b, part on CPUllama.cpp, --n-cpu-moe 12 at 32K
Mac, 32 to 64 GB20bfull window
Mac over 96 GB20b and 120bfull window
One 80 GB GPU120bvLLM or llama.cpp
16 to 32 GB GPU, lots of RAM120b, experts on CPUllama.cpp, --n-cpu-moe

The rows follow the commands and hardware in the llama.cpp guide and OpenAI's model card. --n-cpu-moe keeps the expert weights of the first N layers in system memory and puts everything else on the GPU. The guide reports decent performance this way, and its advice is to raise N until the model stops running out of GPU memory.

For the 120b on a PC, the experts you push off the card still have to fit somewhere, and they are most of the 61 GB. Check your system RAM before you start a long download.

If none of these rows is your machine, Ollama also serves gpt-oss:120b-cloud from its own servers. That stops being local, and our guide to Ollama Cloud vs local models covers what leaves your machine when you use it.

Four ways to set up gpt-oss

RuntimeGood forFirst commandPort
Ollamathe shortest pathollama run gpt-oss:20b11434
LM Studioa desktop applms get openai/gpt-oss-20b1234
llama.cppcontrol on small GPUsllama serve -hf ggml-org/gpt-oss-20b-GGUF9931
vLLMGPU servers, many usersvllm serve openai/gpt-oss-120b8000

All four expose an OpenAI-compatible API, so code written against one moves to another by changing the base URL and the model name. One change worth knowing: current llama.cpp listens on port 9931 by default, where older guides say 8080.

Run gpt-oss with Ollama

Install Ollama from ollama.com (on Linux, curl -fsSL https://ollama.com/install.sh | sh), then pull and run the model.

ollama pull gpt-oss:20b
ollama run gpt-oss:20b --think=high --verbose

Type the equals sign in --think=high. The flag reads a bare --think as "on", so --think high would send the word "high" to the model as your prompt. Inside a session, /set think low, medium or high switches level, and --verbose prints timings after each answer.

Then fix the window. On a GPU with less than 24 GiB, Ollama gives every model a 4K context, and gpt-oss writes its reasoning into that same window. A long prompt plus a medium-effort answer can outgrow 4K quickly, so set a larger default when you start the server.

OLLAMA_CONTEXT_LENGTH=32768 ollama serve

If Ollama already runs as the desktop app or a Linux service, that command stops with an address-in-use error. Set the variable on the app or the service instead and restart it, as shown in our Ollama API guide.

Load the model, send one prompt and run ollama ps. The PROCESSOR column should read 100% GPU and CONTEXT should show 32768. A split such as 20%/80% CPU/GPU means part of the model moved to system memory, and on a 16 GB card the fix is a smaller window.

This also settles a common question about system prompts. gpt-oss keeps its harmony system message for fixed metadata: identity, dates and reasoning level. Ollama's template puts the system prompt you send into the developer message, under an Instructions heading, which is where OpenAI's format expects your instructions. So the usual system role works as you would hope.

Run gpt-oss in LM Studio

LM Studio is the friendliest option if you want a desktop app. Install it, then fetch and load the model from its CLI, setting the context length as you load.

lms get openai/gpt-oss-20b
lms load openai/gpt-oss-20b --context-length 32768
lms server start

Change two things before you judge the model. LM Studio's published config for openai/gpt-oss-20b sets the Reasoning Effort field to low, and the sampling to temperature 0.8, top_p 0.8, top_k 40 and a repeat penalty of 1.1. OpenAI recommends temperature 1.0 and top_p 1.0, and the llama.cpp guide warns against repetition penalties for these models.

Set the effort to medium or high in the model's settings and match the sampling to OpenAI's advice. The server usually runs on port 1234. Its chat completions endpoint accepts repeat_penalty in the request, so code can override the sampling per call, but reasoning effort is missing from that endpoint's parameter list, so set it in the app.

Run gpt-oss with llama.cpp

llama.cpp gives you the most control on small or mixed hardware, and its maintainers wrote the guide behind the tables above. Current builds ship a single llama command. This one starts the OpenAI-compatible server and a web chat, downloading the model on first run.

llama serve -hf ggml-org/gpt-oss-20b-GGUF -c 0 \
  --reasoning-effort high --temp 1.0 --top-p 1.0

-c 0 takes the model's full 131,072-token window. On a 16 GB card use -c 32768, and on smaller cards add --n-cpu-moe as in the machine table. The sampling flags matter here because the server's own defaults are temperature 0.8 and top_p 0.95. The llama-server binary from older guides takes the same flags, and the big model is ggml-org/gpt-oss-120b-GGUF.

The model repositories now also carry EAGLE3 draft heads for speculative decoding. Adding --spec-type draft-eagle3 makes llama.cpp download the draft and use it alongside the model. Whether that speeds up your own workload is something to measure with the script further down.

Run gpt-oss-120b on a GPU server with vLLM

vLLM is the choice when several people or a fleet of agents share one GPU, because it batches their requests together. Its gpt-oss recipe installs the release and serves the model straight from Hugging Face.

uv venv
source .venv/bin/activate
uv pip install vllm --torch-backend=auto
vllm serve openai/gpt-oss-120b --max-model-len 131072

The recipe says the 120b fits a single 80 GB A100 and runs on H100, H200, B200 and AMD's MI300X family. Add --tensor-parallel-size 2 to spread it over two GPUs for more throughput, and --tool-call-parser openai --enable-auto-tool-choice for function calling on the chat endpoint. The server answers on port 8000.

Hugging Face Transformers runs both models too, and its chat template applies harmony for you. Calling generate on plain text skips that template, which is the easiest way to watch gpt-oss misbehave. How many users one GPU can carry is its own question, and our local LLM server comparison shows how to find that limit.

Set the reasoning effort on purpose

gpt-oss thinks before it answers, and the effort level sets for how long. These scores come from vLLM's recipe, where the team reran OpenAI's evaluations at each level without tools.

Effort20b GPQA20b AIME 2025120b GPQA120b AIME 2025
Low56.838.865.351.2
Medium67.575.072.479.6
High70.985.879.493.0

The step from low to medium is the big one, especially on math. On these two benchmarks the 20b on high also beats the 120b on low, so on a tight machine the effort setting can buy more than a bigger download.

The price is time. Higher effort writes more reasoning before the answer, so the same tokens per second means a longer wait. OpenAI describes low as fast dialogue and high as deep analysis. I would use low for routing and extraction, medium as the default, and high for problems where you would check the answer by hand anyway.

RuntimeDefaultHow to change it
Ollamamedium"think": "high" on /api/chat, reasoning_effort on /v1
LM StudiolowReasoning Effort field in the model settings
llama.cppmedium--reasoning-effort, or reasoning_effort per request
vLLMmediumreasoning_effort per request
Raw harmonymediumReasoning: high in the system message

You cannot switch the reasoning off. Ollama's documentation on thinking and OpenAI compatibility notes that gpt-oss cannot disable thinking, so think: false and reasoning_effort: "none" both fall back to low.

Keep the reasoning away from your users as well. OpenAI's harmony guide says the chain of thought is held to a lower safety standard than the final answer, which matters the day a customer-facing tool starts streaming it.

The harmony format, and when you have to care

If you use Ollama, LM Studio, or the chat endpoints of llama.cpp and vLLM, harmony is handled for you. You need to know it in three cases: you send raw text completions, you build your own server or template, or you run multi-step tool calls and manage the history yourself.

Harmony gives each message a role, and each assistant message a channel. The roles are system, developer, user, assistant and tool, and they rank in that order when instructions conflict. The assistant writes its reasoning to an analysis channel, its function calls usually to commentary, and the answer meant for the user to final.

The rule that trips people up concerns history. When a turn ends with a final answer, drop its analysis messages before the next request. When it ends in a tool call, keep the reasoning, because the model was halfway through a thought. Ollama's template already follows this: it keeps reasoning only for messages after the last user turn.

For raw completions, OpenAI's openai-harmony package renders the prompt and parses the reply. This builds a prompt at high effort, with your instructions in the developer message.

from openai_harmony import (
    Conversation, DeveloperContent, HarmonyEncodingName,
    Message, ReasoningEffort, Role, SystemContent,
    load_harmony_encoding)

enc = load_harmony_encoding(
    HarmonyEncodingName.HARMONY_GPT_OSS)
system = SystemContent.new().with_reasoning_effort(
    ReasoningEffort.HIGH)
dev = DeveloperContent.new().with_instructions(
    "Answer in two sentences.")
convo = Conversation.from_messages([
    Message.from_role_and_content(Role.SYSTEM, system),
    Message.from_role_and_content(Role.DEVELOPER, dev),
    Message.from_role_and_content(
        Role.USER, "What is MXFP4?"),
])
tokens = enc.render_conversation_for_completion(
    convo, Role.ASSISTANT)
print(enc.decode(tokens))
stop = enc.stop_tokens_for_assistant_actions()

Send those token IDs to a raw completions endpoint and stop generation on the IDs in stop. Then turn the reply back into messages with enc.parse_messages_from_completion_tokens(reply, Role.ASSISTANT), leaving the stop token off.

Tool calling with gpt-oss

gpt-oss was trained for function calling, plus a built-in browser tool and a Python tool. For your own functions, Ollama's Python library builds the schema from a typed function with a docstring. The loop below keeps running tools until the model gives a final answer, and appending r.message each time carries the reasoning forward, as harmony requires.

from ollama import chat

def order_status(order_id: str) -> str:
    """Look up the shipping status of an order.

    Args:
      order_id: The order number, such as A-1042
    """
    return {"A-1042": "shipped on 20 Nov"}.get(
        order_id, "unknown order")

tools = {"order_status": order_status}
messages = [{"role": "user",
             "content": "Where is order A-1042?"}]
while True:
    r = chat(model="gpt-oss:20b", messages=messages,
             tools=list(tools.values()), think="medium")
    messages.append(r.message)
    if not r.message.tool_calls:
        break
    for call in r.message.tool_calls:
        fn = tools[call.function.name]
        messages.append({
            "role": "tool",
            "tool_name": call.function.name,
            "content": fn(**call.function.arguments)})
print(r.message.content)

Validate the arguments before a tool does anything that matters, because a confident call with the wrong order number looks exactly like a right one. On vLLM the same pattern works through the chat endpoint once the server runs with the two tool flags from the vLLM section.

Use gpt-oss through the OpenAI-compatible endpoint

Most existing code only needs a new base URL. This example talks to Ollama; for the other runtimes, change the port and the model name from the setup table.

from openai import OpenAI

client = OpenAI(base_url="http://localhost:11434/v1/",
                api_key="ollama")
r = client.chat.completions.create(
    model="gpt-oss:20b",
    reasoning_effort="high",
    messages=[
        {"role": "system", "content": "Answer briefly."},
        {"role": "user", "content": "Is 2027 prime?"},
    ],
)
print(r.choices[0].message.content)

The client insists on an API key, and Ollama ignores whatever you send. The OpenAI API also has no field for the context window, so Ollama's documentation says to bake one into a model of your own.

FROM gpt-oss:20b
PARAMETER num_ctx 32768
ollama create gpt-oss-32k -f Modelfile

Call gpt-oss-32k from then on. Agent tools can use the model through the same server: the model page lists ollama launch claude --model gpt-oss, and our Claude Code with Ollama guide explains why a coding agent needs a window of 64K or more.

Measure your own tokens per second

Published speeds are a starting point. These come from the llama.cpp guide, measured with llama-bench in August 2025: reading a 2,048-token prompt and generating 128 tokens, one request at a time.

MachineModelPrompt tok/sGeneration tok/s
RTX 5060 Ti 16 GB20b3,839112
RTX 4080 SUPER 16 GB20b8,171187
RTX 3090 24 GB20b5,171162
RTX 4090 24 GB20b8,022222
RTX 5090 32 GB20b9,848283
M1 Pro 32 GB20b51646
M4 Max 36 GB20b1,27792
M2 Ultra 192 GB120b1,24580
RTX Pro 6000 96 GB120b5,518196

Two caveats before you plan around these. Ollama, LM Studio and newer llama.cpp builds will land somewhere else. And speed drops as the conversation grows: on the M2 Ultra, the 20b generated 115 tokens per second with an empty context and 77 with 32K tokens already in it.

So measure on your own machine, at the window and effort you plan to use. This script asks Ollama the same question at all three effort levels and prints the generation rate, the token count and the wall-clock time. Put a real prompt from your work in prompt.txt.

import json, sys, time, urllib.request

URL = "http://localhost:11434/api/chat"
model = sys.argv[1] if len(sys.argv) > 1 else "gpt-oss:20b"
prompt = open("prompt.txt").read()

def ask(level):
    body = {"model": model, "stream": False,
            "think": level, "options": {"num_ctx": 32768},
            "messages": [{"role": "user",
                          "content": prompt}]}
    req = urllib.request.Request(
        URL, data=json.dumps(body).encode(),
        headers={"Content-Type": "application/json"})
    start = time.time()
    with urllib.request.urlopen(req, timeout=1800) as r:
        out = json.load(r)
    return out, time.time() - start

for level in ("low", "medium", "high"):
    out, wall = ask(level)
    rate = out["eval_count"] / (out["eval_duration"] / 1e9)
    print(f"{level:6} {rate:6.1f} tok/s "
          f"{out['eval_count']:6d} tokens {wall:6.1f} s")

Ollama's eval_count covers every generated token, reasoning included, and its durations are in nanoseconds. Watch the last column: the wait is what your users feel, and it grows with effort even when the rate barely moves. On llama.cpp, llama bench -hf ggml-org/gpt-oss-20b-GGUF -p 2048 -n 128 runs the same tests as the table on your hardware.

When to pick gpt-oss-20b, gpt-oss-120b or another model

Pick the 20b when you have 16 to 64 GB and want a private reasoning model with tool calling and a long window that costs little memory. Pick the 120b when you have the 80 GB card or the big Mac, and your own test set shows the 20b falling short even at high effort.

Pick something else when the job needs what gpt-oss lacks. It reads text only, so screenshots and scanned documents need a vision model, and its template gives a knowledge cutoff of June 2024. Our best Ollama models guide has picks by task and memory, with gpt-oss among the reasoning options.

The rule I keep coming back to is in my letter You Don't Need the Best Model: the cheapest model that is good enough for the task, on hardware you control. If you are weighing a local 120b against paying a provider for the same weights, our self-hosted cost break-even runs that comparison on gpt-oss-120b itself.

Where to go next. The best Ollama models in 2026 covers what to run when gpt-oss is the wrong fit. The local LLM server comparison covers Ollama, LM Studio, vLLM and llama.cpp under real concurrent load. And Ollama Cloud vs local covers what changes when a tag ends in -cloud.

What I'd do

Start with Ollama and gpt-oss:20b, set OLLAMA_CONTEXT_LENGTH to 32768, and confirm 100% GPU in ollama ps. Write down eight to ten real tasks you already know the answers to, run them at low, medium and high with the script above, and keep the lowest effort that gets them right. Only then decide whether the 120b is worth the hardware. Record the tag, the window, the effort and the date in the file where your team keeps its working setup, the way we teach operators to keep their AI Operating System as a living document. If you want to build that setup properly, the AI OS Course walks through it on any model. If you are wiring gpt-oss into an application with tools, Engineering Foundations covers tool use and evaluation-first development, and our team programs run the same qualification on a company's own stack.

FAQ

Can I run gpt-oss-20b locally?

Yes. It needs about 16 GB of memory: llama.cpp measured 14.9 GB at an 8K window and 15.5 GB at 32K. With llama.cpp a 16 GB GPU runs it fully at 32K, a Mac with more than 16 GB runs the full window, and smaller GPUs can keep some experts on the CPU. Start with ollama run gpt-oss:20b.

What hardware do I need to run gpt-oss-120b locally?

A single 80 GB GPU such as an H100 or an 80 GB A100, a 96 GB workstation card, or a Mac with more than 96 GB of unified memory. llama.cpp measured 64.0 GB at 8K and 68.5 GB at the full window. A 16 to 32 GB GPU can run it with --n-cpu-moe if you have plenty of system RAM, more slowly.

What is the gpt-oss context window?

131,072 tokens, usually written 128K, for both models. Ollama sizes its default from your GPU memory, only 4K under 24 GiB, so raise it with OLLAMA_CONTEXT_LENGTH. The full window adds about 3 GB on the 20b and 4.5 GB on the 120b, which is modest for a window that long.

How do I set the system prompt for gpt-oss-20b?

Send it as a normal system message. Ollama and the official chat template move it into harmony's developer message, under an Instructions heading, while the harmony system message carries the identity, dates and reasoning level. Write Reasoning: high yourself only when you build raw harmony prompts.

How do I change the gpt-oss reasoning effort?

In Ollama, run ollama run gpt-oss:20b --think=high or send "think": "high". Through an OpenAI client, pass reasoning_effort="high". In llama.cpp, start the server with --reasoning-effort high, and in LM Studio change the Reasoning Effort field, which defaults to low. Thinking cannot be turned off.

What is the best API for gpt-oss?

Locally, the runtime you already use: all four serve an OpenAI-compatible endpoint, Ollama on 11434, LM Studio on 1234, llama.cpp on 9931 and vLLM on 8000. Hosted, Ollama Cloud serves gpt-oss:120b-cloud, and other providers sell the same weights per token. Our break-even article compares one of them with running it yourself.

The developer from the opening was right to test gpt-oss on a real problem. They tested it at low effort with a repeat penalty, though, and walked away with a verdict about the model.

Set the effort and the sampling before you judge it, so the model you judge is the one OpenAI shipped.

Charafeddine MouzouniUpdated Nov 22, 2026

The script works. Production is a different sport.

The AI OS letter covers the part tutorials skip: verification, trust, what breaks with real users. One idea, every Saturday, from CM, Cohorte's founder, who has shipped 60+ AI systems.

Free weekly. No spam. Unsubscribe in one click.

Subscribed ✓

The next letter arrives Saturday. Go finish the build.