Every setting that decides how morie_llm_ask (and
rmorie ask) reaches a model: the route, your own OpenAI-compatible
server (own.url, own.model, own.key), Ollama
(ollama.url, ollama.model, ollama.key; ollama.url
may be https://ollama.com with your Ollama key), and a key and model
per provider (anthropic.key, openai.model, ...: the providers
are rmoriebricklayer::bricklayer_llm_providers()). The settings are
rmoriebricklayer's, in the file it shares with rmorie, so
morie_llm_config() is rmoriebricklayer::bricklayer_llm_config().
An environment variable that is set wins over the saved value; a key is never
shown, only "set".
Examples
old <- Sys.getenv("XDG_CONFIG_HOME", unset = NA)
Sys.setenv(XDG_CONFIG_HOME = tempfile())
head(morie_llm_config()) # reading writes nothing
#> key value source env
#> 1 route auto default MORIE_LLM_ROUTE
#> 2 own.url (not set) default MORIE_LLM_BASE_URL
#> 3 own.key (not set) default MORIE_LLM_API_KEY
#> 4 own.model (not set) default MORIE_LLM_MODEL
#> 5 ollama.url http://localhost:11434 default OLLAMA_HOST
#> 6 ollama.model (the first one pulled) default OLLAMA_MODEL
#> help
#> 1 which route `ask` uses: auto (own endpoint, then each provider with a key, then Ollama), own, ollama or a provider
#> 2 your own OpenAI-compatible server, e.g. http://localhost:1234/v1 (LM Studio), http://localhost:8080/v1 (llama-server -m /path/model.gguf) or https://api.example.org/v1
#> 3 API key for your own server (sent as a Bearer token)
#> 4 model name on your own server
#> 5 your Ollama server, e.g. http://localhost:11434 or 192.168.1.20:11434; off to skip Ollama
#> 6 Ollama model to use (default: the first one pulled)
if (is.na(old)) Sys.unsetenv("XDG_CONFIG_HOME") else Sys.setenv(XDG_CONFIG_HOME = old)
if (FALSE) { # \dontrun{
morie_llm_config(anthropic.key = "sk-ant-...", route = "anthropic")
morie_llm_config(ollama.url = "http://192.168.1.20:11434", ollama.model = "qwen3:8b")
morie_llm_config(route = NULL) # back to the automatic order
} # }
