Skip to content
Neaptidestudio
blog

A local AI model for coding: your first run with Ollama

Neaptide · September 20, 2026 · 8 min read

Run a local coding model with Ollama: installation, HTTP API, a checkable Python task and performance troubleshooting.

On this page
Local computer beside a compact model block and code card.

A local model is easiest to try on a small piece of code: explain a function, suggest tests or find a bug. For a first experiment, a repeatable setup and a clear way to check the answer matter more than choosing the largest model.

Ollama runs models and provides an interface for calling them. This guide uses the local Qwen2.5-Coder 1.5B variant as a small learning example. It is neither a recommendation for today's best model nor a promise of reliable results on large projects. Model card.

Install Ollama and get a first answer

Follow the official installation instructions for your operating system, then start the app or service. In a terminal, run:

ollama --version
ollama run qwen2.5-coder:1.5b

The first run downloads the model, so you need an internet connection and free disk space. When the interactive prompt appears, ask a short coding question. Enter `/bye` to leave.

Do not judge speed from the first response alone: loading the model and generating an answer are separate stages. First establish that a small request produces a repeatable response.

A learning task with a checkable result

Ask for a function with explicit requirements:

Write a Python function unique_names(names). It takes a list of strings, trims surrounding whitespace, and removes empty strings and case-insensitive duplicates. Preserve the order of first occurrences and their spelling after trimming. Return the code and three tests. Do not add dependencies.

Define expected results before evaluating the answer:

assert unique_names([" Anna ", "anna", "", "BOB"]) == ["Anna", "BOB"]
assert unique_names([]) == []
assert unique_names([" A ", "a", "B", "b"]) == ["A", "B"]

These are the author's task criteria, not measured model results. Read the proposed code before running the checks in a test environment. If it changes the order or the first string's capitalization, identify the exact mismatch and ask for a correction.

This small exercise shows whether the model follows these particular instructions. It does not establish that it can modify a large repository independently.

Call the model from a program

Ollama exposes a local HTTP API. On macOS, Linux or WSL, a request can look like this:

curl http://localhost:11434/api/generate -d '{
  "model": "qwen2.5-coder:1.5b",
  "prompt": "Explain the difference between a Python list and a tuple.",
  "stream": false
}'

Here, `stream: false` requests one complete response instead of a stream of chunks. The fields are explained in the generate API documentation. This request checks API access; it does not automatically connect the model to every editor feature.

For editor integration, first check whether your chosen extension supports Ollama or a compatible local endpoint. Then specify the server address and the exact installed model name. Chat support does not imply support for every agentic coding tool.

What “local” means

Ollama states that it does not receive prompts or responses when a model runs locally. Cloud models follow a different processing path. Your editor, extensions and external tools may also contact their own services, so examine the whole setup. Ollama FAQ.

Ollama has a local-only mode for workflows without its cloud features. However, do not describe your workflow as fully offline until you have checked dependency downloads, extension requests and tool behavior. Use sample code for the first trial.

If responses are too slow

Run `ollama ps` to see loaded models and how execution is split between CPU and GPU. That helps locate the bottleneck. Check model placement.

Change one condition at a time: use a smaller model, shorten the input or reduce the configured context. Close other resource-heavy applications and repeat the same task. Do not automatically select the largest context window: model weights are only part of memory use.

Record the model and tag, hardware, context, prompt, elapsed time and test results. “It answered quickly” is not enough to select a useful configuration without checking the code.

faq

The short version

Can a small local model replace a cloud agent?

Evaluate the tasks you actually need separately: explaining code, fixing a function and editing multiple files. Success in one scenario does not automatically transfer to the others.

Do I need to buy a GPU immediately?

Start with your existing computer and a small model. Use the guide to RAM, VRAM and context (/en/blog/local-llm-ram-vram-context) to estimate memory needs, and base purchases on a measured limitation in your actual task.

How should I choose the next model?

Compare suitable candidates using the same prompts and predefined tests. Track speed and the number of manual corrections required to reach an acceptable result.