How-to · Local AI

Use Ollama in your code editor

You can use Ollama in your code editor to run an AI coding model entirely on your own computer: no API key, no per-token bill, and no prompts leaving your machine. This guide shows how to install Ollama, pull a coding model, check the local API, and connect it to an editor, including Code Crux. It also covers what local AI is genuinely bad at.

Join the waitlistPublished Oct 12, 2026 · Code Crux

Why run AI locally

Ollama is a free tool that downloads open models and runs them on your machine behind a small local API. Editors and extensions talk to that API the same way they would talk to a cloud provider. The reasons to bother:

  • Privacy. Prompts and the code you paste into them are processed on your own hardware.
  • No usage bill. Once the model is downloaded, running it costs only electricity.
  • Works offline. Useful on flights, on bad Wi-Fi, or on networks that block AI services.
  • Control. You choose the exact model and version, and it does not change under you.

Use Ollama in your code editor, step by step

The short version first, then each step in detail.

  1. 01

    Install Ollama

    On macOS or Windows, download the app from ollama.com/download and open it. On Linux, run the official install script: curl -fsSL https://ollama.com/install.sh | sh.

  2. 02

    Pull a coding model

    Download a model built for code, for example ollama pull qwen2.5-coder. The default tag is the 7B version, about 4.7 GB. Use a smaller tag such as qwen2.5-coder:3b on a modest laptop.

  3. 03

    Check the local API

    Ollama serves an API on 127.0.0.1 port 11434. Send a test prompt to http://localhost:11434/api/generate with curl and confirm a response comes back.

  4. 04

    Point your editor at Ollama

    In your editor or AI extension, choose Ollama as the provider, keep the default address http://127.0.0.1:11434, and enter the exact model name you pulled.

  5. 05

    Try it on real code

    Ask the local model to explain a function or write a test, and compare the result with a cloud model. Switch to a larger model if quality matters more than speed.

1. Install Ollama

On macOS and Windows, download the app from ollama.com/download and open it; the app runs Ollama in the background. On Linux, use the official script:

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

2. Pull a coding model

Models are downloaded once and stored locally. qwen2.5-coder is a solid, code-specialized starting point that comes in sizes from 0.5B to 32B parameters:

Terminal
ollama pull qwen2.5-coder      # 7B, about 4.7 GB
ollama pull qwen2.5-coder:3b   # smaller, for modest laptops
ollama list                    # show the models you have

3. Check the local API

Ollama listens on 127.0.0.1:11434 by default. Send a test request to the generate endpoint. Setting stream to false returns one complete answer instead of a stream of chunks:

Terminal
curl http://localhost:11434/api/generate -d '{
  "model": "qwen2.5-coder",
  "prompt": "Write a Python function that checks if a string is a palindrome.",
  "stream": false
}'

If you get JSON back with a response field, the model works. If the connection is refused, open the Ollama app (or run ollama serve on Linux) and try again.

4. Connect your editor

