Using Noir with Ollama
Integrate Noir with Ollama for local LLM-powered code analysis.
Run large language models locally using Ollama for code analysis without sending data to external services.
Setup
-
Install Ollama: Download from ollama.com
-
Download a Model: Pull a model (e.g.,
gemma4)ollama pull gemma4 -
Start the Server:
ollama serve
Usage
noir scan ./spec/functional_test/fixtures/hahwul \
--ai-provider=ollama \
--ai-model=gemma4
Notes
- The
ollamapreset talks to Ollama's native/api/generateAPI, not the OpenAI-compatible/v1mount. Noir setsnum_ctxto the prompt budget it sized its requests for, so long prompts are not cut to Ollama's small default context. - A hosted Ollama or an authenticating proxy can take a bearer token from
--ai-keyorNOIR_AI_KEY. --ai-streamdoes not apply to this provider.- A custom URL uses the native API only when its host contains
ollama(for examplehttp://ollama.internal:11434). Any other host, such ashttp://gpu-box:11434, goes through the OpenAI-compatible client, so include the mount:--ai-provider=http://gpu-box:11434/v1.
v0 → v1 migration: The standalone
--ollama/--ollama-modelflags were removed in v1.0. Use the unified--ai-provider ollama --ai-model NAMEform (shown above).