MSSamara Stack

Home › Articles

How to run AI models on your own machine with Ollama

Moath Samara · Published October 17, 2026

Running an AI model on your own machine means what you type stays with you, and you do not pay a provider for every request. Ollama makes it a one-command job. This guide follows the official docs, from installation to calling the model from code.

Last checked against the official docs on October 17, 2026. Model names and sizes change often, so check the sources at the end before you follow along.

What you need

Step 1: Install Ollama

Download Ollama from ollama.com/download. Open the app, or start from the terminal by typing the command below and following the prompts:

ollama

On Linux you can install with one command:

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

If the server is not running on Linux, start it with ollama serve. To check that everything works, run ollama -v.

Step 2: Run your first model

One command downloads the model and opens a chat on your machine:

ollama run gemma4:e2b

Wait for the download, then type your question. To leave the chat, type /bye.

The model name is the one in the official docs at the time of writing. Browse other models at ollama.com/search and pick one that fits your machine's memory. Try a question in Arabic before relying on any model: Arabic quality varies between models.

Step 3: Use the model from code

Ollama runs a local server on your machine. Pull the model first:

ollama pull gemma4:e2b

Then send a request to the local server:

curl http://localhost:11434/api/chat \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma4:e2b",
    "messages": [
      {"role": "user", "content": "Say hello in one sentence."}
    ],
    "stream": false
  }'

The answer is in the field message.content. Ollama also offers OpenAI- and Anthropic-compatible endpoints for part of their features, such as http://localhost:11434/v1/chat/completions, so many tools can connect to your local model. See the compatibility page in the docs for what is supported.

Windows note: in PowerShell the command may need curl.exe and different quoting. You can also use Python or WSL.

Step 4 (optional): try a coding agent with a local model

From your project folder, launch a coding agent through Ollama:

ollama launch claude

Ollama offers to install Claude Code if you do not have it, then asks you to choose the model. Try a simple request such as Explain how this repository is organized. Ollama supports Codex CLI and OpenCode the same way. If the command is not found, update Ollama.

Local or cloud models?

Ollama shows two kinds of models. Local models run on your machine and need no API key. Cloud models need a sign-in and an API key, and they run on Ollama's servers, not on your machine. This guide covers local models.

Common problems

FAQ

Do I need an account or an API key?

Not for local models. The official docs say sign-in is needed only for cloud models.

Do I need internet?

Downloading the app and the model needs a connection. After that, a local model runs on your machine.

Does it understand Arabic?

It depends on the model you choose, not on Ollama. Test it with Arabic questions from your own field before relying on it.

A new tool every day

I post a free AI tool on X every day, and all sources and paths live in the library.

Follow on X   Open the library

Sources