Repolode
ahyatt

ahyatt/llm

An Emacs Lisp library that gives elisp code a single interface to many LLM providers, including OpenAI, Claude, Gemini and local Ollama.

Stars
394
Forks
44
Open issues
10
Last commit
3 days ago

What is it?

The llm package lets Emacs applications call large language models through one abstraction, while end users pick whichever provider they prefer, whether a paid cloud API or a locally run model. Providers are created with constructors such as make-llm-openai, make-llm-claude, make-llm-gemini and make-llm-ollama, and client code codes against generic functions that work the same way for all of them.

The library covers synchronous, asynchronous and streaming chat, multimodal input such as images, tool use where the LLM calls elisp functions with arguments it chooses, and embeddings for semantic search. It also provides prompt construction, JSON schema responses, token counting and a set of decision helpers. Features a provider lacks raise a not-implemented signal, and clients can check llm-capabilities first.

It is intended for Emacs package authors who want their tools to work with any model, and it is used by packages such as ellama, magit-gptcommit and ekg.

Key features

  • 01Unified API across OpenAI, Claude, Gemini, Ollama, DeepSeek and other providers
  • 02Synchronous, asynchronous and streaming chat responses
  • 03Tool use that lets the LLM call elisp functions with arguments it provides
  • 04Image and other media input for chat
  • 05Text embeddings for semantic similarity search
  • 06JSON schema constrained output

Use cases

  • Adding AI chat or text transformation features to an Emacs package without locking users to one vendor
  • Letting Emacs users run a free local model via Ollama or llama.cpp with the same code
  • Generating commit messages or summaries from within Emacs workflows
  • Building semantic search over notes using embeddings

Quick start

  1. 1

    Install the llm package from MELPA

  2. 2

    Require the provider module and set up a provider, for example OpenAI with your key

    (require 'llm-openai) (make-llm-openai :key my-openai-key)

Things to know

  • Requires an API key for paid cloud providers such as OpenAI, Claude and Gemini, or a locally running server such as Ollama.
  • Some providers lack features, for example GPT4All and Azure OpenAI do not support embeddings or tool use in all cases.

In collections

Topics

FAQ

What is llm?
An Emacs Lisp library that gives elisp code a single interface to many LLM providers, including OpenAI, Claude, Gemini and local Ollama. The llm package lets Emacs applications call large language models through one abstraction, while end users pick whichever provider they prefer, whether a paid cloud API or a locally run model. Providers are created with constructors such as make-llm-openai, make-llm-claude, make-llm-gemini and make-llm-ollama, and client code codes against generic functions that work the same way for all of them.
Is llm free to use? What license does it have?
llm is open source under the GPL-3.0 license. Check the license terms before using it in commercial products.
Is llm still maintained?
Actively maintained. The last commit to llm was on Nov 5, 2026.
What can I use llm for?
Adding AI chat or text transformation features to an Emacs package without locking users to one vendor Letting Emacs users run a free local model via Ollama or llama.cpp with the same code Generating commit messages or summaries from within Emacs workflows Building semantic search over notes using embeddings
How do I install llm?
Install the llm package from MELPA Require the provider module and set up a provider, for example OpenAI with your key: (require 'llm-openai) (make-llm-openai :key my-openai-key)
Where can I get llm?
The source code and installation instructions are on GitHub: https://github.com/ahyatt/llm

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects