feat(gptel): Add Kimi Code backend for gptel-magit integration

Configure gptel-magit with a dedicated Kimi-Code backend using
api.kimi.com endpoint with Roo Code headers for magit commit message
generation
This commit is contained in:
2026-05-11 00:01:36 +08:00
parent 68c7f8ba0d
commit 71a57a6922

View File

@@ -126,6 +126,30 @@ from the last 1500 characters of the buffer."
(add-to-list 'gptel-agent-dirs "~/.emacs.d/lisp/" t)
(gptel-agent-update))
(use-package gptel-magit
:hook
(magit-mode . gptel-magit-install)
:init
(with-eval-after-load 'gptel
(gptel-make-openai "Kimi-Code-magit"
:host "api.kimi.com"
:endpoint "/coding/v1/chat/completions"
:protocol "https"
:key (lambda ()
(auth-source-pick-first-password :host "api.kimi.com" :user "apikey"))
:stream t
:models '((kimi-for-coding))
:request-params '(:thinking (:type "disabled"))
:header (lambda (_)
(when-let ((key (gptel--get-api-key)))
`(("User-Agent" . "RooCode/3.30.3")
("HTTP-Referer" . "https://github.com/RooVetGit/Roo-Cline")
("X-Title" . "Roo Code")
("Authorization" . ,(concat "Bearer " key))))))
(setq gptel-magit-model 'kimi-for-coding
gptel-magit-backend (gptel-get-backend "Kimi-Code-magit"))))
(provide 'init-gptel)
;;; init-gptel.el ends here