Variable: gptel-cache
gptel-cache is a customizable variable defined in gptel-request.el.
Value
nil
Documentation
Whether the LLM should cache request content.
Some LLM backends can cache content sent to it by gptel, so that only the newly included part of the text needs to be processed on subsequent conversation turns. This results in faster and significantly cheaper processing.
NOTE: Manual or client-configurable caching is currently
supported only by the Anthropic API and thus the
gptel-anthropic backend. This variable has no effect on the
behavior of other backends.
This variable controls which parts of the query will be cached, and can be the symbols t or nil to cache everything or nothing respectively. It can also be a list of symbols:
- message: Cache conversation messages
- system: Cache the system message
- tool: Cache tool definitions
Examples:
Setting it to (message system) will cache the system message and the conversation text.
Setting it to (message system tool) will cache everything and is the same as t.
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel-request.el
(defcustom gptel-cache nil
"Whether the LLM should cache request content.
Some LLM backends can cache content sent to it by gptel, so that
only the newly included part of the text needs to be processed on
subsequent conversation turns. This results in faster and
significantly cheaper processing.
NOTE: Manual or client-configurable caching is currently
supported only by the Anthropic API and thus the
`gptel-anthropic' backend. This variable has no effect on the
behavior of other backends.
This variable controls which parts of the query will be cached,
and can be the symbols t or nil to cache everything or nothing
respectively. It can also be a list of symbols:
- message: Cache conversation messages
- system: Cache the system message
- tool: Cache tool definitions
Examples:
Setting it to (message system) will cache the system message and
the conversation text.
Setting it to (message system tool) will cache everything and is
the same as t."
:type '(choice
(const :tag "Cache everything" t)
(const :tag "Do not cache" nil)
(repeat symbol))
:group 'gptel)