LLM providers: servers, config and model detection

The LLM pass is optional. Without it, reviews use the built-in static analyzers and coding tasks use mechanical fixes only. No model id is hard-coded: the server endpoint comes from configuration, and the model is detected from that server unless you pin one.

Where the LLM server is specified

Two configuration layers, repository first:

  1. Repository config (tools.llm object) names the server per repo:

``yaml tools: llm: provider: lmstudio # openai | anthropic | google | ollama | # vllm | llamacpp | lmstudio | openai-compatible baseUrl: http://127.0.0.1:1234/v1 model: auto # detected, or pin an exact model id ``

tools.llm: true also works and means "use the server environment". API keys are rejected in repository config on purpose.

  1. Server environment (the operator default):

``text CJR_LLM_PROVIDER=lmstudio CJR_LLM_BASE_URL=http://127.0.0.1:1234/v1 CJR_LLM_MODEL= # empty or "auto" = detect CJR_LLM_API_KEY= # only for keyed compatible gateways OPENAI_API_KEY / ANTHROPIC_API_KEY / GOOGLE_API_KEY (or GEMINI_API_KEY) OLLAMA_HOST=http://127.0.0.1:11434 ``

Keys live only in the server environment. The CLI never sees them.

Model detection

With model: auto (the default), the server asks the configured endpoint for its model list and picks the best current model:

ProviderDetection endpointPick rule
openaiGET /v1/modelsnewest GPT chat model, mini preferred at equal version
anthropicGET /v1/modelsnewest Sonnet, then Opus, then Haiku
googleGET /v1beta/modelsnewest Gemini Pro, then Flash, generateContent only
ollamaGET /api/tagsfirst installed model
vllmGET /v1/modelscoder models first, then largest
llamacppGET /v1/modelsthe loaded model
lmstudioGET /v1/modelscoder models first, then largest
openai-compatibleGET /v1/modelscoder models first, then largest

Embedding, audio, image and vision specialties are skipped. The picked model is cached per provider+base URL for the process lifetime. Pin an exact id with model: / CJR_LLM_MODEL when you want determinism or a small fast model on a machine that also hosts very large ones.

Default base URLs when baseUrl is omitted: OpenAI https://api.openai.com/v1, Anthropic https://api.anthropic.com/v1, Google https://generativelanguage.googleapis.com/v1beta, Ollama http://127.0.0.1:11434, vLLM http://127.0.0.1:8000/v1, llama.cpp http://127.0.0.1:8080/v1, LM Studio http://127.0.0.1:1234/v1. openai-compatible has no default; baseUrl is required.

Provider aliases accepted in config: gemini (google), llama.cpp / llama-cpp (llamacpp), lm-studio (lmstudio).

Local servers

Start the server first, then point the config at it:

Inside Docker, a model server on the host is reached through http://host.docker.internal:<port>; set CJR_LLM_BASE_URL accordingly.

Behavior and limits