emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gptel e994a443d3 262/273: README: add OpenRouter instructi


From: ELPA Syncer
Subject: [nongnu] elpa/gptel e994a443d3 262/273: README: add OpenRouter instructions (#282)
Date: Wed, 1 May 2024 10:02:49 -0400 (EDT)

branch: elpa/gptel
commit e994a443d35a34082ad5d6d45dd92163b10635cd
Author: Bryan Larsen <bryan@larsen.st>
Commit: GitHub <noreply@github.com>

    README: add OpenRouter instructions (#282)
    
    README: Add instructions for using OpenRouter.
---
 README.org | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/README.org b/README.org
index 659667d0c2..b250b2bf71 100644
--- a/README.org
+++ b/README.org
@@ -20,6 +20,7 @@ GPTel is a simple Large Language Model chat client for Emacs, 
with support for m
 | Perplexity         | ✓      | 
[[https://docs.perplexity.ai/docs/getting-started][API key]]                   |
 | Anthropic (Claude) | ✓      | [[https://www.anthropic.com/api][API key]]     
              |
 | Groq               | ✓      | [[https://console.groq.com/keys][API key]]     
                     |
+| OpenRouter         | ✓      | [[https://openrouter.ai/keys][API key]]        
                  |
 
 *General usage*: ([[https://www.youtube.com/watch?v=bsRnh_brggM][YouTube 
Demo]])
 
@@ -61,6 +62,7 @@ GPTel uses Curl if available, but falls back to url-retrieve 
to work without ext
       - [[#perplexity][Perplexity]]
       - [[#anthropic-claude][Anthropic (Claude)]]
       - [[#groq][Groq]]
+      - [[#openrouter][OpenRouter]]
   - [[#usage][Usage]]
     - [[#in-any-buffer][In any buffer:]]
     - [[#in-a-dedicated-chat-buffer][In a dedicated chat buffer:]]
@@ -506,6 +508,54 @@ The above code makes the backend available to select.  If 
you want it to be the
 
 #+html: </details>
 
+#+html: <details><summary>
+**** OpenRouter
+#+html: </summary>
+
+Register a backend with
+#+begin_src emacs-lisp
+;; OpenRouter offers an OpenAI compatible API
+(gptel-make-openai "OpenRouter"               ;Any name you want
+  :host "openrouter.ai"
+  :endpoint "/api/v1/chat/completions"
+  :stream t
+  :key "your-api-key"                   ;can be a function that returns the key
+  :models '("openai/gpt-3.5-turbo"
+            "mistralai/mixtral-8x7b-instruct"
+            "meta-llama/codellama-34b-instruct"
+            "codellama/codellama-70b-instruct"
+            "google/palm-2-codechat-bison-32k"
+            "google/gemini-pro"))
+
+#+end_src
+
+You can pick this backend from the menu when using gptel (see 
[[#usage][Usage]]).
+
+***** (Optional) Set as the default gptel backend
+
+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.
+#+begin_src emacs-lisp
+;; OPTIONAL configuration
+(setq gptel-model   "mixtral-8x7b-32768"
+      gptel-backend
+      (gptel-make-openai "OpenRouter"               ;Any name you want
+        :host "openrouter.ai"
+        :endpoint "/api/v1/chat/completions"
+        :stream t
+        :key "your-api-key"                   ;can be a function that returns 
the key
+        :models '("openai/gpt-3.5-turbo"
+                  "mistralai/mixtral-8x7b-instruct"
+                  "meta-llama/codellama-34b-instruct"
+                  "codellama/codellama-70b-instruct"
+                  "google/palm-2-codechat-bison-32k"
+                  "google/gemini-pro")))
+
+#+end_src
+
+#+html: </details>
+
+
+
 ** Usage
 
 (This is also a [[https://www.youtube.com/watch?v=bsRnh_brggM][video demo]] 
showing various uses of gptel.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]