Local AI deployment guide

How to run GPT-OSS with Ollama

Ollama is one of the simplest ways to try OpenAI's open-weight GPT-OSS models on a machine you control. The command is easy. Choosing the right model, understanding memory, and keeping the local API private are the parts that deserve care.

Updated September 6, 2026. Commands and model details checked against the current Ollama model listing and OpenAI documentation.

Quick start: install Ollama, then run ollama run gpt-oss:20b for a smaller local model or ollama run gpt-oss:120b for the larger model. The 20B artifact is the sensible first test for most machines. The 120B model needs a much larger memory budget and is not a normal laptop download.

What this setup gives you

Ollama packages model management and a local inference server into a workflow that is approachable for developers who do not want to assemble every part of a model-serving stack. You install the application, download a model through the command line or app, and interact with it from a terminal, a compatible client, or your own code.

GPT-OSS is a useful match for this workflow because OpenAI released it as an open-weight family intended for infrastructure you control. The models are designed for reasoning, tool use, structured outputs, and customization. Running one locally is different from using ChatGPT: you are responsible for the machine, the model artifact, the prompt template, updates, access controls, and the data that enters the process.

Local inference is not automatically private in every configuration. A model loaded on your computer can answer without sending the prompt to a hosted model, but Ollama can also be used with cloud models and optional integrations. Treat privacy as a system property you configure and verify, not as a slogan attached to the word “local.”

If you want the model specifications first, read our GPT-OSS 120B guide. This page focuses on the practical Ollama path: installing, choosing a tag, checking resources, calling the API, and fixing the issues most people meet on the first run.

Before you download anything

Check the machine before starting a large download. You need enough free disk space for the model artifact and room for temporary files and future versions. You also need enough system memory or GPU memory for the model and its context cache. A model may fit on paper and still fail when another application is using the same memory.

Ollama's current library listing shows roughly 14 GB for the 20B artifact and roughly 65 GB for the 120B artifact. Those are useful download-size signals, not complete deployment budgets. Add overhead for the operating system, runtime, model context, concurrent requests, and the rest of your development environment. The 120B model is intended for a high-memory accelerator; it is not a practical first download on a typical office laptop.

Decide what you are testing. If the goal is to understand the model's style, the 20B version is enough to begin. If the goal is to compare difficult reasoning with a hosted frontier model, plan a controlled evaluation and make sure your machine can sustain the context length and response speed. Do not compare a warmed-up 20B local run with a cold 120B cloud request and draw a conclusion about model quality.

Install Ollama and run GPT-OSS

Download Ollama from its official download page and complete the normal installation for your operating system. Once the Ollama service is running, open a terminal and use an explicit model tag:

ollama run gpt-oss:20b

# Use this only when your machine can support the larger artifact
ollama run gpt-oss:120b

The first command downloads the model if it is not already present and then opens an interactive chat. The terminal may appear quiet while the artifact is being downloaded or loaded. Wait for the download and loading step to finish before deciding that the command failed.

Use the model name in your own notes and scripts. The shorter gpt-oss alias is convenient, but an explicit 20B or 120B tag makes a deployment reproducible. If the alias changes later, a saved command that says only gpt-oss can silently select a different artifact.

Start with a small test that exercises instruction following rather than a generic greeting:

Create a three-row table with these columns: issue, likely cause, next check.
Do not invent facts that are not in the request.

Then test a task you actually care about. For example, paste a short, non-sensitive document and ask for a structured extraction. Record the response time, whether the format is valid, whether the model followed the constraints, and how much memory the process used. A greeting proves that the model loads. A representative task tells you whether the setup is useful.

Choosing 20B versus 120B

ChooseWhen it makes senseTrade-off
GPT-OSS 20BLocal experiments, extraction, drafting, lower latency, smaller machinesLower capability ceiling on difficult multi-step tasks.
GPT-OSS 120BHard reasoning, complex tool orchestration, higher-value private workflowsMuch larger memory and compute requirement.
A hosted modelIntermittent use, no GPU, or a need to scale quicklyProvider cost, network dependency, and data-policy review.
A two-model routerRoutine requests plus a smaller set of difficult casesMore application complexity and evaluation work.

