gptel Atom Feed

Description
Interact with ChatGPT or other LLMs
Latest
gptel-0.9.8.0.20250326.112539.tar (.sig), 2025-Mar-26, 550 KiB
Maintainer
Karthik Chikmagalur <karthik.chikmagalur@gmail.com>
Website
https://github.com/karthink/gptel
Browse ELPA's repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

gptel is a simple Large Language Model chat client, with support for multiple
models and backends.

It works in the spirit of Emacs, available at any time and in any buffer.

gptel supports:

- The services ChatGPT, Azure, Gemini, Anthropic AI, Anyscale, Together.ai,
  Perplexity, Anyscale, OpenRouter, Groq, PrivateGPT, DeepSeek, Cerebras,
  Github Models, Novita AI, xAI and Kagi (FastGPT & Summarizer).
- Local models via Ollama, Llama.cpp, Llamafiles or GPT4All

Additionally, any LLM service (local or remote) that provides an
OpenAI-compatible API is supported.

Features:

- It’s async and fast, streams responses.
- Interact with LLMs from anywhere in Emacs (any buffer, shell, minibuffer,
  wherever).
- LLM responses are in Markdown or Org markup.
- Supports conversations and multiple independent sessions.
- Supports tool-use to equip LLMs with agentic capabilities.
- Supports multi-modal models (send images, documents).
- Supports "reasoning" content in LLM responses.
- Save chats as regular Markdown/Org/Text files and resume them later.
- You can go back and edit your previous prompts or LLM responses when
  continuing a conversation.  These will be fed back to the model.
- Redirect prompts and responses easily
- Rewrite, refactor or fill in regions in buffers.
- Write your own commands for custom tasks with a simple API.

Requirements for ChatGPT, Azure, Gemini or Kagi:

- You need an appropriate API key.  Set the variable `gptel-api-key' to the
  key or to a function of no arguments that returns the key.  (It tries to
  use `auth-source' by default)

ChatGPT is configured out of the box.  For the other sources:

- For Azure: define a gptel-backend with `gptel-make-azure', which see.
- For Gemini: define a gptel-backend with `gptel-make-gemini', which see.
- For Anthropic (Claude): define a gptel-backend with `gptel-make-anthropic',
  which see.
- For Together.ai, Anyscale, Groq, OpenRouter, DeepSeek, Cerebras or
  Github Models: define a gptel-backend with `gptel-make-openai', which see.
- For PrivateGPT: define a backend with `gptel-make-privategpt', which see.
- For Perplexity: define a backend with `gptel-make-perplexity', which see.
- For Deepseek: define a backend with `gptel-make-deepseek', which see.
- For Kagi: define a gptel-backend with `gptel-make-kagi', which see.

For local models using Ollama, Llama.cpp or GPT4All:

- The model has to be running on an accessible address (or localhost)
- Define a gptel-backend with `gptel-make-ollama' or `gptel-make-gpt4all',
  which see.
- Llama.cpp or Llamafiles: Define a gptel-backend with `gptel-make-openai'.

Consult the package README for examples and more help with configuring
backends.

Usage:

gptel can be used in any buffer or in a dedicated chat buffer.  The
interaction model is simple: Type in a query and the response will be
inserted below.  You can continue the conversation by typing below the
response.

To use this in any buffer:

- Call `gptel-send' to send the buffer's text up to the cursor.  Select a
  region to send only the region.

- You can select previous prompts and responses to continue the conversation.

- Call `gptel-send' with a prefix argument to access a menu where you can set
  your backend, model and other parameters, or to redirect the
  prompt/response.

To use this in a dedicated buffer:

- M-x gptel: Start a chat session.

- In the chat session: Press `C-c RET' (`gptel-send') to send your prompt.
  Use a prefix argument (`C-u C-c RET') to access a menu.  In this menu you
  can set chat parameters like the system directives, active backend or
  model, or choose to redirect the input or output elsewhere (such as to the
  kill ring or the echo area).

- You can save this buffer to a file.  When opening this file, turn on
  `gptel-mode' before editing it to restore the conversation state and
  continue chatting.

- To include media files with your request, you can add them to the context
  (described next), or include them as links in Org or Markdown mode chat
  buffers.  Sending media is disabled by default, you can turn it on globally
  via `gptel-track-media', or locally in a chat buffer via the header line.

Include more context with requests:

If you want to provide the LLM with more context, you can add arbitrary
regions, buffers, files or directories to the query with `gptel-add'.  To add
text or media files, call `gptel-add' in Dired or use the dedicated
`gptel-add-file'.

You can also add context from gptel's menu instead (`gptel-send' with a
prefix arg), as well as examine or modify context.

When context is available, gptel will include it with each LLM query.

Rewrite interface

In any buffer: with a region selected, you can rewrite prose, refactor code
or fill in the region.  This is accessible via `gptel-rewrite', and also from
the `gptel-send' menu.

gptel in Org mode:

gptel offers a few extra conveniences in Org mode:

- You can limit the conversation context to an Org heading with
  `gptel-org-set-topic'.
  
- You can have branching conversations in Org mode, where each hierarchical
  outline path through the document is a separate conversation branch.
  See the variable `gptel-org-branching-context'.
  
