Ollama variations - ahyatt/llm GitHub Wiki

Some Ollama setups in unconventional ways. When that happens, it's good to have some examples on how to get things to work, even if the llm doesn't natively support your setup. As an example, if your Ollama needs a key to operate, you can define your own variation on our standard Ollama provider.

(require 'llm-ollama)
(cl-defstruct (llm-authed-ollama (:include llm-ollama)) key)
(cl-defmethod llm-provider-headers ((provider llm-authed-ollama))
  `(("Authorization" . ,(format "Bearer %s" (llm-authed-ollama-key provider)))))

(llm-chat (make-llm-authed-ollama :chat-model "llama3.1:8b-instruct-q8_0" :key <your key>)
          (llm-make-chat-prompt "Give me the names of 5 D&D orcs"))
⚠️ **GitHub.com Fallback** ⚠️