Skip to content
A modern, clean desktop PC tower rests on a warm, tidy wooden developer desk

How to run DeepSeek R1 locally with Ollama and Open WebUI

AT A GLANCE

The easiest way to run DeepSeek R1 locally is to install Ollama, pull a distilled model that fits your memory, and start it from a terminal.

  • Fastest setup: Install Ollama, then run ollama run deepseek-r1:7b.
  • Hardware rule: The model size is a rough guide to memory needs, while context length adds more overhead.
  • Web access: Open WebUI can provide a browser interface connected to Ollama.
  • Developer access: Ollama exposes a local HTTP API at http://localhost:11434.

Your best model depends on available RAM or video memory, operating system, GPU support, and the context length you need.

What Is DeepSeek-R1?

DeepSeek-R1 is a reasoning-focused large language model (LLM) designed for tasks such as coding, mathematics, analysis, and question answering. Running it locally means the model processes prompts on your computer instead of sending them to a hosted AI service.

  • Reasoning output: R1 can spend additional computation working through difficult prompts before producing an answer.
  • Local processing: Your prompts and generated responses remain on your machine unless you connect the model to another service.
  • Distilled variants: Smaller models based on R1 are available for ordinary desktop and laptop hardware.
  • Model files: Downloaded weights can occupy several gigabytes, so check free storage before installation.

DeepSeek-R1 does not automatically know your private files or website content. You must explicitly provide that data through a prompt, a local application, or a retrieval system, and you should still review generated code before using it.

Which DeepSeek-R1 model should you choose for your hardware?

Choose the smallest model that gives acceptable answers on your workload. Ollama model tags commonly include distilled sizes such as 1.5B, 7B, 8B, 14B, 32B, and 70B, where B means billions of parameters.

Model tag Practical starting point Best use Main limitation
deepseek-r1:1.5b 8 GB RAM Testing and short prompts Weaker coding and reasoning
deepseek-r1:7b 16 GB RAM General desktop use Slower with long context
deepseek-r1:14b 24 GB RAM Coding and analysis Needs more memory and storage
deepseek-r1:32b 32 GB or more Higher-quality local work May run slowly without a capable GPU
deepseek-r1:70b 64 GB or more Large local deployments Heavy memory and compute demand

These are starting estimates, not guaranteed requirements. Quantization, which stores model weights with reduced numerical precision, can lower memory use, while a larger context window increases it. Re-check the current Ollama library tag and model size before downloading because model packaging changes.

How do you install Ollama on Windows, macOS, or Linux?

Install Ollama from its official download page for Windows or macOS, then open a new terminal. On Linux, the official installation command is:

curl -fsSL https://ollama.com/install.sh | sh

After installation, verify that the command is available:

ollama --version

On macOS and Windows, launch the Ollama application once so its local service can start. On Linux, run ollama serve in a terminal if the service did not start automatically. Ollama’s official documentation lists the supported operating systems and installation changes, so re-check it before following an older command.

Why use Ollama for local DeepSeek-R1?

Ollama manages model downloads, starts a local inference service, and provides both a command-line interface and an HTTP endpoint. That removes much of the manual setup associated with loading model files directly through a machine-learning runtime.

  • Simple model management: Use ollama pull, ollama list, and ollama rm to manage local models.
  • Local endpoint: Applications can send requests to port 11434 without exposing the service to the public internet.
  • Hardware support: Ollama can use supported graphics processing units (GPUs) and fall back to the central processing unit (CPU).
  • Custom settings: A Modelfile lets you set context length, temperature, a system prompt, and other runtime parameters.

For a container-based setup, first review how Docker containerization works for developers, since Open WebUI is often installed as a container.

How do you download and run DeepSeek-R1 with Ollama?

Use Ollama’s pull and run commands to download a model and open an interactive chat. Start with a smaller tag if you are testing the workflow.

How do you pull a DeepSeek-R1 model?

Download the 7B model with:

ollama pull deepseek-r1:7b

Then check the downloaded models and their local storage:

ollama list

Replace 7b with 1.5b, 14b, or another tag that fits your hardware. The first pull requires internet access, and the download can take time on a slow connection.

How do you start a DeepSeek-R1 chat?

Start an interactive terminal session with:

ollama run deepseek-r1:7b

Enter a prompt such as Explain this PHP function and identify one security risk. Type /bye to exit. For a single prompt, use:

ollama run deepseek-r1:7b 'Write a semantic HTML form for a newsletter signup'

Generated code may contain incorrect syntax or unsafe assumptions. Test it in a separate project, run a linter, and do not paste secrets, API keys, or production credentials into prompts.

How do you adjust context, temperature, and GPU settings?

Create a file named Modelfile to control repeatability and context:

FROM deepseek-r1:7b
PARAMETER num_ctx 8192
PARAMETER temperature 0.2
SYSTEM You are a concise web development assistant.

Build a named model and run it:

ollama create deepseek-web -f Modelfile
ollama run deepseek-web

num_ctx sets the context window, while temperature influences variation. A lower temperature often suits code generation, but it does not guarantee correct output. GPU selection depends on Ollama’s current platform support and drivers, so check the official Ollama hardware documentation rather than forcing an unsupported flag.

How do you use DeepSeek-R1 through an OpenAI-compatible API?

Ollama provides an OpenAI-compatible route for applications that already know how to send chat completion requests. Keep the service bound to your local machine unless you have deliberately configured authentication and network controls.

The local API is useful for a web development API integration, a code editor extension, or a private script that sends structured prompts.

How do you send requests with cURL?

With Ollama running, send a chat request to port 11434:

