ChatAgents delegates all language-model initialization to theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/EllisYuan/ChatAgents/llms.txt
Use this file to discover all available pages before exploring further.
LLMConfig class in backend/llm_config.py. The class provides a dedicated factory method for each provider (create_claude, create_openai, create_groq) as well as a unified create_llm dispatcher. Provider identity is referenced via the LLMProvider constants rather than raw strings, keeping all provider names in one place and avoiding typos across the codebase.
Provider Constants
provider argument — for example LLMProvider.CLAUDE instead of the literal "claude".
Supported Providers
| Provider | Constant | API Key Env Var | Notes |
|---|---|---|---|
| Anthropic Claude | LLMProvider.CLAUDE | ANTHROPIC_API_KEY | Default provider |
| OpenAI | LLMProvider.OPENAI | OPENAI_API_KEY | Optional |
| Groq | LLMProvider.GROQ | GROQ_API_KEY | Reserved for future use |
Claude
Claude is the default provider and is the most thoroughly tested option in ChatAgents. Three model tiers are available, mapped from short aliases to full model identifiers:| Alias | Model ID | Best For |
|---|---|---|
haiku | claude-haiku-4-5-20251001 | High-volume, cost-sensitive, or testing scenarios |
sonnet | claude-sonnet-4-5-20250929 | Balanced performance — recommended default |
opus | claude-opus-4-1-202508059 | Highest quality, most capable reasoning |
LLMConfig.create_claude()
model— Short alias:"haiku","sonnet", or"opus". Falls back to"sonnet"if an unrecognised alias is provided.api_key— Anthropic API key. IfNone, the value ofANTHROPIC_API_KEYis read from the environment.temperature— Sampling temperature in the range0–1. Lower values produce more deterministic output; higher values increase creativity.max_tokens— Maximum number of tokens in the generated response.streaming— WhenTrue, the model is configured with{"tags": ["streaming"]}and responses are streamed token-by-token to the frontend.
OpenAI
OpenAI models are available whenOPENAI_API_KEY is set. The default temperature for OpenAI is 1 (matching OpenAI’s own API default), which differs from the Claude default of 0.7.
| Model Key | Model ID |
|---|---|
gpt-5.1 | gpt-5.1 |
gpt-5-mini | gpt-5-mini |
gpt-5-nano | gpt-5-nano |
gpt-5 | gpt-5 |
gpt-4.1-nano | gpt-4.1-nano |
LLMConfig.create_openai()
The
temperature default for OpenAI is 1, not 0.7. This matches OpenAI’s API default and generally produces natural, varied responses for chat use cases. Lower it toward 0 if you need more deterministic or factual answers.Groq
Groq support is implemented inLLMConfig but is reserved for future use and not yet exposed in the Streamlit UI. The integration is present so Groq can be wired in without structural changes once the UI surface is ready.
LLMConfig.create_groq()
Groq model aliases (
llama-3.3-70b, mixtral-8x7b, kimi-k2) are defined in the source but commented out in GROQ_MODELS pending UI support. Set GROQ_API_KEY in your .env to have the key available when Groq is enabled.Unified Interface
For code that needs to work with any provider interchangeably,create_llm dispatches to the correct factory method based on the provider string:
create_llm does not accept a temperature argument — each provider uses its own default. Use the provider-specific factory method directly when you need temperature control.
Example
provider is not one of the three supported values, create_llm raises a ValueError.
Selecting a Model at Request Time
The LLM is chosen per-request, not globally. TheAgentRequest body sent to the /stream_agent endpoint carries both the provider and model:
Summary LLM
Regardless of which main model is selected, a Claude Haiku instance is always instantiated assummary_llm. It is passed to create_output_summarizer() inside WebAgent.build_graph() and used exclusively to compress raw TavilyExtract and TavilyCrawl output before the main LLM sees it.
Using Haiku for summarization is a deliberate cost-optimization: Haiku’s pricing is a fraction of Sonnet or Opus, and summarizing tool output does not require the reasoning depth of the main model.