How to Use Local AI in IntelliJ with Ollama and Continue
Keep code on your PC: run Ollama locally and connect it to IntelliJ through the open-source Continue plugin (same ~/.continue/config.yaml idea as VS Code). Good for students who want private practice without cloud tokens.
In short: install Ollama, ollama pull qwen2.5-coder:7b (and a small autocomplete model), install Continue from the JetBrains Marketplace, point provider: ollama in config, reload, then chat. Honest note: Continue’s JetBrains plugin is community-maintained; Continue also recommends the Continue CLI (cn) beside your IDE — both are valid.
Why local AI in IntelliJ
Cloud assistants are great, but class assignments and client code sometimes must stay offline. Ollama runs the model on your machine. Continue is the bridge many JetBrains + VS Code users share with one config file.
What you need
- Ollama: macOS / Linux / Windows install from ollama.com. Enough RAM for the model (8GB minimum habit; 16GB+ more comfortable).
- Coding models: Example tags used in our VS Code lesson:
qwen2.5-coder:7bfor chat,qwen2.5-coder:1.5bfor autocomplete — pull exact tags; they change. - Continue plugin: JetBrains Marketplace search “Continue”. Same config family as VS Code’s
Continue.continue. - Optional CLI: Continue docs push active development toward the Continue CLI (
cn) if the plugin feels stale.
How it connects
Install steps
- Install Ollama. Check:
ollama --version. - Start the service if needed (
ollama serveon some setups). Check:curl http://localhost:11434→ “Ollama is running”. - Pull models with
pull(not interactiverun):ollama pull qwen2.5-coder:7bandollama pull qwen2.5-coder:1.5b. Confirm withollama list. - IntelliJ → Settings → Plugins → Marketplace → install Continue → restart.
- Open the Continue tool window / sidebar.
- Open config (gear → config.yaml). Paste an Ollama block (sample below). Model names must match
ollama listexactly. - Reload config. Pick the Qwen chat model. Ask a tiny question.
Configuration
~/.continue/config.yaml (sample)name: Local Config (JetBrains)
version: 0.0.1
schema: v1
models:
- name: Qwen2.5-Coder 7B
provider: ollama
model: qwen2.5-coder:7b
apiBase: http://localhost:11434
roles:
- chat
- edit
- apply
- name: Qwen2.5-Coder 1.5B
provider: ollama
model: qwen2.5-coder:1.5b
roles:
- autocompleteapiBase: http://localhost:11434is the usual local URL.- Use a small model for
autocompleteso typing stays snappy. - If IntelliJ cannot reach Ollama, check firewall / WSL networking; Continue logs under
~/.continue/logs/often show the failure. - Same file can also list DeepSeek or xAI providers — pick per task.
Settings tips
- Turn off autocomplete if Copilot + Continue both suggest at once.
- Keep @-file context small — local models choke on huge pastes.
- If the Marketplace plugin misbehaves, try Continue’s CLI (
cn) in the IntelliJ terminal with the same config — Continue’s own JetBrains README steers active work there. - JetBrains AI Assistant can also talk to Ollama, but that path needs a JetBrains AI subscription (Ollama’s JetBrains page) — different product from Continue.
First task (5 minutes)
Write a Kotlin function isValidIfsc(s: String): Boolean for the common 11-character IFSC shape (basic pattern only). Return only the function. I will test it.
- Apply to a new file only if the diff is clear.
- Write 3 asserts yourself (or ask for tests, then edit).
- Reject any request to read secrets.
| Path | Privacy |
|---|---|
| Ollama + Continue (this lesson) | Model + code stay on your PC |
| Cloud Copilot / Claude / Antigravity | Code leaves the machine (policy dependent) |
| JetBrains AI + Ollama | Local models possible; needs JetBrains AI subscription per Ollama docs |
ollama list and fix the yaml — never invent a tag.- Local is safer for private drills, but malware on your PC can still read files — keep secrets out of the repo.
- Company may still ban any AI tooling — ask.
Quick quiz
1. Which provider string for Ollama in Continue?
ollama.
2. Where is shared config?
Usually ~/.continue/config.yaml.
3. Why prefer ollama pull over run for setup?
pull downloads without starting an interactive chat session.
4. Continue JetBrains plugin status?
Community-maintained; Continue also recommends the CLI (cn).
Save tokens and money
Local models are “free” of API fees but cost electricity and RAM. Use a 1.5B-class model for autocomplete; save larger models for hard chat.