Do not use parameter count as the only selection rule. Measure the task that matters. For a JSON extractor, compare valid-schema rate, missing fields, and latency. For a coding assistant, compare test pass rate and the number of edits needed after the first answer. For a private knowledge assistant, compare grounded-answer rate and whether the model cites the right retrieved passage.

It is also reasonable to keep both tags locally. Use 20B for quick classification and drafting, then route difficult or ambiguous requests to 120B. The router should be conservative: if a request involves a safety decision, a production change, or a high-value customer, send it for human review rather than assuming a larger model makes the decision safe.

Calling the local Ollama API

Ollama exposes a local HTTP API that lets an application send messages without controlling the terminal interactively. The current model page shows a chat endpoint at http://localhost:11434/api/chat. A minimal request looks like this:

curl http://localhost:11434/api/chat -d '{
  "model": "gpt-oss:20b",
  "messages": [{"role": "user", "content": "Summarize this note in three bullets."}]
}'

The exact response format and options can vary by Ollama version. Read the API documentation for streaming, JSON output, temperature, context, and keep-alive behavior before you build a client around one example. Pin the model tag and record the Ollama version in development notes.

Do not bind the local server to a public interface just to make a quick demo work. A local endpoint without authentication is not an appropriate internet-facing service. If another machine needs access, put the service behind a private network, firewall, reverse proxy, authentication layer, request limits, and output logging. Also decide whether prompts and responses may be stored.

Structured output and tool workflows

GPT-OSS is designed for tool use and structured outputs, but a model's ability to describe JSON is not the same as guaranteed schema compliance. Ask for a small schema, validate the response in application code, and retry or route to a fallback when validation fails. Never pass model-generated arguments directly to a destructive tool.

A good local agent has clear boundaries. The model proposes an action. Your application validates the action, checks permissions, calls the tool, and returns a constrained result. The model then explains the result. Keep credentials and authorization decisions outside the prompt. A system prompt can guide behavior, but it cannot replace access control.

For retrieval, keep the source passages labeled and ask for a citation or source ID in the response. Test what happens when the answer is not in the retrieved context. A local model should be allowed to say “not found” rather than filling the gap with a plausible sentence. This is especially important when the model is used for internal policy, customer support, or technical documentation.

Start with a narrow tool contract. Instead of giving the model access to ten actions, expose one read-only function and test whether it asks for the right arguments. Add a write action only after the read path is reliable. Keep the tool result separate from the model's instructions so a retrieved page or database field cannot quietly become a new system rule.

When a tool call fails, return a useful error that the model can understand without exposing credentials or internal stack traces. Ask it to explain what it attempted and what it needs next. This makes local debugging much easier than treating every failure as a generic “model error.”

Common problems and fixes

Out of memory. Stop other GPU-heavy applications, reduce the requested context, use the 20B model, or select a quantization and runtime supported by your hardware. A longer context consumes additional cache memory even after the model weights fit.

The first response is slow. The first request includes model loading. Compare warm and cold latency separately. Keep the model loaded when the workflow justifies the memory cost, and do not judge the local setup from the first token after a restart.

The model ignores instructions. Check that the runtime and client are using the correct chat template. Simplify the system prompt, provide one example of the required output, and test the same request in the official Ollama interaction before debugging your application.

JSON is invalid. Reduce the schema, ask for JSON only, validate it, and return the validation error in a controlled retry. If the task is critical, use a grammar or schema-constrained feature supported by your chosen runtime instead of relying on prose instructions alone.

The model is repetitive. Check whether the prompt is being duplicated, whether the context is being appended on every turn, and whether sampling parameters changed. Compare a clean single-turn request with the application request to isolate the problem.

The terminal cannot reach the server. Confirm that Ollama is running, that the endpoint is listening on the expected port, and that a simple local request works before investigating the model. A client error can be a service or network issue rather than a model issue.

Privacy, updates, and production readiness

Local inference can reduce the number of places a prompt travels, but the rest of the application still matters. Review logs, shell history, crash reports, telemetry, connected tools, editor extensions, and cloud model settings. Remove sensitive data from test prompts and use synthetic fixtures until the complete path is understood.

Keep model updates deliberate. A new artifact may improve quality, change memory use, or alter formatting. Pin the tag or digest in production, run your evaluation set after upgrades, and keep the previous version available for rollback. “Latest” is convenient for experimentation and risky as a production dependency.

Before sharing the endpoint with a team, add authentication and per-user limits. Track queue time, generation time, memory pressure, errors, invalid outputs, and user corrections. Decide what happens when the GPU is full. A graceful queue or fallback is better than a request that appears to hang.

Finally, document the model's role. Say whether it drafts, classifies, summarizes, retrieves, or recommends. Give users a way to report a bad answer. Local hosting gives you more control over the infrastructure; it does not remove the need for product design, evaluation, and human oversight.

A small evaluation set is worth the effort

Before you decide that GPT-OSS works for your use case, create a set of 20 to 50 representative tasks. Include normal examples, ambiguous examples, long inputs, missing information, malformed requests, and cases where the correct answer is to refuse or ask a question. Store the expected properties of the answer rather than forcing every answer to use identical wording.

For structured extraction, score whether the JSON parses, whether required fields are present, and whether the values match the source. For retrieval, score whether the answer is supported by the supplied passages. For drafting, ask a human reviewer to rate accuracy, completeness, tone, and the amount of editing required. For an agent, record the correct tool, the arguments, the number of retries, and whether the final action was authorized.

Run the same set after changing the model tag, quantization, context setting, system prompt, or Ollama version. This helps you distinguish a model improvement from a prompt change or a hardware change. Keep a short changelog with the date, configuration, and result. A local model is easy to update and therefore easy to change accidentally.

That record also makes it easier to explain why a local deployment changed and when to roll it back.

Sources and related pages

This guide uses the official Ollama GPT-OSS library page for the run commands and current artifact information, and OpenAI's open-weight model documentation for the model's availability and deployment context. Our GPT-OSS 120B guide explains the architecture and hardware decision in more detail. For prompt design, see prompt engineering fundamentals.

Questions readers usually ask

What command runs GPT-OSS in Ollama?

After installing Ollama, run ollama run gpt-oss:20b for the smaller model or ollama run gpt-oss:120b for the larger model. Ollama also supports the shorter gpt-oss alias, but using an explicit tag makes the model choice clearer in a repeatable setup.

How much memory does GPT-OSS need in Ollama?

Ollama lists the gpt-oss:20b artifact at about 14 GB and gpt-oss:120b at about 65 GB in its current library listing. Leave additional memory for the runtime, context cache, operating system, and other applications. OpenAI and Ollama describe the 120B model as targeting a single 80 GB GPU in its intended format.

Should I use GPT-OSS 20B or 120B?

Start with 20B for local experiments, lower latency, smaller GPUs, and routine extraction or drafting. Choose 120B when difficult reasoning quality matters and your machine can support the memory, context, and concurrency requirements.

Does running GPT-OSS in Ollama send my prompts to OpenAI?

A local Ollama model runs on your machine, so its inference requests do not need to be sent to OpenAI. Optional cloud models, web search tools, telemetry, connected applications, or your own integrations can change the data path, so inspect those settings before using sensitive information.

Can Ollama expose GPT-OSS as an API?

Yes. Ollama exposes a local HTTP API, including an endpoint such as http://localhost:11434/api/chat. Your application can call it locally, but you should add authentication, network controls, input limits, logging, and output validation before exposing it beyond the machine.

Recommended toolLovableBuild apps and websites by chatting, no coding required.Start building

Affiliate link, we may earn a commission at no extra cost to you.

Don't stop here

What to read next

Hand-picked guides our readers explore right after this one.