Wealth-Vault now supports local Large Language Models (LLMs) through Ollama and LM Studio, giving you complete control and privacy over your AI-powered financial coaching features.
- Privacy: Your financial data never leaves your machine
- Cost: No API costs - completely free after initial setup
- Offline: Works without internet connection
- Control: Choose and customize your preferred open-source models
- No Rate Limits: Unlimited usage without API restrictions
| Provider | Description | Best For |
|---|---|---|
| Gemini | Google's cloud API (default) | Quick setup, powerful responses |
| Ollama | Local LLM runtime | Easy setup, great model variety |
| LM Studio | Local LLM with UI | User-friendly, visual interface |
macOS/Linux:
curl -fsSL https://ollama.ai/install.sh | shWindows: Download from https://ollama.ai/download
# Recommended: Llama 2 (7B) - Good balance of speed and quality
ollama pull llama2
# Other popular options:
ollama pull llama3 # Meta's latest Llama model
ollama pull mistral # Fast and efficient
ollama pull mixtral # Larger, more capable model
ollama pull codellama # Optimized for code/technical content
ollama pull phi # Microsoft's compact model# Check if Ollama is running
curl http://localhost:11434/api/tags
# You should see a JSON response with your installed modelsEdit your backend/.env file:
# Set AI provider to Ollama
AI_PROVIDER=ollama
# Optional: Customize Ollama settings
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama2# If running with Docker
docker-compose up
# Or if running locally
cd backend && npm start
cd frontend && npm run devβ You're done! The AI coach now uses your local Ollama model.
Download from https://lmstudio.ai
- Open LM Studio
- Go to the "Search" tab
- Search for and download a model:
- Recommended:
TheBloke/Llama-2-7B-Chat-GGUF - Fast:
microsoft/phi-2-GGUF - Powerful:
TheBloke/Mistral-7B-Instruct-GGUF
- Recommended:
- Go to the "Local Server" tab in LM Studio
- Select your downloaded model
- Click "Start Server"
- Note the server URL (usually
http://localhost:1234)
Edit your backend/.env file:
# Set AI provider to LM Studio
AI_PROVIDER=lmstudio
# Optional: Customize LM Studio settings
LMSTUDIO_BASE_URL=http://localhost:1234/v1
LMSTUDIO_MODEL=local-model# If running with Docker
docker-compose up
# Or if running locally
cd backend && npm start
cd frontend && npm run devβ You're done! The AI coach now uses your LM Studio model.
When running Wealth-Vault in Docker, you need to adjust the URLs since the container needs to reach your host machine.
# docker-compose.yml
services:
backend:
# ... other config ...
environment:
- AI_PROVIDER=ollama
# Use host.docker.internal to access host machine from container
- OLLAMA_BASE_URL=http://host.docker.internal:11434
- OLLAMA_MODEL=llama2Or create a .env file in the root directory:
# .env
AI_PROVIDER=ollama
OLLAMA_BASE_URL=http://host.docker.internal:11434
OLLAMA_MODEL=llama2On Linux, you may need to use your host IP instead of host.docker.internal:
# Find your host IP
ip addr show docker0 | grep inet
# Use that IP in your .env
OLLAMA_BASE_URL=http://172.17.0.1:11434| Model | Size | RAM Needed | Speed | Quality | Recommendation |
|---|---|---|---|---|---|
llama2 |
7B | 8GB | Fast | Good | β Best starter |
llama3 |
8B | 8GB | Fast | Very Good | β Recommended |
mistral |
7B | 8GB | Very Fast | Good | Great for speed |
mixtral |
8x7B | 32GB | Slow | Excellent | Best quality |
phi |
3B | 4GB | Very Fast | Decent | Low-end hardware |
# List installed models
ollama list
# Remove a model
ollama rm llama2
# Update a model
ollama pull llama2
# Run a model interactively (for testing)
ollama run llama2You can customize model behavior in backend/config/aiConfig.js:
ollama: {
baseUrl: process.env.OLLAMA_BASE_URL || 'http://localhost:11434',
defaultModel: process.env.OLLAMA_MODEL || 'llama2',
models: {
fast: 'llama2',
pro: 'mixtral', // Use a larger model for detailed advice
// Add your custom models
custom: 'my-finetuned-model',
}
}You can switch providers without restarting by changing the AI_PROVIDER environment variable:
# Switch to Ollama
export AI_PROVIDER=ollama
# Switch to Gemini
export AI_PROVIDER=gemini
# Switch to LM Studio
export AI_PROVIDER=lmstudioProblem: "Failed to connect to Ollama"
Solutions:
- Ensure Ollama is running:
ollama ps - Check if the service is accessible:
curl http://localhost:11434/api/tags - Verify the model is installed:
ollama list - Try pulling the model again:
ollama pull llama2
Problem: "Model not found"
Solution:
# Pull the specific model
ollama pull llama2
# Or specify a different model in your .env
OLLAMA_MODEL=mistralProblem: "Failed to connect to LM Studio"
Solutions:
- Ensure LM Studio local server is running (check the UI)
- Verify the server URL in LM Studio (usually
http://localhost:1234) - Test the endpoint:
curl http://localhost:1234/v1/models
Problem: Slow responses
Solutions:
- Use a smaller model (e.g., phi-2 instead of 70B models)
- Enable GPU acceleration in LM Studio settings
- Reduce context window size in LM Studio
Problem: Container can't reach Ollama/LM Studio on host
Solutions:
- Use
host.docker.internalinstead oflocalhost - On Linux, use host IP from
docker0interface - Ensure Ollama/LM Studio is binding to
0.0.0.0, not just127.0.0.1
| Provider | First Response | Subsequent | Privacy | Cost | Setup Time |
|---|---|---|---|---|---|
| Gemini | ~1-2s | ~1-2s | Cloud | $$ | 2 min |
| Ollama (llama2-7B) | ~3-5s | ~3-5s | 100% Local | Free | 10 min |
| LM Studio (7B) | ~3-5s | ~3-5s | 100% Local | Free | 15 min |
| Ollama (mixtral) | ~10-15s | ~10-15s | 100% Local | Free | 15 min |
Tested on: M1 Mac, 16GB RAM
- Local LLMs: All processing happens on your machine. Your financial data NEVER leaves your computer.
- Cloud APIs: Data is sent to third-party services (Google for Gemini) over encrypted connections.
- Use Local LLMs if you're handling sensitive financial data or operating in regulated environments
- Use Cloud APIs for better performance and accuracy if privacy is less of a concern
- Never commit API keys or sensitive configuration to version control
- Start Small: Begin with
llama2ormistralbefore trying larger models - GPU Acceleration: If you have a GPU, enable it in Ollama/LM Studio for much faster inference
- Monitor Resources: Local LLMs use significant RAM - close other applications if needed
- Context Window: Larger models support longer conversations but are slower
- Fine-tuning: Consider fine-tuning a model on financial advisory data for better domain-specific responses
- Ollama Documentation: https://github.com/ollama/ollama
- LM Studio Discord: Join their community for help and tips
- Wealth-Vault Issues: Report bugs or request features on our GitHub
# Check Ollama status
ollama ps
# Test Ollama with a quick prompt
curl http://localhost:11434/api/generate -d '{
"model": "llama2",
"prompt": "What is the best way to save money?",
"stream": false
}'
# Test LM Studio endpoint
curl http://localhost:1234/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "local-model",
"messages": [{"role": "user", "content": "Hello"}]
}'Once you have local LLMs working:
- Try different models to find the best balance of speed and quality for your needs
- Experiment with the AI Financial Coach feature
- Compare responses between different providers
- Consider running larger models if you have the hardware
Happy financial coaching with complete privacy! π