5.8 KiB
LLM Provider Setup Guide
This guide explains how to configure an LLM (Large Language Model) provider for AdvisoryAI features in StellaOps.
Overview
AdvisoryAI uses LLM providers to power AI-assisted vulnerability analysis, advisory recommendations, and conversational assistance. You can choose from several supported providers based on your requirements for privacy, performance, and cost.
Supported Providers
| Provider | Description | Requirements |
|---|---|---|
| OpenAI | GPT-4o, GPT-4, GPT-3.5 Turbo | API key |
| Anthropic Claude | Claude 4 Sonnet, Claude 3.5 Sonnet, Claude 3 Opus | API key |
| Google Gemini | Gemini 1.5 Flash, Gemini 1.5 Pro | API key |
| Ollama | Local LLM (Llama 3, Mistral, etc.) | Local Ollama instance |
Quick Start
Using the Setup Wizard (Recommended)
Run the interactive setup wizard to configure an LLM provider:
stella setup --step llm
The wizard will:
- Present available provider options
- Prompt for required credentials
- Test API connectivity
- Save the configuration
Using Environment Variables
You can also configure providers using environment variables:
# OpenAI
export OPENAI_API_KEY="sk-..."
# Anthropic Claude
export ANTHROPIC_API_KEY="sk-ant-..."
# Google Gemini
export GEMINI_API_KEY="AIza..."
# or
export GOOGLE_API_KEY="AIza..."
Provider Configuration
OpenAI
Configuration file: etc/llm-providers/openai.yaml
enabled: true
priority: 100
api:
apiKey: "${OPENAI_API_KEY}"
baseUrl: "https://api.openai.com/v1"
model:
name: "gpt-4o"
fallbacks:
- "gpt-4-turbo"
- "gpt-3.5-turbo"
inference:
temperature: 0.0
maxTokens: 8192
seed: 42
Models available:
gpt-4o- Recommended for most use casesgpt-4-turbo- High performance, higher costgpt-4- Previous generationgpt-3.5-turbo- Lower cost, faster
Anthropic Claude
Configuration file: etc/llm-providers/claude.yaml
enabled: true
priority: 100
api:
apiKey: "${ANTHROPIC_API_KEY}"
baseUrl: "https://api.anthropic.com"
model:
name: "claude-sonnet-4-20250514"
fallbacks:
- "claude-3-5-sonnet-20241022"
- "claude-3-haiku-20240307"
inference:
temperature: 0.0
maxTokens: 8192
Models available:
claude-sonnet-4-20250514- Latest Sonnet model (recommended)claude-3-5-sonnet-20241022- Claude 3.5 Sonnetclaude-3-opus-20240229- Highest capabilityclaude-3-haiku-20240307- Fastest, lowest cost
Google Gemini
Configuration file: etc/llm-providers/gemini.yaml
enabled: true
priority: 100
api:
apiKey: "${GEMINI_API_KEY}"
baseUrl: "https://generativelanguage.googleapis.com/v1beta"
model:
name: "gemini-1.5-flash"
fallbacks:
- "gemini-1.5-pro"
- "gemini-1.0-pro"
inference:
temperature: 0.0
maxTokens: 8192
topP: 1.0
topK: 40
Models available:
gemini-1.5-flash- Fast, cost-effective (recommended)gemini-1.5-pro- Higher capabilitygemini-1.0-pro- Previous generation
Ollama (Local)
Configuration file: etc/llm-providers/ollama.yaml
enabled: true
priority: 50
api:
endpoint: "http://localhost:11434"
model:
name: "llama3:8b"
fallbacks:
- "mistral:7b"
inference:
temperature: 0.0
maxTokens: 4096
Prerequisites:
- Install Ollama: https://ollama.ai
- Pull a model:
ollama pull llama3:8b - Start Ollama:
ollama serve
Recommended models:
llama3:8b- Good balance of speed and capabilityllama3:70b- Higher capability, requires more resourcesmistral:7b- Fast, efficientcodellama:7b- Optimized for code
Checking Configuration
Using Doctor
Run the Doctor checks to validate your LLM configuration:
# Check all AI-related configuration
stella doctor run --category ai
# Check specific provider
stella doctor run --check check.ai.provider.openai
stella doctor run --check check.ai.provider.claude
stella doctor run --check check.ai.provider.gemini
Using the CLI
Check your AdvisoryAI chat configuration:
stella advise chat-doctor
Troubleshooting
"AI/LLM provider not configured"
This error appears when no LLM provider is configured. Solutions:
- Run
stella setup --step llmto configure a provider - Set environment variables for your preferred provider
- Create a configuration file in
etc/llm-providers/
API Key Invalid
If you receive authentication errors:
- Verify your API key is correct
- Check the API key has not expired
- Ensure billing is active on your provider account
- For Gemini, ensure the Generative Language API is enabled
Connection Timeout
If connections time out:
- Check network connectivity to the provider endpoint
- Verify proxy settings if behind a firewall
- For Ollama, ensure the service is running locally
Rate Limiting
If you encounter rate limits:
- Reduce request frequency
- Consider upgrading your API tier
- Enable request queueing in configuration
Offline/Air-Gapped Operation
For air-gapped deployments, use Ollama with locally-available models:
- Download models on a connected system
- Transfer model files to the air-gapped environment
- Configure Ollama with local models
- Set
AdvisoryAI:DefaultProvidertoollama
Security Considerations
- API Key Storage: Never commit API keys to version control. Use environment variables or secure vaults.
- Data Privacy: Be aware of data sent to cloud providers. Use Ollama for sensitive data.
- Rate Limiting: Configure appropriate rate limits to prevent abuse.
- Audit Logging: Enable audit logging for all LLM interactions.