[llm]
Provider and model for grith run and the REPL, and the three places an API key can come from.
This section only affects grith's own agent - grith run and the REPL. Supervising an
external tool with grith exec does not use it: Claude Code, Codex and the rest bring their
own model connections.
| Key | Default |
|---|---|
default_provider | "ollama" |
ollama.base_url | "http://localhost:11434" |
ollama.model | "llama3.1:8b" |
openai.model | "gpt-4o-mini" |
anthropic.model | "claude-sonnet-4-5-20250514" |
openrouter.model | "anthropic/claude-sonnet-4-5-20250514" |
default_provider must be one of ollama, openai, anthropic or openrouter. Anything
else is a fatal validation error.
[llm]
default_provider = "anthropic"
[llm.anthropic]
model = "claude-sonnet-4-5-20250514"grith config set accepts llm.default_provider, both Ollama keys, llm.openai.model and
llm.anthropic.model. The OpenRouter model is edited in the file. GRITH_LLM_PROVIDER
switches provider for one invocation without touching config.
⚠️Three model defaults move under an overlay
The OpenAI, Anthropic and OpenRouter model defaults are among the five keys that change value the moment any config file exists. See the sparse-file trap.
Where the API key comes from
Three sources, first hit wins:
api_keyin the config file. Explicit and highest priority.- The environment variable named by
api_key_env-OPENAI_API_KEY,ANTHROPIC_API_KEY,OPENROUTER_API_KEYby default. Change the name if your environment uses a different one. - A synced provider key at
~/.config/grith/provider-keys/<provider>.json, written bygrith pro sync. Encrypted at rest and decrypted with your account key.
An empty value at any level falls through to the next.
Point at a differently-named variable
[llm.anthropic]
api_key_env = "WORK_ANTHROPIC_KEY"Ollama needs no key. If you only supervise external agents, this whole section can stay at its defaults.