ahyatt/llm

A package abstracting llm capabilities for emacs.

What it solves

This library provides a standardized interface for Emacs Lisp (elisp) code to interact with various Large Language Models (LLMs). It solves the problem of fragmentation by allowing developers to write applications that are compatible with multiple LLM providers (both paid APIs and local installations) without having to write provider-specific code for every single model.

How it works

The library abstracts common LLM features into generic functions. Developers code against these generic functions, and users configure a "provider" (such as OpenAI, Gemini, Claude, or Ollama) to handle the actual API calls. It supports:

  • Chat: Synchronous, asynchronous, and streaming responses.
  • Multimodal Input: Support for images and other media inputs.
  • Tool Use: Allowing LLMs to call elisp functions with specific arguments.
  • Embeddings: Converting text into semantic vectors for use in search systems.
  • Prompt Construction: Building prompts from multiple data sources.

Who it’s for

  • Emacs developers creating AI-powered packages (e.g., text transformation, commit message generation, or note-taking apps).
  • Emacs users who want the flexibility to switch between different LLM backends (like switching from a paid OpenAI account to a local Ollama instance) without changing their installed packages.

Highlights

  • Broad Provider Support: Includes integrations for OpenAI, OpenRouter, Azure OpenAI, GitHub Models, Gemini, Vertex AI, Claude, Ollama, Deepseek, and GPT4All.
  • Flexible Execution: Supports both background (async) and real-time (streaming) responses to keep the editor responsive.
  • Capability Detection: Provides a way to check llm-capabilities to see if a specific model supports features like tool-use or reasoning.
  • Local-First Options: Strong support for local LLM runners like Ollama, llama.cpp, and GPT4All.

Related

  • Project
  • Project
  • Project
  • Project
  • Project