configure_llm
Set per-project LLM API, model, and embedding options in a gitignored local file; validates the connection and rolls back on failure, leaving shared config untouched.
Instructions
Configure LLM settings for the current project.
Writes to <project>/.fw-context/local.toml ONLY (gitignored,
per-developer). Does NOT modify the global config or the shared
project config.toml. After writing, tests the configuration
by making a simple API call (skipped when LLM is disabled). When the
test fails, the previous local.toml is restored and status is
"error". A call with no change returns "error" and writes
nothing.
IMPORTANT: When chat_api_base points to an external host, source
code snippets in chat prompts will be sent to that endpoint. Ensure
this complies with your organization's data security policies.
Consider using local Ollama or an internal API proxy first.
Args:
project_root: Project root directory. Auto-detected if omitted.
project: Project name or project_id — call list_projects to get them. Use
it to ask about a project that is not the project of the current
directory. It is an alternative to project_root, which takes a root
path. Give one of the two, not both.
chat_api_base: Chat API URL (see description for format details).
chat_api_key: Bearer token for cloud/proxy APIs.
chat_api_format: Override auto-detection: "ollama" or "openai";
"auto" returns to detection from the URL. None keeps the
current value.
model: Chat model name.
embed_model: Embedding model: an Ollama tag, a sentence-transformers
name (BAAI/..., needs the st extra), or ft://.
auto_pull: Whether to auto-pull models on 404. None keeps the
current value.
stream: Stream chat responses via SSE. True avoids reverse-proxy idle timeouts.
Returns: dict: {status ("ok"|"error"), chat_api (dict — configured, endpoint, format, model), model (str), auto_pull (bool), stream (bool), test_latency_s (float, on success), test_response (str, on success), compliance_warning (str, when chat_api_base is external), message (str)}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Chat model name. None = keep current. | |
| stream | No | Stream chat responses via SSE (both OpenAI-compatible and Ollama-native). True = send stream:true, consume SSE chunks — avoids reverse-proxy idle timeouts (nginx 60s, Cloudflare 100s). None = keep current setting. | |
| project | No | Project name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both. | |
| auto_pull | No | Auto-pull models on 404 (Ollama only). False for intranet. None = keep current. | |
| embed_model | No | Embedding model: an Ollama tag, a sentence-transformers name (e.g. 'BAAI/bge-small-en-v1.5'), or 'ft://latest'. None = keep current. | |
| chat_api_key | No | API key for cloud/proxy APIs. None for local/no-auth. | |
| project_root | No | Project root. Auto-detected if omitted. This field also accepts a project name or a project_id, but project is the clear field for those. | |
| chat_api_base | No | Chat API URL. None = use local Ollama for chat. Auto-detects format: :11434 or /api/generate -> Ollama, /v1 or bare host -> OpenAI-compatible. Examples: 'https://api.deepseek.com/v1' (DeepSeek), 'http://localhost:4000' (LiteLLM), 'http://localhost:8080/v1' (llama.cpp). WARNING: external URLs send source code to that host. | |
| chat_api_format | No | Format override: 'ollama' or 'openai'; 'auto' returns to detection from the URL. None = keep current. |