An excerpt from the repository, fetched Nov 13, 2026.
Read the project’s introduction
gptel: A simple LLM client for Emacs
gptel is a simple Large Language Model chat client for Emacs, with support for multiple models and backends. It works in the spirit of Emacs, available at any time and uniformly in any buffer.
General usage: (YouTube Demo, 18 min)
Advanced usage: (YouTube Demo, 28 min)
intro-demo.mp4
intro-demo-2.mp4
In-place usage
gptel-rewrite-demo-1.mp4
Tool use
gptel-tool-use-filesystem-confirm-demo-2.mp4
gptel-tool-use-feed-search-demo.mp4
See also this youtube demo (2 minutes) by Armin Darvish.
Interact with LLMs from anywhere in Emacs (any buffer, shell, minibuffer, wherever).
LLM responses are in Markdown or Org markup.
Supports multiple independent conversations, one-off ad hoc interactions and anything in between.
Supports tool-use to equip LLMs with agentic capabilities.
Supports Model Context Protocol (MCP) integration using mcp.el.
Supports multi-modal input (include images, documents).
Supports “reasoning” content in LLM responses.
Save chats as regular Markdown/Org/Text files and resume them later.
Edit your previous prompts or LLM responses when continuing a conversation. These will be fed back to the model.
Supports introspection, so you can see exactly what will be sent. Inspect and modify queries before sending them.
Pause multi-stage requests at an intermediate stage and resume them later.
Don’t like gptel’s workflow? Use it to create your own for any supported model/backend with a simple API.
gptel uses Curl if available, but falls back to the built-in url-retrieve to work without external dependencies.
Contents
Installation
Straight
Manual
Doom Emacs
Spacemacs
Setup
OpenAI
Other LLM backends
(Optional) Securing API keys with =authinfo=
(Optional) Reading API keys from environment variables
OpenAI (ChatGPT plus/pro subscription)
Azure
GPT4All
Ollama
Open WebUI
Gemini
Llama.cpp or Llamafile
Kagi (FastGPT & Summarizer)
together.ai
Anyscale
Perplexity
Anthropic (Claude)
Groq
Mistral Le Chat
OpenRouter
PrivateGPT
DeepSeek
Sambanova (Deepseek)
Cerebras
Novita AI
xAI
AI/ML API
GitHub CopilotChat
AWS Bedrock
Moonshot (Kimi)
Usage
In any buffer:
In a dedicated chat buffer:
Including media (images, documents or plain-text files) with requests
Save and restore your chat sessions
Setting options (backend, model, request parameters, system prompts and more)
Include more context with requests
Handle “reasoning” content
Tool use
Defining gptel tools
Selecting tools
LLM tool collections
Model Context Protocol (MCP) integration
Rewrite, refactor or fill in a region
Extra Org mode conveniences
Introspection (examine, debug or modify requests)
FAQ
Chat buffer UI
I want the window to scroll automatically as the response is inserted
I want the cursor to move to the next prompt after the response is inserted
I want to change the formatting of the prompt and LLM response
How does gptel distinguish between user prompts and LLM responses?
Transient menu behavior
I want to set gptel options but only for this buffer
I want the transient menu options to be saved so I only need to set them once
Using the transient menu leaves behind extra windows
Can I change the transient menu key bindings?
(Doom Emacs) Sending a query from the gptel menu fails because of a key conflict with Org mode
Miscellaneous
I want to use gptel in a way that’s not supported by gptel-send or the options menu
(ChatGPT) I get the error “(HTTP/2 429) You exceeded your current quota”
Why another LLM client?
Additional Configuration
Option presets
Applying presets to requests automatically
Alternatives
Packages using gptel
Acknowledgments
Installation
Note: gptel requires Transient 0.7.8 or higher. Transient is a built-in package and Emacs does not update it by default. Ensure that package-install-upgrade-built-in is true, or update Transient manually.
Release version: M-x package-install ⏎ gptel in Emacs.
Development snapshot: Add MELPA or NonGNU-devel ELPA to your list of package sources, then install with M-x package-install ⏎ gptel.
Optional: Install markdown-mode.
Straight
(straight-use-package 'gptel)
Manual
Note: gptel requires Transient 0.7.8 or higher. Transient is a built-in package and Emacs does not update it by default. Ensure that package-install-upgrade-built-in is true, or update Transient manually.
Clone or download this repository and run M-x package-install-file⏎ on the repository directory.
Doom Emacs
In packages.el
(package! gptel :recipe (:nonrecursive t))
In config.el
(use-package! gptel
:config
(setq! gptel-api-key "your key"))
“your key” can be the API key itself, or (safer) a function that returns the key. Setting gptel-api-key is optional, you will be asked for a key if it’s not found.
Alternatively, Doom Emacs provides a built-in :tools llm module powered by gptel. Enable it in your init.el in the doom! block:
(doom! :tools llm)
This installs gptel with preconfigured keybindings (<leader> o l), m
Read the full README on GitHub