Skip to content

LLM Configuration

Settings for controlling how LambChat interacts with language models.

Model Provider Keys

These are consumed by the underlying LLM SDK libraries directly (not by the Settings class):

VariableDescription
LLM_API_KEYDefault LLM API key (consumed by LiteLLM)
LLM_API_BASEDefault LLM API base URL (consumed by LiteLLM)
LLM_MODELDefault LLM model name, e.g. anthropic/claude-sonnet-4-6
ANTHROPIC_API_KEYAnthropic API key (consumed by langchain-anthropic)
ANTHROPIC_BASE_URLAnthropic-compatible API base URL

TIP

LambChat supports multi-model management through the UI. The env vars above set the default provider. Users can add additional providers and models at runtime through the settings panel.

Retry & Cache Settings

VariableDefaultDescription
DEFAULT_MODEL_ID(empty)Admin model configuration ID used as the default for new sessions and background jobs. Empty = first enabled model.
LLM_MAX_RETRIES3Maximum number of API retries on failure.
LLM_RETRY_DELAY1.0Delay between retries in seconds.
LLM_MODEL_CACHE_SIZE50Model instance cache size. Prevents memory leaks from repeated instantiation.
LLM_MAX_INPUT_TOKENS(none)Optional: context window size for DeepAgent auto-summarization.
LLM_TEMPERATURE(none)Optional: default temperature for LLM calls.
LLM_MAX_TOKENS(none)Optional: max output tokens for LLM calls.

Prompt Cache Settings

VariableDefaultDescription
PROMPT_CACHE_MAX_SYSTEM_BLOCKS12Maximum cached system prompt blocks.
PROMPT_CACHE_MAX_TOOLS12Maximum cached tool definitions.
DEEPAGENT_DEFAULT_MAX_INPUT_TOKENS64000Default max input tokens for DeepAgent.

Example

bash
# .env
LLM_API_KEY=sk-your-api-key
LLM_API_BASE=https://api.openai.com/v1
LLM_MODEL=gpt-4o
LLM_MAX_RETRIES=3
LLM_RETRY_DELAY=1.0
LLM_MODEL_CACHE_SIZE=50