Expand description
LLM client — provider-agnostic chat + embedding surface.
§Providers (#1066)
The historical client was Ollama-only. Post-#1066 the same struct supports two wire shapes and any vendor that speaks either:
| Variant | Wire shape | Auth | Vendors |
|---|---|---|---|
LlmProvider::Ollama | POST /api/chat, POST /api/embed | none | Ollama (native) |
LlmProvider::OpenAiCompatible | POST /v1/chat/completions, POST /v1/embeddings | Authorization: Bearer <key> | OpenAI, xAI Grok, Anthropic (via OpenAI shim), Google Gemini (/v1beta/openai), DeepSeek, Kimi (Moonshot), Qwen (Alibaba), Mistral, Groq, Together AI, Cerebras, OpenRouter, Fireworks, LMStudio, vLLM, llama.cpp server, … |
§Operator configuration
AI_MEMORY_LLM_BACKEND— selector. Accepted values:ollama(default; backward compat)openai-compatible— generic; requiresAI_MEMORY_LLM_BASE_URLset explicitly- alias values that pre-fill
AI_MEMORY_LLM_BASE_URLfor known vendors:xai,openai,anthropic,gemini,deepseek,kimi,qwen,mistral,groq,together,cerebras,openrouter,fireworks,lmstudio
AI_MEMORY_LLM_BASE_URL— overrides the default per-backend URL.AI_MEMORY_LLM_API_KEY— Bearer auth secret for OpenAI-compatible backends. Some aliases also accept per-vendor env vars as a convenience (e.g.XAI_API_KEYif backend=xai,OPENAI_API_KEYif backend=openai,ANTHROPIC_API_KEYif backend=anthropic,GEMINI_API_KEYif backend=gemini, etc.).AI_MEMORY_LLM_MODEL— model name passed through verbatim. The selection is vendor-specific (e.g.grok-4for xAI,deepseek-chatfor DeepSeek,qwen-maxfor Qwen).- Legacy
OLLAMA_BASE_URLis still honored when backend=ollama.
Structs§
Enums§
- LlmProvider
- LLM-provider wire-shape selector. Owned by
OllamaClient(the historical name preserved post-#1066 for call-site backward compatibility — a future rename toLlmClientis non-breaking and tracked separately).
Constants§
- BACKEND_
OLLAMA - v0.7.x (#1174 PR4-remainder) — canonical name of the Ollama-native backend selector.
- OPENAI_
COMPAT_ EMBEDDINGS_ PATH - #1598 — OpenAI-compatible embeddings endpoint path suffix, appended
to the resolved base URL (e.g.
https://openrouter.ai/api/v1). Single source for the embed wire path across the client’s two embed call sites and the doctor reachability probe.