Configure gptel with OpenRouter

This commit is contained in:
Tobias Ostner 2025-08-23 13:55:50 +02:00
parent d7f3fc0b8e
commit b2fab49b5e

View file

@ -315,9 +315,17 @@
(use-package gptel (use-package gptel
:bind ("C-c RET" . gptel-send) :bind ("C-c RET" . gptel-send)
:config :config
(setq gptel-api-key (setq gptel-backend
(lambda () (gptel-make-openai "OpenRouter"
(nth 0 (process-lines "pass" "show" "openai-api")))) :host "openrouter.ai"
:endpoint "/api/v1/chat/completions"
:stream t
:key (lambda ()
(nth 0 (process-lines "pass" "show" "emacs-openrouter-api-key")))
:models '(openai/gpt-5
openai/gpt-5-mini
openai/gpt-5-nano
deepseek/deepseek-chat-v3-0324:free)))
(setq gptel-default-mode 'org-mode)) (setq gptel-default-mode 'org-mode))
(use-package graphql-mode (use-package graphql-mode