You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -81,6 +82,7 @@ gptel uses Curl if available, but falls back to url-retrieve to work without ext
81
82
- [[#cerebras][Cerebras]]
82
83
- [[#github-models][Github Models]]
83
84
- [[#novita-ai][Novita AI]]
85
+
- [[#xAI][xAI]]
84
86
- [[#usage][Usage]]
85
87
- [[#in-any-buffer][In any buffer:]]
86
88
- [[#in-a-dedicated-chat-buffer][In a dedicated chat buffer:]]
@@ -770,6 +772,43 @@ The above code makes the backend available to select. If you want it to be the
770
772
771
773
#+html: </details>
772
774
775
+
#+html: <details><summary>
776
+
**** xAI
777
+
#+html: </summary>
778
+
779
+
Register a backend with
780
+
#+begin_src emacs-lisp
781
+
;; xAI offers an OpenAI compatible API
782
+
(gptel-make-openai "xAI" ;Any name you want
783
+
:host "api.x.ai"
784
+
:key "your-api-key" ;can be a function that returns the key
785
+
:endpoint "/v1/chat/completions"
786
+
:stream t
787
+
:models '(;; xAI now only offers `grok-beta` as of the time of this writing
788
+
grok-beta))
789
+
#+end_src
790
+
791
+
You can pick this backend from the menu when using gptel (see [[#usage][Usage]])
792
+
793
+
***** (Optional) Set as the default gptel backend
794
+
795
+
The above code makes the backend available to select. If you want it to be the default backend for gptel, you can set this as the value of =gptel-backend=. Use this instead of the above.
796
+
#+begin_src emacs-lisp
797
+
;; OPTIONAL configuration
798
+
(setq
799
+
gptel-model 'grok-beta
800
+
gptel-backend
801
+
(gptel-make-openai "xAI" ;Any name you want
802
+
:host "api.x.ai"
803
+
:key "your-api-key" ;can be a function that returns the key
804
+
:endpoint "/v1/chat/completions"
805
+
:stream t
806
+
:models '(;; xAI now only offers `grok-beta` as of the time of this writing
807
+
grok-beta)))
808
+
#+end_src
809
+
810
+
#+html: </details>
811
+
773
812
** Usage
774
813
775
814
(There is also a [[https://www.youtube.com/watch?v=bsRnh_brggM][video demo]] showing various uses of gptel.)
0 commit comments