summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVineet Kumar <git@vineetk.net>2026-04-26 19:53:15 -0400
committerVineet Kumar <git@vineetk.net>2026-04-26 20:00:42 -0400
commit9c27848e427482d5862ceaff0cde310f32726097 (patch)
tree59062f679a4dd6ecbab5d7831becfe5633e9b464
parent90e8f7357809a8be4f7c2cec51e8da31f8858c5e (diff)
files/emacs: make gptel more daily-drivable
I'm now at the stage of consciously stopping myself from opening the web interfaces and asking via gptel which is nice actually
-rw-r--r--epistemia/files/emacs/.config/emacs/init.el46
1 files changed, 32 insertions, 14 deletions
diff --git a/epistemia/files/emacs/.config/emacs/init.el b/epistemia/files/emacs/.config/emacs/init.el
index 68ac223..d0f0b1e 100644
--- a/epistemia/files/emacs/.config/emacs/init.el
+++ b/epistemia/files/emacs/.config/emacs/init.el
@@ -545,33 +545,51 @@
545;;;;;;;;; 545;;;;;;;;;
546;; LLM ;; 546;; LLM ;;
547;;;;;;;;; 547;;;;;;;;;
548(defun vin/gptel-mode-auto ()
549 "Ensure that this file opens with `gptel-mode' enabled."
550 ;; taken from https://github.com/karthink/gptel/wiki/Auto%E2%80%90restore-gptel%E2%80%90mode-in-chat-buffers
551 (save-excursion
552 (let ((enable-local-variables t)) ; Ensure we can modify local variables
553 (if (and (save-excursion
554 (goto-char (point-min))
555 (looking-at ".*-\\*-"))) ; If there's a -*- line
556 ;; First remove any existing eval, then add the new one
557 (modify-file-local-variable-prop-line
558 'eval nil 'delete))
559 ;; Always add our eval
560 (add-file-local-variable-prop-line
561 'eval '(and (fboundp 'gptel-mode) (gptel-mode 1))))))
562
548(use-package gptel 563(use-package gptel
549 :after age ; because of ~/.authinfo.age 564 :after age ; because of ~/.authinfo.age
550 :config 565 :config
551 (gptel-make-openai "llama-swap" 566 (setq gptel-backend
552 :protocol "http" 567 (gptel-make-openai "llama-swap"
553 :host "llm.demiurge.epistemia" 568 :protocol "http"
554 :endpoint "/v1/chat/completions" 569 :host "llm.demiurge.epistemia"
555 :stream t 570 :endpoint "/v1/chat/completions"
556 :models '(Qwen3.5-27B 571 :stream t
557 Qwen3.5-35B-A3B 572 :models '(Qwen3.6-27B
558 Rocinante-X-12B-v1 573 Qwen3.6-35B-A3B
559 Ministral-3-14B-Instruct-2512)) 574 Gemma4-26B-A4B
575 Gemma4-31B)))
576 (setq gptel-model 'Qwen3.6-35B-A3B)
560 (gptel-make-openai "OpenRouter" 577 (gptel-make-openai "OpenRouter"
561 :host "openrouter.ai" 578 :host "openrouter.ai"
562 :endpoint "/api/v1/chat/completions" 579 :endpoint "/api/v1/chat/completions"
563 :stream t 580 :stream t
564 :key (auth-source-pick-first-password :host "openrouter.ai") 581 :key (auth-source-pick-first-password :host "openrouter.ai")
565 :models '(minimax/minimax-m2.7 582 :models '(moonshotai/kimi-k2.6
566 minimax/minimax-m2.5:free 583 deepseek/deepseek-v4-pro))
567 anthropic/claude-sonnet-4.6))
568 :custom 584 :custom
569 (gptel-model "llama-swap:Qwen3.5-35B-A3B") 585 (gptel-default-mode #'org-mode)
586 (gptel-response-prefix-alist '((org-mode . "**** Response\n")))
570 (gptel-temperature nil) 587 (gptel-temperature nil)
571 (gptel-directives 588 (gptel-directives
572 '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") 589 '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.")
573 (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") 590 (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.")
574 (writing . "You are a large language model and a writing assistant. Respond concisely.")))) 591 (writing . "You are a large language model and a writing assistant. Respond concisely.")))
592 :hook (gptel-save-state . vin/gptel-mode-auto))
575 593
576(use-package gptel-agent 594(use-package gptel-agent
577 :after gptel 595 :after gptel