Most AI-capable editors and extensions have an Ollama option. The settings are nearly always the same three things: the provider (Ollama), the address (http://127.0.0.1:11434), and the model name exactly as ollama list prints it. A mismatched model name is the most common reason for “model not found” errors.

Choosing a local coding model

The right model depends more on your hardware than on leaderboards. Model files run from under a gigabyte to tens of gigabytes, and the model has to fit in memory to run at a usable speed.

  • Small (around 1.5B to 3B): fast on most laptops. Fine for completions, short explanations and boilerplate.
  • Medium (around 7B): the usual sweet spot. Good for explaining code, writing tests and small refactors.
  • Large (14B and up): noticeably better reasoning, but needs a lot of memory and answers more slowly.

Code-focused families to try include qwen2.5-coder, codellama and deepseek-coder. Test two or three on your own code; the one that understands your stack matters more than any benchmark.

Using Ollama in Code Crux

Code Crux is a collaborative, AI-native code editor with a built-in agent panel. Its model picker lists Ollama Local Engine alongside cloud options. Crux is pre-launch, so this describes the current build and may change.

  • Install Ollama and pull a model, as above.
  • Open the agent panel and open the model picker. Choose Ollama Local Engine.
  • Open the agent settings from the picker and enter the model name you pulled. Presets include codellama, llama3.2, qwen2.5-coder and deepseek-coder; codellama is the default.
  • Activate it and ask a question. Crux sends the prompt, with the file you are working in, to Ollama’s generate endpoint at http://127.0.0.1:11434.

Because Ollama listens on your own computer, the connection works when Crux and Ollama run on the same machine. Crux expects a reasonably quick reply, so a 7B-or-smaller model is the best place to start.

In a shared workspace, each person can pick their own model: one teammate on a local model, another on a cloud model, all in the same project. That is part of what makes vibe coding with friends work. Join the waitlist to try it, see the docs for the IDE controls, and check pricing for plans.

If your editor runs in the browser

Browsers block web pages from calling other addresses unless the server allows it. According to the Ollama FAQ, Ollama accepts cross-origin requests from 127.0.0.1 and 0.0.0.0 by default. To let a browser-based editor on another address reach it, add that address to OLLAMA_ORIGINS and restart Ollama. On macOS:

macOS
launchctl setenv OLLAMA_ORIGINS "https://your-editor.example"
# then quit and reopen the Ollama app

On Linux, add the variable to the Ollama systemd service; on Windows, set it as a user environment variable and restart Ollama. Only allow origins you trust: any page you allow can use your local model.

Privacy: what stays local, and what does not

Ollama’s FAQ is direct about this: when you run models locally, Ollama does not see your prompts or data. Two caveats keep that honest.

  • Ollama also offers optional cloud models. Those are processed on Ollama’s servers. You can switch cloud features off with OLLAMA_NO_CLOUD=1.
  • A local model only covers the AI step. Your editor, extensions, sync and Git hosting still handle your code the way they always do. In a collaborative workspace, your code is shared with your collaborators by design.

Honest limits of local AI coding

  • Quality. Small and medium local models trail the strongest cloud models on hard reasoning and large multi-file changes.
  • Hardware. Larger models need a lot of memory and run slowly on machines without a capable GPU or Apple silicon.
  • Context. Local models often work with smaller context windows, so they see less of your codebase at once.
  • Setup and upkeep. You download multi-gigabyte files, pick versions and update them yourself.
  • Agent work. Long autonomous agent runs that edit many files are where cloud models still have the clearest edge.

A practical setup for many people is both: a local model for everyday questions and private code, and a cloud model for the hard problems. See how editors handle that mix in our vibe coding tools comparison, and read the risks of vibe coding before trusting any model’s output unreviewed. For head-to-head editor comparisons, see Crux compared with other tools or Crux vs Cursor; if you code with a partner, the pair programming guide shows how to share a workspace.

Ollama code editor FAQ

Can I use Ollama as a coding assistant?

Yes. Pull a code-focused model such as qwen2.5-coder or codellama, and connect any editor or extension that supports Ollama to its local API at http://127.0.0.1:11434.

What port does Ollama use?

Ollama listens on 127.0.0.1 port 11434 by default. You can change the address with the OLLAMA_HOST environment variable.

Is a local AI model private?

When you run a model locally, prompts are processed on your machine; Ollama states it does not see your prompts or data when you run locally. Ollama’s optional cloud models are different, and can be turned off with OLLAMA_NO_CLOUD=1.

Which Ollama model is best for coding?

There is no single best one. Code-specialized models such as qwen2.5-coder, codellama and deepseek-coder are good starting points. Pick the largest size your hardware runs comfortably, and test on your own code.

Why can’t my browser-based editor reach Ollama?

By default Ollama only accepts cross-origin requests from 127.0.0.1 and 0.0.0.0. Add the editor’s web address to the OLLAMA_ORIGINS environment variable and restart Ollama.

Does Code Crux support Ollama?

Yes. The Code Crux model picker lists Ollama Local Engine. Crux sends prompts to Ollama at http://127.0.0.1:11434, and you set the model name in the agent settings. Crux is pre-launch, so details may change.

Pre-launch · Waitlist open

Code with your team and your AI agents in one live workspace.

Code Crux is a collaborative, AI-native code editor that runs in the browser. Join the waitlist to get access as it opens up.