# Extension points — ollama/ollama

> Canonical page: https://codevetter.com/unpack/ollama/extension-points

# Extension points — ollama/ollama

Scanned commit 6383a0fa9cbf97494b847226e189f6e36b401a08 (2026-09-18). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Deliberate plug-in surfaces: per-model-family Parser and Renderer registries (name-keyed constructors with a switch fallback), embedded named chat templates, the llm.LlamaServer runner interface, cobra command table, launch.Default* UI hooks, middleware translators for new API dialects, envconfig's AsMap registry, and the create/ import pipeline stages.
- New output parsers plug in via parsers.Register(name, constructor) or a case in ParserForName's switch; Parser interface = Init/Add/PreservedTokens/HasToolSupport/HasThinkingSupport — [model/parsers/parsers.go#L12-L107](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/model/parsers/parsers.go#L12-L107)
- New prompt renderers plug in via renderers.Register or rendererForName switch; Renderer interface = Thinking/Render/LeadingBOS; RenderImgTags global toggles [img] tag emission — [model/renderers/renderer.go#L10-L60](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/model/renderers/renderer.go#L10-L60) [server/routes.go#L116-L118](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/routes.go#L116-L118)
- Named Go templates are added as .gotmpl+.json pairs embedded via go:embed and indexed in template/index.json; template.Named resolves by GGUF chat_template name for autodetection — [template/template.go#L22-L40](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/template/template.go#L22-L40) [server/model.go#L99-L138](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/model.go#L99-L138) [template/index.json](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/template/index.json)
- New inference backends implement llm.LlamaServer (Completion/Chat/Embedding/Tokenize/WaitUntilRunning/Close/...) and get wired through Scheduler.newServerFn or the IsMLX branch (mlxrunner.Client) — [llm/server.go#L58-L77](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/llm/server.go#L58-L77) [server/sched.go#L77-L104](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/sched.go#L77-L104) [mlxrunner/client.go#L32-L40](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/mlxrunner/client.go#L32-L40)
- New API dialects slot into GenerateRoutes as gin middleware translators in middleware/ (ChatMiddleware, CompletionsMiddleware, ResponsesMiddleware, AnthropicMessagesMiddleware, TranscriptionMiddleware) wrapping the core handlers — [server/routes.go#L1935-L1946](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/routes.go#L1935-L1946) [middleware/openai.go#L27-L80](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/middleware/openai.go#L27-L80) [middleware/anthropic.go](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/middleware/anthropic.go)
- New CLI commands register in NewCLI's command table; hidden/internal commands (runner, gpu-discover) show the pattern for plumbing sub-binaries through the same binary — [cmd/cmd.go#L2393-L2600](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/cmd/cmd.go#L2393-L2600) [cmd/cmd.go#L2569-L2590](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/cmd/cmd.go#L2569-L2590)
- Interactive UI is swappable via launch.Default* function hooks (SingleSelector, MultiSelector, SignIn, Upgrade, ConfirmPrompt, Spinner) — cmd/cmd.go's init() replaces them with Bubbletea TUI implementations — [cmd/cmd.go#L62-L99](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/cmd/cmd.go#L62-L99)
- New environment settings register in envconfig: typed accessors (Bool/Uint/String/BoolWithDefault) plus an entry in AsMap() so `ollama serve` logs and help list them — [envconfig/config.go#L177-L290](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/envconfig/config.go#L177-L290) [envconfig/config.go#L313-L341](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/envconfig/config.go#L313-L341)
- GPU backends are build-time extensions: OLLAMA_LLAMA_BACKENDS selects cuda_v12/cuda_v13/rocm_v7_1/rocm_v7_2/vulkan/jetpack variants; runtime discovery globs lib/ollama/*/ggml-* dirs — [docs/development.md](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/docs/development.md) [discover/runner.go#L45-L58](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/discover/runner.go#L45-L58)
- Safetensors import is a staged pipeline in create/ (classify -> transform -> prequant -> quantize -> writer -> manifest) with per-architecture files (gemma4.go, qwen35.go, cohere2moe.go, glimmer.go, nemotron_h.go, laguna.go) — new architectures add a file + classification entry — [create/create.go#L73-L100](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/create/create.go#L73-L100) [create/classify.go](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/create/classify.go) [create/pipeline.go](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/create/pipeline.go) [create/transform.go](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/create/transform.go)
- Model capabilities are declared via model.Capability flags (completion, tools, insert, vision, audio, embedding, thinking, image) checked through Model.CheckCapabilities, gating handler behavior per request — [server/images.go#L41-L52](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/images.go#L41-L52) [server/images.go#L137-L140](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/images.go#L137-L140) [server/sched.go#L179-L182](https://github.com/ollama/ollama/blob/6383a0fa9cbf97494b847226e189f6e36b401a08/server/sched.go#L179-L182)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