curl http://localhost:11434/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"deepseek-r1:7b","messages":[{"role":"user","content":"Explain CSS Grid in 3 sentences."}],"stream":false}'

The response contains the assistant message in the JSON result. The exact response fields can change, so check Ollama’s current API documentation when connecting a production application.

How do you call the local model from Python?

Python can call the same endpoint with the standard requests package:

import requests

payload = {
    'model': 'deepseek-r1:7b',
    'messages': [
        {'role': 'user', 'content': 'Review this JavaScript for an input validation bug.'}
    ],
    'stream': False
}

response = requests.post(
    'http://localhost:11434/v1/chat/completions',
    json=payload,
    timeout=120
)
response.raise_for_status()
print(response.json()['choices'][0]['message']['content'])

Set a timeout that matches your hardware and prompt length. Never expose this endpoint directly from a public web server without access controls, request limits, and network filtering. For related web security risks, see how to prevent server-side request forgery attacks.

How do you add a web interface with Open WebUI?

Open WebUI adds a browser-based chat interface to Ollama. A Docker installation can use:

docker run -d \
  -p 3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main

Open http://localhost:3000 in your browser and configure the Ollama connection. If Ollama runs on the host while Open WebUI runs inside Docker, the host gateway setting allows the container to reach the host service. Open WebUI’s documentation may change its image tags and connection instructions, so re-check those values before deployment.

How do you improve DeepSeek-R1 performance locally?

Performance improves most when you match model size and context length to your available memory. A larger model is not automatically better for short coding tasks if it spends most of its time swapping data between RAM and storage.

Should you choose a smaller distilled model?

Yes, choose a distilled model when you have limited memory or need faster responses. The 1.5B and 7B variants are sensible starting points for laptops, while 14B and larger models suit machines with more RAM or video memory.

Test the same 3 prompts on 2 candidate models and compare correctness, response time, and memory use. This practical test is more useful than relying on a generic speed claim because drivers, quantization, processor type, and prompt length all affect results.

How should you manage memory, context length, and quantization?

Reduce num_ctx when the model becomes slow or your system starts using swap space. Close memory-heavy applications before starting a larger model, and keep several gigabytes of free storage for model files and temporary data.

  • Context: Start with 4096 or 8192 tokens, then increase it only when your task needs longer input.
  • Quantization: Prefer a quantized model when memory is limited, accepting that reduced precision can affect output quality.
  • Prompts: Give the model the relevant files, constraints, and expected output format instead of sending an entire codebase.
  • Monitoring: Use your operating system’s process monitor to check RAM, GPU memory, CPU load, and swap activity.

Do not treat local execution as a security guarantee. A compromised plugin, web interface, or script can still read local files or send data elsewhere.

How do you troubleshoot common installation and runtime problems?

Most failures come from a missing Ollama service, an incorrect model tag, insufficient memory, or a blocked local port. Work through these checks in order:

  1. Run ollama --version to confirm the command is installed.
  2. Start the service with ollama serve if the application is not already running.
  3. Run ollama list and compare the model name with the tag in your command.
  4. Try deepseek-r1:1.5b to determine whether the larger model exceeds available memory.
  5. Check whether another process is using port 11434, then review Ollama’s current logs for driver errors.

A response that stops midway can indicate memory pressure, a short timeout, or an interrupted stream. Lower the context length, close other applications, use a smaller model, and increase the client timeout before changing several settings at once.

What are the alternative ways to run DeepSeek-R1?

Ollama is the simplest route, but other applications give you different controls over the interface, model files, or serving layer.

How do you run DeepSeek-R1 with Jan?

Jan provides a desktop interface for downloading and chatting with local models. Install the current desktop release, search its model catalog for a compatible DeepSeek-R1 variant, download it, and select it in a new chat.

Jan is useful if you want a graphical setup without managing terminal commands. Confirm the model’s memory requirements and supported operating system in Jan’s current documentation before downloading it.

When should you use llama.cpp or vLLM?

Use llama.cpp when you need direct control over GGUF model files, quantization, or CPU and GPU offloading. Use vLLM when you are serving a supported model to multiple clients and need a higher-throughput inference server.

These tools require more configuration than Ollama, including compatible model formats, drivers, Python packages, and launch arguments. Follow the current official documentation for each project because supported architectures and flags change faster than a typical desktop application.

What should you know before running DeepSeek-R1 locally?

Local DeepSeek-R1 is practical for private experiments, coding assistance, and offline workflows, but it does not remove the need for technical safeguards. Treat model output as untrusted text, especially when it suggests shell commands, database queries, authentication code, or file operations.

Does DeepSeek-R1 work without an internet connection?

After Ollama has downloaded the model, the inference process can run offline. Internet access is still needed for installation, model updates, and any external tools or applications you connect to it.

Can a normal laptop run DeepSeek-R1?

Many laptops can run the smaller 1.5B or 7B variants, although response speed depends on memory, processor, GPU, and context length. Start with the smallest available model and move up only after checking system memory during a real prompt.

Is local DeepSeek-R1 free?

Ollama and several desktop runners can be installed without a hosted inference subscription, but you still pay in electricity, storage, hardware, and setup time. Software licenses and model terms can change, so check the current license before commercial distribution.

Can you use DeepSeek-R1 as a coding assistant?

Yes, you can call it from a terminal, Python script, local web interface, or editor integration. For a reliable setup local DeepSeek code assistant workflow, provide small, relevant code excerpts, request a patch or explanation, and run tests before accepting changes.

How do you stop Ollama?

Close the Ollama application on Windows or macOS, or stop the service using your Linux service manager. If you started it manually in a terminal, press Ctrl+C in that terminal. Re-check the current Ollama service instructions if your installation method differs.