- You can declare the gptel model, backend, temperature, system message and
  other parameters as Org properties with the command
  `gptel-org-set-properties'.  gptel queries under the corresponding heading
  will always use these settings, allowing you to create mostly reproducible
  LLM chat notebooks.

Finally, gptel offers a general purpose API for writing LLM ineractions that
suit your workflow.  See `gptel-request', and `gptel-fsm' for more advanced
usage.

Old versions

gptel-0.9.8.0.20250325.200426.tar.lz2025-Mar-26 103 KiB
gptel-0.9.8.0.20250324.193751.tar.lz2025-Mar-25 103 KiB
gptel-0.9.8.0.20250321.145224.tar.lz2025-Mar-22 103 KiB
gptel-0.9.8.0.20250319.194426.tar.lz2025-Mar-20 103 KiB
gptel-0.9.8.0.20250314.140235.tar.lz2025-Mar-15 103 KiB
gptel-0.9.7.0.20250313.122929.tar.lz2025-Mar-13 103 KiB
gptel-0.9.6.0.20241202.163036.tar.lz2024-Dec-0376.3 KiB
gptel-0.9.0.0.20241010.94430.tar.lz2024-Oct-1061.4 KiB
gptel-0.8.6.0.20240623.113847.tar.lz2024-Jun-2357.2 KiB
gptel-0.8.5.0.20240429.130547.tar.lz2024-May-0149.1 KiB

News

# -*- mode: org; -*-

* 0.9.9

** Breaking changes

** New models and backends

** New features and UI changes

- The new option ~gptel-curl-extra-args~ can be used to specify extra
  arguments to the Curl command used for the request.  This is the
  global version of the gptel-backend-specific ~:curl-args~ slot,
  which can be used to specify Curl arguments when using a specific
  backend.

- Tools now run in the buffer from which the request originates.

** Notable Bug fixes

* 0.9.8 2025-03-13

Version 0.9.8 adds support for new Gemini, Anthropic, OpenAI,
Perplexity, and DeepSeek models, introduces LLM tool use/function
calling, a redesign of ~gptel-menu~, includes new customization hooks,
dry-run options and refined settings, improvements to the rewrite
feature and control of LLM "reasoning" content.

** Breaking changes

- ~gemini-pro~ has been removed from the list of Gemini models, as
  this model is no longer supported by the Gemini API.

- Sending an active region in Org mode will now apply Org
  mode-specific rules to the text, such as branching context.

- The following obsolete variables and functions have been removed:
  - ~gptel-send-menu~: Use ~gptel-menu~ instead.
  - ~gptel-host~: Use ~gptel-make-openai~ instead.
  - ~gptel-playback~: Use ~gptel-stream~ instead.
  - ~gptel--debug~: Use ~gptel-log-level~ instead.

** New models and backends

- Add support for several new Gemini models including
  ~gemini-2.0-flash~, ~gemini-2.0-pro-exp~ and
  ~gemini-2.0-flash-thinking-exp~, among others.

- Add support for the Anthropic model ~claude-3-7-sonnet-20250219~,
  including its "reasoning" output.

- Add support for OpenAI's ~o1~, ~o3-mini~ and ~gpt-4.5-preview~
  models.

- Add support for Perplexity.  While gptel supported Perplexity in
  earlier releases by reusing its OpenAI support, there is now first
  class support for the Perplexity API, including citations.

- Add support for DeepSeek.  While gptel supported DeepSeek in earlier
  releases by reusing its OpenAI support, there is now first class
  support for the DeepSeek API, including support for handling
  "reasoning" output.

** New features and UI changes

- ~gptel-rewrite~ now supports iterating on responses.

- gptel supports the ability to simulate/dry-run requests so you can
  see exactly what will be sent.  This payload preview can now be
  edited in place and the request continued.

- Directories can now be added to gptel's global context.  Doing so
  will add all files in the directory recursively.

- "Oneshot" settings: when using gptel's Transient menus, request
  parameters, directives and tools can now be set for the next request
  only in addition to globally across the Emacs session and
  buffer-locally.  This is useful for making one-off requests with
  different settings.

- ~gptel-mode~ can now be used in all modes derived from ~text-mode~.

- gptel now tries to handle LLM responses that are in mixed
  Org/Markdown markup correctly.

- Add ~gptel-org-convert-response~ to toggle the automatic conversion
  of (possibly) Markdown-formatted LLM responses to Org markup where
  appropriate.

- You can now look up registered gptel backends using the
  ~gptel-get-backend~ function.  This is intended to make scripting
  and configuring gptel easier.  ~gptel-get-backend~ is a generalized
  variable so you can (un)set backends with ~setf~.

- Tool use: gptel now supports LLM tool use, or function calling.
  Essentially you can equip the LLM with capabilities (such as
  filesystem access, web search, control of Emacs or introspection of
  Emacs' state and more) that it can use to perform tasks for you.
  gptel runs these tools using argument values provided by the LLMs.
  This requires specifying tools, which are elisp functions with plain
  text descriptions of their arguments and results.  gptel does not
  include any tools out of the box yet.

- You can look up registered gptel tools using the ~gptel-get-tool~
  function.  This is intended to make scripting and configuring gptel
...
...