An Emacs package for interacting with local LLMs via Ollama, with support for remote providers (OpenAI, Claude, Gemini, Grok, Copilot, Codestral, DeepSeek, OpenRouter, OpenCode Go) and Ollama Cloud models. Requires Emacs 29.1+.
(use-package ollama-buddy
:ensure t
:bind
("C-c o" . ollama-buddy-role-transient-menu)
("C-c O" . ollama-buddy-transient-menu))That’s it!, start ollama serve, open Emacs, press C-c o, select [o] to open chat, and go, here is what will be presented:
There are videos demonstrating functionality:
https://www.youtube.com/@OllamaBuddyforEmacs
For a deeper dive have a ganders at:
- Full README – Detailed README tutorials, transient menu guide, and role setup
See - Videos
Demonstrating in-buffer in-line modification, now we are out of the chat buffer!
LLMs can invoke Emacs functions: read/write files, execute shell commands, search buffers, and more.
Demonstrating advanced ollama tool calling with multiple tools working together.
Submit queries, swap models, view token usage and statistics:
- Plan Mode – Structured task planning with org-mode TODO integration.
/plangenerates a step-by-step plan as TODO headings; cycle states withS-<right>; execute steps with/plan-next(with full tool calling support) - Tool Calling – LLMs can invoke registered Emacs functions (file ops, shell commands, buffer search, calculations). Safe mode restricts to read-only tools; unguarded mode (
☠) bypasses all prompts for uninterrupted execution. - Multiple Providers – Local Ollama, Ollama Cloud, OpenAI, Claude, Gemini, Grok, GitHub Copilot, Codestral, DeepSeek, OpenRouter, OpenCode Go, and any generic OpenAI-compatible server (LM Studio, llama.cpp, vLLM, Jan…)
- Web Search – Inline
@search(query)syntax for real-time web search via Ollama’s API - Interactive Menus – Transient popup menus with role-based command grouping
- Roles & Presets – Switchable command configurations (developer, writer, tutor, documenter, custom); each command carries a
:destinationhint (chatorin-buffer) so rewrites go to the right place automatically - Sessions & History – Save/load conversations, prompt history navigation
- Thinking Block Folding – Reasoning model output (
<think>tags, DeepSeek API) rendered as collapsible org headings;TABon the heading to peek mid-stream - File Attachments – Attach files and images (vision models) to conversations
- Model Management – Pull, delete, copy models; categorized recommendations; cloud model support
- Multishot & Benchmark – Send the same prompt to multiple models simultaneously; benchmark all models in one command with per-model timeout
- Parameters – Full control over temperature, top_k, top_p, and all Ollama API options
- Token Tracking – Real-time token usage statistics with graphs
- Skills – Specialized AI personas and task-specific instructions integrated into the User Prompts library; use `/skill` slash command or `@skill(name)` for inline expansion
- RAG – Index local documents and source code; retrieve relevant context via semantic search; inline
@rag(query)syntax; configurable embedding backend (Ollama/api/embedor any OpenAI-compatible/v1/embeddingsservice, e.g. LM Studio) - In-Buffer Replace – Stream LLM output directly into the source buffer, replacing the selected region in-place; accept/reject confirmation; inline diff view (
C-c d) with word-level smerge highlighting; automatic code-fence stripping
A cross-cutting view of key features across the major chat clients, to the best of my knowledge, I will try and keep up-to-date, but things are moving quickly!
| Feature | gptel | chatgpt-shell | ellama | org-ai | ollama-buddy |
|---|---|---|---|---|---|
| Zero-config Ollama | No | No | No | No | Yes |
| Works in any buffer | Yes | Yes | Yes | Yes | Yes |
| Dedicated chat buffer | Yes | Yes | Yes | Yes | Yes |
| Org-mode native output | Yes | Yes | Yes | Yes | Yes |
| Streaming | Yes | Yes | Yes | Yes | Yes |
| Vision / image input | Yes | Yes | Yes | No | Yes |
| Thinking block support | Yes | Yes | Yes | No | Yes |
| Tool calling | Yes | Yes | Yes | No | Yes |
| MCP support | Yes | No | Yes | No | No |
| RAG / document indexing | No | No | Yes | No | Yes |
| Web search integration | No | No | No | No | Yes |
| In-buffer replace / rewrite | Yes | No | Yes | No | Yes |
| Inline code completion | No | No | No | No | Yes |
| Session save/load | Yes | Yes | Yes | Yes | Yes |
| Transient menu | Yes | No | Yes | No | Yes |
| Prompt history | No | Yes | No | No | Yes |
| Multi-model comparison | No | No | No | No | Yes |
| Slash commands | No | No | No | No | Yes |
| Image generation | No | Yes | No | Yes | No |
| Speech input/output | No | No | No | Yes | No |
| Project integration | No | No | No | No | Yes |
| Ollama Cloud models | No | No | No | No | Yes |
| Curl backend fallback | No | No | No | No | Yes |
| MELPA | Yes | Yes | Yes | Yes | Yes |
| Emacs requirement | 27.1 | 28.1 | 28.1 | 27.1 | 29.1 |
Kimi K2.6 cloud model support.
- Kimi K2.6 Cloud Model – Added
kimi-k2.6:cloudtoollama-buddy-cloud-models(appears inC-c mwith the☁indicator). Moonshot AI’s native multimodal agentic model, running on Ollama’s cloud (NVIDIA Blackwell hardware) with long-horizon coding, coding-driven design, autonomous execution, and swarm orchestration capabilities. Requires a paid Ollama cloud subscription (https://ollama.com/upgrade) – without one, prompts return an authentication error pointing to the upgrade page. Most other entries inollama-buddy-cloud-modelsstill run on the free tier.
Response post-processing hook and a thinking-block point-anchor fix.
- =ollama-buddy-response-post-process-functions= – New hook run on the streamed response region just before markdown-to-org conversion. Each function is called with
(START END)buffer positions and may edit the region freely. - =ollama-buddy–normalize-numbered-lists= – Default hook entry that splits glued numbered-list items of the form
N. [CATEGORY] ...onto their own lines when dense models (notably cloud gemma) emit them as a single paragraph. Idempotent on already-clean input. - Thinking-block point anchor fix – Fixed the first response token being inserted at the top of the folded thinking block instead of after
*** Response. Both the API-style (message.thinking) and tag-style (</think>) paths now re-anchor to(point-max)afterfinalize-thinking-blockreturns. - Emacs Blog Reviewer prompt – New user prompt that reviews an Emacs blog post for grammar and technical accuracy (function/variable names, key bindings, elisp syntax, deprecated APIs, version claims). One-line-per-issue output format.
Directory-scale project annotation via structured output.
- =/annotate-dir= – Batch-annotate every source file in a directory. Each file is attached, sent as its own request, and the returned JSON is auto-applied to
.simply-annotations.elwhen the response finishes. Prefix arg recurses. Cancel with/annotate-cancel. - Context-aware batching – Estimated token cost (chars / 4) is checked against the current model’s context window; oversized files are skipped. Configurable via
ollama-buddy-annotate-context-reserve(default 0.5). - Structured-output skill auto-load – The batch installs the
Annotate Projectskill and its#+FORMAT:JSON schema before starting, so structured output is guaranteed. The schema now allowsfile,defun, andlinetags. - =C-c A= – New chat-buffer binding for
ollama-buddy-annotate-apply-last-response. - New cloud models – Added
deepseek-v3.2:cloud,gemini-3-flash-preview:cloud,qwen3-next:80b-cloud, andnemotron-3-super:cloud.
Direct launch support for external agents.
- Direct Agent Launch – The
/launchsystem now supports external tools that are not built-inollama launchintegrations. Registry entries with:direct tare invoked as standalone executables in a terminal, bypassingollama launchentirely. Direct agents only require their own executable on PATH (noollamadependency). - Oh My Pi (omp) – Added to the built-in agent registry as the first direct agent.
- Flexible Model Passing – Direct agents receive
--model MODELby default. The:model-flagproperty lets entries customise or disable model passing. - Detached Terminal Sessions – Launched terminals are fully decoupled from Emacs; closing Emacs no longer kills running agent sessions.
- Standalone Launch –
M-x ollama-buddy-launch-external(or transientv) launches an agent from the current directory without requiring the chat buffer. In Dired, opens in the displayed directory.
Small model warning for agent launch.
- Small Model Launch Warning – When launching a local model below 7B parameters via
/launchor the Model ManagementLaunchbutton, a confirmation warning now explains that coding agents prepend 20,000+ tokens of system prompt to every request, which can cause small models to appear frozen or take many minutes to respond. Configurable viaollama-buddy-launch-small-model-threshold(default 7; set tonilto disable). Cloud models skip the warning.
Expanded launch agent registry.
- Full =ollama launch= Agent Registry – The built-in agent registry now includes all frontends supported by
ollama launch: Cline, Droid, OpenCode, OpenClaw, and Pi, in addition to Claude Code and Codex. Each agent only appears when its executable is found on PATH.
Fix process-filter crash on cloud usage limit responses.
- Cloud limit crash fix – Sending a prompt to an Ollama cloud model when the session was at 100% used to spam
error in process filter: Wrong type argument: listp, 82and never surface a real message. The non-2xx response body’s chunked-transfer chunk-size prefix (e.g.82\r\n{...}) was being parsed as an integer and crashingalist-getdownstream. The streaming filter now strips leading non-={= bytes before parsing and requires the parsed value to be a cons;handle-http-erroris also defensive against non-alist input. Cloud usage limits now produce a clean error in the chat buffer.
GLM 5.1 cloud model support.
- GLM 5.1 Cloud Model – Added
glm-5.1:cloudtoollama-buddy-cloud-models(appears inC-c mwith the☁indicator). GLM-5.1 is Z.ai’s next-generation flagship model for agentic engineering, with significantly stronger coding capabilities and support for tools and thinking.
Gemma 4 model support.
- Gemma 4 Cloud Model – Added
gemma4:31b-cloudtoollama-buddy-cloud-models(appears inC-c mwith the☁indicator). - Gemma 4 Recommended Models – Added
gemma4:e2b,gemma4:e4b,gemma4:latestandgemma4:26bto the “Efficient & Capable” category shown viaC-c L.gemma4:26bis a Mixture-of-Experts model with only 4B active parameters, so it runs comfortably on 16GB GPUs (with partial CPU offload) and on Apple Silicon with shared memory. The densegemma4:31bis still left off the recommended list. - Gemma 4 Vision Support – All Gemma 4 variants are registered as vision models, so the
⊙indicator lights up and image attachment works with them.
Thinking toggle and Ollama offline detection.
- Thinking Toggle –
/thinkslash command (or transientT) controls whether reasoning models emit a thinking block. When disabled, models skip reasoning for faster, cheaper responses. Header shows✦(enabled) or✧(disabled).
Plan mode — structured task planning with org-mode TODO integration.
- Plan Mode –
/planactivates a planning workflow where the LLM generates structured plans as org-modeTODOheadings. Cycle states withS-<right>(TODO→DOING→DONE|SKIP). Execute steps with/plan-next(one at a time, with full tool calling) or/plan-all(all remaining)./plan-donemarks a step complete;/plan-statusshows progress;/plan-stopdeactivates. - Tool Calling Progress – Status line and echo area now show live feedback:
⚒ Preparing write_file…during streaming,⚒ Running write_file…during execution,⚒ Tools completewhen finished. - Enhanced =write_file= Tool – Reports file size and line count in both the echo area and tool results.
Launch external frontends and comprehensive code quality improvements.
- =/launch= Slash Command – Launch any Ollama model in an external terminal with a frontend tool (e.g. Claude Code). Runs
ollama launch claude --model MODELwith auto-detected terminal emulator. Detects via$TERMINAL,$TERM_PROGRAM,xdg-terminal-exec, or PATH scan. - Launch in Model Management – Each model in
C-c Mnow has aLaunchbutton when frontends are detected. - Welcome Screen Indicator – Shows
⚡ launch: claude (via kitty)when launch frontends are available on PATH. - Code Quality – Fixed process/buffer leaks, added
vectorpguards for API responses, replaced busy-waits, consolidated duplicate code, improved error handling across the package.
Unguarded tool mode and MiniMax-M2.7 cloud model.
- Unguarded Mode –
/unguardedslash command (or transientG) bypasses ALL safety prompts, letting tools run to completion without interruption. No confirmation for unsafe tools, no large-result warnings, safe-mode overridden. Header line turns red and shows☠as a clear visual warning. - MiniMax-M2.7 Cloud Model – Added
minimax-m2.7:cloudtoollama-buddy-cloud-models.
Auto-scroll toggle for following streaming output.
- Auto-Scroll Toggle –
C-c gtogglesollama-buddy-auto-scroll, jumping to the end of the buffer when enabled. Header line shows↓when active. Works when toggled mid-stream.
Tool calling for all providers — OpenAI, Claude, and Gemini API types all support function calling through ollama-buddy-provider-create.
- Tool Calling for External Providers – All three API types (OpenAI-compatible, Claude, Gemini) now support tool calling. Tools are automatically converted from the internal format to each provider’s native schema at send time. This covers OpenAI, DeepSeek, Grok, OpenRouter, Copilot, Codestral, LM Studio, Anthropic Claude, and Google Gemini.
Tool-augmented search — LLMs can now autonomously search the web and query local documents during tool calling.
- =web_search= Tool – Models can autonomously search the web for current information during tool calling conversations. Uses the Ollama web search API; returns plain-text results (titles, URLs, snippets) directly as tool context.
- =rag_search= Tool – Models can autonomously search local RAG indexes for relevant document chunks during tool calling. Searches all indexes by default, or a specific one by name.
- Emacs 29.1 Minimum – Org folding now uses the
org-foldtext-property API directly, fixing thinking block folding issues on modern Emacs. - Thinking Fold Robustness –
TABto peek at a thinking block mid-stream now stays open instead of being immediately re-folded. - Welcome Screen – Extra commands under a folded
** More Commandsheading; project path is a clickable dired link. - Model Management – Running models listed individually with per-model Unload buttons;
[x]/[ ]checkbox removed. - =C-c E= – Toggle tool auto-execute from the chat buffer.
| Version | Summary |
|---|---|
| 7.6.0 | Dynamic cloud model discovery — ollama-buddy-cloud-models auto-fetched from ollama.com/api/tags; /sync force-refresh; ? opens transient. |
| 7.5.0 | OpenCode Go subscription integration — single n: prefix exposes all 14 models with one shared API key; ollama-buddy-provider-create now accepts function forms for :api-type / :endpoint for per-model dispatch. |
| 7.4.1 | Response post-processing hook (ollama-buddy-response-post-process-functions) with numbered-list normaliser for dense cloud models; thinking-block point-anchor fix; Emacs Blog Reviewer user prompt. |
| 7.4.0 | Directory-scale project annotation — /annotate-dir batches source files through a structured-output schema, auto-applies thread-shaped annotations to .simply-annotations.el, context-aware, project-relative keys. |
| 7.3.0 | Direct agent launch — external tools invoked as standalone executables; standalone launch from transient/dired; detached terminal sessions; Oh My Pi (omp) as first direct agent. |
| 7.2.0 | Small model launch warning — agents prepend 20K+ tokens of system prompt; models below 7B now trigger a confirmation warning explaining potential performance impact. |
| 7.1.4 | Expanded ollama launch agent registry — Cline, Droid, OpenCode, OpenClaw, Pi now detected alongside Claude Code and Codex. |
| 7.1.0 | Thinking toggle (/think, ✦=/=✧ indicator) — control reasoning output; Ollama offline detection with clear messages. |
| 7.0.0 | Plan mode — structured task planning with org-mode TODO integration; tool calling progress feedback; enhanced write_file tool output. |
| 6.0.0 | /launch slash command — launch models in external terminals with frontends (e.g. Claude Code); auto-detects terminal; Launch button in Model Management; comprehensive code quality fixes. |
| 5.1.0 | Unguarded tool mode (☠ indicator, red header line) — bypass all safety prompts; MiniMax-M2.7 cloud model. |
| 5.0.1 | Auto-scroll toggle (C-c g, ↓ indicator); works mid-stream. |
| 5.0.0 | Tool calling for all providers: OpenAI, Claude, and Gemini API types support function calling; HTTP error detection; Gemini native systemInstruction. |
| 4.2.0 | Tool-augmented search: web_search and rag_search built-in tools; Emacs 29.1 minimum; thinking fold robustness; welcome screen folded commands; model management running models section. |
| 4.1.1 | Recommended Models browser (C-c L), model letter ordering matches display, session load moved to C-c f. |
| 4.1.0 | Response property drawers (:TOKENS:, :RATE:, etc.), org file links for attachments, SVG context bar, removed token stats toggle. |
| 4.0.0 | Generic provider system (ollama-buddy-provider-create) — register any OpenAI/Claude/Gemini-compatible API with one call. Existing require wrappers still work but are deprecated. |
| 3.7.1 | Code quality, async model info, error cleanup, /cd directory switching, removed Fabric/Awesome. |
| 3.7.0 | RAG pause/resume with periodic checkpointing; new built-in tools (search_files, get_region, get_buffer_info, describe_symbol, eval_elisp). |
| 3.6.0 | RAG incremental updates (re-index only changed files) and cancellation support. |
| 3.5.1 | Curl backend refactor — unified request pipeline, shared stream processor, full feature parity with network-process backend (46% code reduction). |
| 3.5.0 | Project Init (experimental) — /init generates a cached project summary that auto-loads in future sessions; a step towards code-oriented LLM workflows. |
| 3.4.1 | Thinking Peek and Rewind — TAB peek at thinking mid-stream; C-u C-u C-c C-c to rewind conversation from any prompt heading. |
| 3.4.0 | Skills — Local Org-mode based AI personas and task-specific instructions; `/skill` slash command and `@skill(name)` inline syntax. |
| 3.3.0 | Smart Project Integration — `project.el` support for contextual file attachment and `/project` slash command. |
| 3.2.2 | Main transient menu reorganization (C-c O) — 4x2 compact grid with streamlined sub-menus and top-level History/Sessions. |
| 3.2.1 | Benchmark all models (C-c u) — one-command multishot across all models with per-model timeout; builds persistent token stats. |
| 3.1.0 | Inline ghost-text code completions (ollama-buddy-completion) — simple, manual Copilot-style completions with FIM context, thinking model support, fence stripping. |
| 3.0.0 | Generic OpenAI-compatible chat provider (ollama-buddy-openai-compat) — connect to LM Studio, llama.cpp, vLLM, Jan, or any OpenAI-API server. |
| 2.9.2 | :destination property for command definitions — per-command routing to chat or in-buffer, overriding the global toggle; all built-in commands and presets pre-annotated. |
| 2.9.1 | Welcome screen tips — ollama-buddy-tips.el shows a random usage tip on every fresh chat buffer; disable with (setq ollama-buddy-show-tips nil). |
| 2.9 | Configurable RAG embedding backend — ollama-buddy-rag-embedding-base-url and ollama-buddy-rag-embedding-api-style let you point RAG at any /v1/embeddings server (e.g. LM Studio) instead of Ollama’s /api/embed. |
| 2.8.1 | In-buffer replace polish: inline diff view (C-c d, word-level smerge highlighting), automatic clean-output tone, code-fence stripping, C-c W toggle. |
| 2.8.0 | Initial in-buffer replace mode — stream rewrites directly into the source buffer; C-c C-c accept / C-c C-k reject. |
See CHANGELOG.org for full history.
(use-package ollama-buddy
:ensure t
:bind
("C-c o" . ollama-buddy-role-transient-menu)
("C-c O" . ollama-buddy-transient-menu))On first launch, press C-c O → I to install the bundled presets and user prompts for the full experience (see Installing Presets and User Prompts).
(use-package ollama-buddy
:ensure t
:bind
("C-c o" . ollama-buddy-role-transient-menu)
("C-c O" . ollama-buddy-transient-menu)
:config
(require 'ollama-buddy-provider)
(ollama-buddy-provider-create
:name "OpenAI"
:prefix "a:"
:api-key (lambda () (auth-source-pick-first-password :host "ollama-buddy-openai" :user "apikey"))
:endpoint "https://api.openai.com/v1/chat/completions"
:default-model "gpt-4o"
:models-endpoint "https://api.openai.com/v1/models"
:models-filter (lambda (id) (string-match-p "gpt" id)))
;; add other providers similarly …
)(use-package ollama-buddy
:ensure t
:bind
("C-c o" . ollama-buddy-role-transient-menu)
("C-c O" . ollama-buddy-transient-menu)
:custom
(ollama-buddy-openai-api-key
(auth-source-pick-first-password :host "ollama-buddy-openai" :user "apikey"))
;; add other providers similarly …
:config
(require 'ollama-buddy-openai nil t)
;; other cloud providers …
)No API key needed for local servers. Use ollama-buddy-provider-create with :models-endpoint to auto-discover models:
(use-package ollama-buddy
:ensure t
:bind
("C-c o" . ollama-buddy-role-transient-menu)
("C-c O" . ollama-buddy-transient-menu)
:config
(require 'ollama-buddy-provider)
(ollama-buddy-provider-create
:name "LM Studio"
:prefix "l:"
:endpoint "http://localhost:1234/v1/chat/completions"
:models-endpoint "http://localhost:1234/v1/models"))Optionally also route RAG embeddings through the same server:
(setq ollama-buddy-rag-embedding-base-url "http://localhost:1234")
(setq ollama-buddy-rag-embedding-api-style 'openai)
(setq ollama-buddy-rag-embedding-model "nomic-embed-text")git clone https://github.com/captainflasmr/ollama-buddy.git(add-to-list 'load-path "path/to/ollama-buddy")
(require 'ollama-buddy)
(global-set-key (kbd "C-c o") #'ollama-buddy-role-transient-menu)
(global-set-key (kbd "C-c O") #'ollama-buddy-transient-menu)Role presets and user prompts ship with the package but need to be copied into your Emacs configuration directory to be editable. If they are missing, the chat welcome screen will show a reminder and the transient menu will offer an Install Extras entry.
Press C-c O → I (or M-x ollama-buddy-install-extras). This copies the bundled directories from the installed package, or downloads them from GitHub if the package was installed without them.
cd ~/.emacs.d
# extract out the ollama-buddy-presets and ollama-buddy-user-prompts
curl -sL https://api.github.com/repos/captainflasmr/ollama-buddy/tarball/main | \
tar -xzf - --transform=’s|[^/]*/||’ \
--wildcards \
‘*/ollama-buddy-presets/*’ \
‘*/ollama-buddy-user-prompts/*’The two directories installed are:
- =ollama-buddy-presets= – Pre-defined role presets (developer, writer, tutor, etc.) as
.elfiles. - =ollama-buddy-user-prompts= – Bundled system prompts organized by category (coding, writing, emacs, skills, etc.).
User prompts can be exported as named skills for Claude Code, opencode, and other compatible agent tools. Each skill becomes a directory under ~/.claude/skills/ with a SKILL.md file containing YAML frontmatter, description, trigger phrases, and the prompt body as markdown.
M-x ollama-buddy-user-prompts-export-skills– Export all prompts as skills (with confirmation). WithC-uprefix, prompts for custom directories.M-x ollama-buddy-user-prompts-export-skill– Export a single prompt selected via completion.
Configure targets:
;; Primary target (default ~/.claude/skills/)
(setq ollama-buddy-skills-export-directory "~/.claude/skills/")
;; Optional secondary target (e.g. project-local .agents/skills/)
(setq ollama-buddy-skills-export-agents-directory
(expand-file-name ".agents/skills/" (project-root (project-current t))))(use-package ollama-buddy
:demand t
:bind
("C-c o" . ollama-buddy-role-transient-menu)
("C-c O" . ollama-buddy-transient-menu)
:config
;; overall default model
(setq ollama-buddy-default-model "glm-4.7:cloud")
;; ;; deprecated external LLM
;; (setq ollama-buddy-openai-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-openai" :user "apikey"))
;; (setq ollama-buddy-claude-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-claude" :user "apikey"))
;; (setq ollama-buddy-gemini-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-gemini" :user "apikey"))
;; (setq ollama-buddy-grok-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-grok" :user "apikey"))
;; (setq ollama-buddy-codestral-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-codestral" :user "apikey"))
;; (setq ollama-buddy-openrouter-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-openrouter" :user "apikey"))
;; (setq ollama-buddy-deepseek-api-key
;; (auth-source-pick-first-password :host "ollama-buddy-deepseek" :user "apikey"))
;; (require 'ollama-buddy-openai nil t)
;; (require 'ollama-buddy-claude nil t)
;; (require 'ollama-buddy-gemini nil t)
;; (require 'ollama-buddy-grok nil t)
;; (require 'ollama-buddy-codestral nil t)
;; (require 'ollama-buddy-copilot nil t)
;; (require 'ollama-buddy-openrouter nil t)
;; (require 'ollama-buddy-deepseek nil t)
;; cloud / web-search keys (not provider-managed)
(setq ollama-buddy-cloud-api-key
(auth-source-pick-first-password :host "ollama-buddy-cloud" :user "apikey"))
(setq ollama-buddy-web-search-api-key
(auth-source-pick-first-password :host "ollama-buddy-web-search" :user "apikey"))
(setq ollama-buddy-cloud-session-token "<session-token>"
;; Generic provider registration (replaces individual require files)
(require 'ollama-buddy-provider)
(ollama-buddy-provider-create
:name "OpenAI" :prefix "a:"
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-openai" :user "apikey"))
:endpoint "https://api.openai.com/v1/chat/completions"
:models-endpoint "https://api.openai.com/v1/models"
:models-filter (lambda (id) (string-match-p "\\(gpt\\|o[0-9]\\)" id)))
(ollama-buddy-provider-create
:name "Claude" :prefix "c:" :api-type 'claude
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-claude" :user "apikey"))
:endpoint "https://api.anthropic.com/v1/messages"
:models-endpoint "https://api.anthropic.com/v1/models")
(ollama-buddy-provider-create
:name "Gemini" :prefix "g:" :api-type 'gemini
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-gemini" :user "apikey"))
:endpoint "https://generativelanguage.googleapis.com/v1beta/models/%s:generateContent"
:models-endpoint "https://generativelanguage.googleapis.com/v1/models"
:models-filter (lambda (id) (string-match-p "gemini" id)))
(ollama-buddy-provider-create
:name "Grok" :prefix "k:"
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-grok" :user "apikey"))
:endpoint "https://api.x.ai/v1/chat/completions"
:models-endpoint "https://api.x.ai/v1/models")
(ollama-buddy-provider-create
:name "Codestral" :prefix "s:"
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-codestral" :user "apikey"))
:endpoint "https://api.mistral.ai/v1/chat/completions"
:models '("codestral-latest"))
(ollama-buddy-provider-create
:name "OpenRouter" :prefix "r:"
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-openrouter" :user "apikey"))
:endpoint "https://openrouter.ai/api/v1/chat/completions"
:models-endpoint "https://openrouter.ai/api/v1/models"
:extra-headers '(("HTTP-Referer" . "https://github.com/captainflasmr/ollama-buddy")
("X-Title" . "ollama-buddy")))
(ollama-buddy-provider-create
:name "DeepSeek" :prefix "d:"
:api-key (lambda () (auth-source-pick-first-password
:host "ollama-buddy-deepseek" :user "apikey"))
:endpoint "https://api.deepseek.com/chat/completions"
:models '("deepseek-chat" "deepseek-reasoner"))
(require 'ollama-buddy-completion)
(setq ollama-buddy-completion-model "qwen3-coder-next:cloud")
;; setup default custom menu for preferred models
(ollama-buddy-update-menu-entry 'refactor-code :model "minimax-m2.1:cloud")
(ollama-buddy-update-menu-entry 'git-commit :model "glm-4.7:cloud")
(ollama-buddy-update-menu-entry 'describe-code :model "minimax-m2.1:cloud")
(ollama-buddy-update-menu-entry 'dictionary-lookup :model "minimax-m2.1:cloud")
(ollama-buddy-update-menu-entry 'synonym :model "minimax-m2.1:cloud")
(ollama-buddy-update-menu-entry 'proofread :model "minimax-m2.1:cloud")
;; dired integration
(with-eval-after-load 'dired
(define-key dired-mode-map (kbd "C-c C-a") #'ollama-buddy-dired-attach-marked-files)))| Key | Action |
|---|---|
| C-c C-c | Send prompt |
| C-c RET | Send prompt (alt) |
| C-c C-k | Cancel request |
| C-c m | Change model |
| C-c l | Pull new model |
| C-c O | Main transient menu |
| C-c ? | Open Info manual |
| M-p / M-n | Browse prompt history |
| C-c M | Manage models |
| C-c L | Recommended models |
| C-c i | Show model info |
| C-c U | Multishot |
| C-c N | New session |
| C-c f | Load session |
| C-c S | Save session |
| C-c Z | Sessions directory |
| C-c J | Toggle history |
| C-c X | Clear history |
| C-c H | Edit history |
| C-c C-a | Attach file |
| C-c C-d | Detach file |
| C-c a | Attachment menu |
| C-c 0 | Clear all attachments |
| C-c C-s | Show system prompt |
| C-c C-r | Reset system prompt |
| C-c y | System prompts menu |
| C-c s | User prompts menu |
| C-c ~ | Select response tone |
| C-c SPC | Toggle tool calling |
| C-c G | Toggle unguarded mode |
| C-c E | Toggle tool auto-execute |
| C-c Q | List registered tools |
| C-c P | Project menu |
| C-c p | Parameter menu |
| C-c t | Display parameters |
| C-c + | Settings menu |
| C-c r | RAG menu |
| C-c / | Web search menu |
| C-c x | Toggle streaming |
| C-c e | Switch backend (network/curl) |
| C-c ! | Toggle airplane mode |
| C-c g | Toggle auto-scroll |
| C-c A | Auth menu (Cloud, Copilot) |
| C-c K | Exit/kill session |
| API Endpoint | Method | Purpose | Supported | Notes |
|---|---|---|---|---|
/api/chat | POST | Send chat messages to a model | Yes | Core feature with streaming, tools, vision |
/api/generate | POST | Generate text without chat context | Partial | Used for inline completions and model unloading |
/api/tags | GET | List available local models | Yes | Used for model management |
/api/show | POST | Show model information | Yes | Model info display |
/api/pull | POST | Pull a model from Ollama library | Yes | Async pull with progress |
/api/push | POST | Push a model to the Ollama library | No | Not planned |
/api/delete | DELETE | Delete a model | Yes | Model management |
/api/copy | POST | Copy a model | Yes | Model management |
/api/create | POST | Create a model from Modelfile/GGUF | Yes | GGUF import supported |
/api/ps | GET | List running models | Yes | Shows loaded models in management buffer |
/api/embed | POST | Generate embeddings from text | Yes | RAG module via ollama-buddy-rag.el (v2.5.0+) |
/api/version | GET | Get Ollama version | Yes | Displayed on Model Management page |
HEAD /api/blobs/:digest | HEAD | Check if blob exists | No | Not needed for current functionality |
POST /api/blobs/:digest | POST | Push a blob | No | Not needed for current functionality |
| Cancel requests | Custom | Terminate ongoing request | Yes | C-c C-k in chat buffer |
| Parameter | Supported | Notes |
|---|---|---|
model | Yes | Per-command or global via ollama-buddy-default-model |
messages | Yes | Full conversation history support |
tools | Yes | Tool calling via ollama-buddy-tools.el (v2.0.0+) |
think | Yes | Reasoning model support with visibility toggle |
format | Partial | JSON mode not yet exposed |
options | Yes | Full implementation of all model parameters |
stream | Yes | Toggleable with ollama-buddy-toggle-streaming |
keep_alive | Yes | Set via ollama-buddy-set-keepalive or ollama-buddy-keepalive |
Used by ollama-buddy-completion.el for inline ghost-text completions and for model unloading.
| Parameter | Supported | Notes |
|---|---|---|
model | Yes | Set via ollama-buddy-completion-model or current model |
prompt | Yes | Buffer content before point (FIM prefix) |
suffix | Yes | Buffer content after point (FIM suffix) |
images | No | Vision uses chat endpoint instead |
format | No | Not currently exposed |
options | Yes | num_predict and temperature for completions |
system | Yes | Completion system prompt (code-only output) |
template | No | Uses model defaults |
stream | Yes | Streaming enabled by default |
raw | No | Not currently needed |
keep_alive | Yes | Used for model unloading (keep_alive: 0) |
context | N/A | Deprecated - using messages array instead |
| Parameter Group | Parameters | Supported |
|---|---|---|
| Temperature Controls | temperature, top_k, top_p, min_p, typical_p | Yes |
| Repetition Controls | repeat_last_n, repeat_penalty, presence_penalty, frequency_penalty | Yes |
| Advanced Sampling | mirostat, mirostat_tau, mirostat_eta, penalize_newline, stop | Yes |
| Resource Management | num_keep, seed, num_predict, num_ctx, num_batch | Yes |
| Hardware Optimization | numa, num_gpu, main_gpu, low_vram, vocab_only, use_mmap, use_mlock, num_thread | Yes |
| Feature | Supported | Notes |
|---|---|---|
| Streaming responses | Yes | Default mode, toggleable |
| Tool calling | Yes | Built-in tools + custom tool registration (v2.0.0+) |
| Vision/Images | Yes | Base64 image encoding for multimodal models |
| Structured outputs (JSON) | No | Not yet exposed |
| Reproducible outputs (seed) | Yes | Via parameters |
| Load/Unload models | Yes | Via model management buffer |
| Cloud models | Yes | Auto-fetched from ollama.com/api/tags (v7.6+) |
| Thinking/Reasoning models | Yes | think parameter with visibility toggle |
The format parameter supports JSON schema for structured responses.
Implementation considerations:
- Define output schemas per command
- Integration with org-mode tables
- Structured data extraction workflows
Ollama v0.14+ implements /v1/messages endpoint compatible with Anthropic’s API format.
Implementation considerations:
- Option to route Claude-format requests through local Ollama
- Could simplify
ollama-buddy-claude.elor provide fallback - Support for tool_use and tool_result content blocks
Ollama v0.14+ supports local image generation with models like Z-Image Turbo (6B) and FLUX.2 Klein.
Implementation considerations:
- Detect image generation models
- Handle image output (save to file, display in buffer)
- Support generation parameters (width, height, steps, seed)
- Integration with org-mode inline images
- Manual – Full reference manual
- Full README – Detailed README, tutorials, transient menu guide, and role setup
- Changelog – Version-by-version changes
- Ollama Buddy Blog – Blog articles for Ollama Buddy




