configure_llm
Configure project LLM settings via local per-developer config, test connectivity with an API call, and get data security warnings for external endpoints.
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).
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. 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: "auto", "ollama", "openai". model: Chat model name. embed_model: Embedding model name (Ollama only). auto_pull: Whether to auto-pull models on 404. 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. | |
| auto_pull | No | Auto-pull models on 404 (Ollama only). False for intranet. | |
| embed_model | No | Embedding model name (Ollama only). 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. | |
| 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: 'auto' (default), 'ollama', or 'openai'. | auto |