The Statistics Agent Team now supports 4 LLM providers through a unified interface, allowing you to choose the best model for your use case.
| Provider | Status | Default Model | Integration Method |
|---|---|---|---|
| Gemini | ✅ Working | gemini-2.0-flash-exp |
Google ADK (native) |
| Claude | ✅ Working | claude-3-5-sonnet-20241022 |
OmniLLM adapter |
| OpenAI | ✅ Working | gpt-4o-mini |
OmniLLM adapter |
| Ollama | ✅ Working | llama3.2 |
OmniLLM adapter |
export LLM_PROVIDER=openai
export OPENAI_API_KEY=your_key_here
export SEARCH_PROVIDER=serper
export SERPER_API_KEY=your_key_here
make run-all-einoexport LLM_PROVIDER=claude
export CLAUDE_API_KEY=your_key_here
# or
export ANTHROPIC_API_KEY=your_key_here
make run-all-einoexport LLM_PROVIDER=gemini
export GEMINI_API_KEY=your_key_here
# or
export GOOGLE_API_KEY=your_key_here
make run-all-eino# Start Ollama first: ollama serve
export LLM_PROVIDER=ollama
export OLLAMA_URL=http://localhost:11434
export LLM_MODEL=llama3.2
make run-all-einoThe system uses two integration paths:
-
Gemini → Direct via Google ADK
- Uses
google.golang.org/adk/model/gemini - Native ADK support, most efficient
- Uses
-
Claude, OpenAI, Ollama → Via OmniLLM adapter
- Uses
github.com/agentplexus/omnillmv0.8.0 - Adapter:
pkg/llm/adapters/omnillm_adapter.go - Implements ADK's
model.LLMinterface
- Uses
pkg/llm/
├── factory.go # LLM factory with multi-provider support
└── adapters/
└── omnillm_adapter.go # ADK interface adapter for OmniLLM
# (Self-contained, can move to OmniLLM repo)
// Factory creates appropriate LLM based on provider
func (mf *ModelFactory) CreateModel(ctx context.Context) (model.LLM, error) {
switch mf.cfg.LLMProvider {
case "gemini":
return mf.createGeminiModel(ctx) // Native ADK
case "claude":
return adapters.NewMetaLLMAdapter("anthropic", apiKey, model)
case "openai":
return adapters.NewMetaLLMAdapter("openai", apiKey, model)
case "ollama":
return adapters.NewMetaLLMAdapter("ollama", "", model)
}
}The adapter (pkg/llm/adapters/metallm_adapter.go) is self-contained and portable:
type MetaLLMAdapter struct {
client *metallm.ChatClient
model string
}
// Implements google.golang.org/adk/model.LLM interface
func (m *MetaLLMAdapter) GenerateContent(ctx context.Context,
req *model.LLMRequest, stream bool) iter.Seq2[*model.LLMResponse, error]Design Intent: This entire adapters/ directory can be moved to metallm as pkg/adk/ for broader ecosystem use.
| Provider | Avg Latency | Cost (1M input tokens) | Best For |
|---|---|---|---|
| Gemini 2.0 Flash | ~500ms | $0.075 | Production (best balance) |
| Claude 3.5 Sonnet | ~1.5s | $3.00 | Complex reasoning |
| GPT-4o-mini | ~1.0s | $0.15 | Good balance |
| Ollama (local) | ~3-5s | Free | Privacy, no API costs |
| Provider | JSON Output | Context Understanding | Accuracy |
|---|---|---|---|
| Claude | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Excellent |
| GPT-4o-mini | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | Very Good |
| Gemini Flash | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | Very Good |
| Ollama (llama3.2) | ⭐⭐⭐ | ⭐⭐⭐ | Good |
# Provider selection (required)
LLM_PROVIDER=openai # Options: gemini, claude, openai, ollama
# API Keys (provider-specific)
GEMINI_API_KEY=sk-... # For Gemini
CLAUDE_API_KEY=sk-ant-... # For Claude
OPENAI_API_KEY=sk-... # For OpenAI
# Optional: Override default models
LLM_MODEL=gpt-4o # Use GPT-4o instead of mini
LLM_MODEL=claude-3-opus-20240229 # Use Opus instead of Sonnet
# Ollama specific
OLLAMA_URL=http://localhost:11434
LLM_MODEL=llama3.2For Production (Speed + Cost):
LLM_PROVIDER=gemini
LLM_MODEL=gemini-2.0-flash-expFor Best Quality:
LLM_PROVIDER=claude
LLM_MODEL=claude-3-5-sonnet-20241022For Good Balance:
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o-miniFor Privacy/Free:
LLM_PROVIDER=ollama
LLM_MODEL=llama3.2Test each provider with a simple request:
# Test OpenAI
export LLM_PROVIDER=openai
export OPENAI_API_KEY=your_key
make run-synthesis
# In another terminal
curl -X POST http://localhost:8004/synthesize \
-H "Content-Type: application/json" \
-d '{
"topic": "renewable energy",
"search_results": [
{"url": "https://www.iea.org/reports/renewables-2023",
"title": "Renewables 2023",
"domain": "iea.org"}
],
"min_statistics": 3
}'If you want to switch from OpenAI to Gemini (for cost savings):
# 1. Get Gemini API key from https://aistudio.google.com/apikey
# 2. Update environment
export LLM_PROVIDER=gemini
export GEMINI_API_KEY=your_gemini_key
# Remove or unset OPENAI_API_KEY
# 3. Restart agents
make run-all-einoCost Savings:
- OpenAI GPT-4o-mini: $0.15/1M input tokens
- Gemini 2.0 Flash: $0.075/1M input tokens
- 50% cost reduction
Issue: You have LLM_PROVIDER=openai but the old code is running.
Fix: Rebuild the agents:
make build
make run-all-einoIssue: Missing API key for selected provider.
Fix: Check your environment:
# For OpenAI
echo $OPENAI_API_KEY
# For Claude
echo $CLAUDE_API_KEY
# For Gemini
echo $GEMINI_API_KEYSet the appropriate key for your provider.
Issue: Can't connect to Ollama.
Fix:
# Start Ollama
ollama serve
# Pull the model
ollama pull llama3.2
# Set environment
export OLLAMA_URL=http://localhost:11434
export LLM_MODEL=llama3.2- Move
pkg/llm/adapters/tometallmaspkg/adk/ - Add streaming support for faster responses
- Add response caching to reduce API costs
- Support for additional metallm providers (AWS Bedrock, Azure, etc.)
- Automatic failover between providers
- Cost tracking and budgets
- A/B testing between providers
- Provider-specific optimizations
- LLM_INTEGRATION.md - Complete LLM integration guide
- 4_AGENT_ARCHITECTURE.md - 4-agent architecture details
- OmniLLM repository - Multi-provider LLM library
- Google ADK: Native Gemini support
- OmniLLM: Multi-provider abstraction layer
- Integration design: Unified adapter pattern for portability