Using ChatGPT With Emacs

There are a few packages and libraries that are being built to use ChatGPT along with Emacs.

This page is becoming fairly popular in search results so please let me know if there are other libraries you love or think I should try out.


I use the following libraries myself for both writing code and prose (more prose than code these days).

  • GPTel focuses on a chat client session within an Emacs buffer and sending text from the buffer (like a selected region or line). Also uses a transient menu (a la magit) for on-the-fly configuration like custom prompts and models to use.
  • ChatGPT Shell is an eshell for ChatGPT and dall-e that fascilitats interacting with a chat session. By default it’s prompt is configured for helping with writing code.

Best of the rest

An incomplete list of other libraries I’ve come across.

  • Emacs OpenAI has a collection of packages for using ChatGPT and dall-e
  • ChatGPT.el was one of the first, but hasn’t been updated to use the official API yet
  • ChatGPT Arcana is a more integrated approach including prompt from region
  • org-ai combines OpenAI whisper and GPT so you can talk to Emacs (also has a nifty begin_ai block for org-mode)
  • leafy-mode adds completions to org-mode using ChatGPT

Querying your own data

Most of the libraries mentioned rely on the user to send text to a chat session. However, they don’t have ways to index your own data to provide context to a chat session or for single-shot completions.

For example, I wrote a LangChain agent for helping me chat with my notes (also named org-ai, oh well!). While it’s one of one software and I have no intention of making it generic, you could adapt it to your own use.