branch: elpa/gptel commit 9f48e1a7bcd8c524c5db92ca007a3fa6ab26bba7 Author: Karthik Chikmagalur <karthikchikmaga...@gmail.com> Commit: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
openai-extras: Update Grok definitions, add grok-4 support * gptel-openai-extras.el (gptel-make-xai): Use the deepseek backend in `gptel-make-xai', as their reasoning content handling is similar. Add `grok-4' to the models list and fix some errors in the context-window specifications of existing models. (#974) * NEWS (0.9.9-pre): Mention changes --- NEWS | 14 +++++++++ gptel-openai-extras.el | 80 +++++++++++++++++++++++++++----------------------- 2 files changed, 58 insertions(+), 36 deletions(-) diff --git a/NEWS b/NEWS index 3e9ca6747a..a3dea45333 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ * 0.9.9-pre +** Breaking changes + +- The suffix =-latest= has been dropped from Grok models, as they are + no longer required. So the models =grok-3-latest=, + =grok-3-mini-latest= have been renamed to just =grok-3=, + =grok-3-mini= and so on. + ** New models and backends - Add support for ~gemini-2.5-pro~, ~gemini-2.5-flash~, @@ -11,8 +18,15 @@ OpenAI-compatible API, so the "support" is just a new section of the README with instructions. +- Add support for ~grok-4~. + ** New features and UI changes +- gptel now supports handling reasoning/thinking blocks in responses + from xAI's Grok models. This is controlled by + ~gptel-include-reasoning~, in the same way that it handles other + APIs. + - When including a file in the context, the abbreviated full path of the file is included is now included instead of the basename. Specifically, =/home/user/path/to/file= is included as diff --git a/gptel-openai-extras.el b/gptel-openai-extras.el index f2c3d7b05f..22064e0257 100644 --- a/gptel-openai-extras.el +++ b/gptel-openai-extras.el @@ -374,41 +374,49 @@ For the meanings of the keyword arguments, see `gptel-make-openai'." (host "api.x.ai") (protocol "https") (endpoint "/v1/chat/completions") - (models '((grok-3-latest - :description "Grok 3" - :capabilities '(tool-use json) - :context-window 131072 - :input-cost 3 - :output-cost 15) - - (grok-3-fast-latest - :description "Faster Grok 3" - :capabilities '(tool-use json) - :context-window 131072 - :input-cost 5 - :output-cost 25) - - (grok-3-mini-latest - :description "Mini Grok 3" - :capabilities '(tool-use json reasoning) - :context-window 131072 - :input-cost 0.3 - :output-cost 0.5) - - (grok-3-mini-fast-latest - :description "Faster mini Grok 3" - :capabilities '(tool-use json reasoning) - :context-window 131072 - :input-cost 0.6 - :output-cost 4) - - (grok-2-vision-1212 - :description "Grok 2 Vision" - :capabilities '(tool-use json) - :mime-types '("image/jpeg" "image/png" "image/gif" "image/webp") - :context-window 32768 - :input-cost 2 - :output-cost 10)))) + (models + '((grok-4 + :description "Grok Flagship model" + :capabilities '(tool-use json reasoning) + :context-window 256 + :input-cost 3 + :output-cost 15) + + (grok-3 + :description "Grok 3" + :capabilities '(tool-use json reasoning) + :context-window 131 + :input-cost 3 + :output-cost 15) + + (grok-3-fast + :description "Faster Grok 3" + :capabilities '(tool-use json reasoning) + :context-window 131 + :input-cost 5 + :output-cost 25) + + (grok-3-mini + :description "Mini Grok 3" + :capabilities '(tool-use json reasoning) + :context-window 131 + :input-cost 0.3 + :output-cost 0.5) + + (grok-3-mini-fast + :description "Faster mini Grok 3" + :capabilities '(tool-use json reasoning) + :context-window 131072 + :input-cost 0.6 + :output-cost 4) + + (grok-2-vision-1212 + :description "Grok 2 Vision" + :capabilities '(tool-use json media) + :mime-types '("image/jpeg" "image/png" "image/gif" "image/webp") + :context-window 32768 + :input-cost 2 + :output-cost 10)))) "Register an xAI backend for gptel with NAME. Keyword arguments: @@ -422,7 +430,7 @@ false. The other keyword arguments are all optional. For their meanings see `gptel-make-openai'." (declare (indent 1)) - (let ((backend (gptel--make-openai + (let ((backend (gptel--make-deepseek :name name :host host :header header