AI Providers Guide¶
SQLMap AI supports multiple AI providers, each with different strengths and use cases. This guide helps you choose and configure the right provider for your needs.
Available Providers¶
Provider Comparison¶
Provider | Speed | Privacy | Cost | Setup | Best For |
---|---|---|---|---|---|
Groq | ⚡ Fastest | Cloud | Free tier | Easy | Production use |
OpenAI | ⚡ Fast | Cloud | Pay per use | Easy | Reliability |
Anthropic | ⚡ Fast | Cloud | Pay per use | Easy | Advanced reasoning |
Ollama | Fast | 🔒 Local | Free | Medium | Privacy-focused |
Groq (Recommended)¶
Overview¶
Groq is the fastest AI provider, offering near-instant responses with excellent performance for SQL injection analysis.
Setup¶
- Get API Key:
- Visit https://console.groq.com
- Sign up for a free account
-
Generate an API key
-
Configure Environment:
-
Test Configuration:
Usage¶
# Use Groq explicitly
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider groq
# Auto-select (Groq will be chosen if available)
sqlmap-ai -u "http://example.com/page.php?id=1"
Advantages¶
- ⚡ Fastest responses (usually < 1 second)
- 🆓 Free tier available
- 🎯 Excellent for real-time analysis
- 🔧 Easy setup
Limitations¶
- ☁️ Cloud-based (requires internet)
- 💰 Usage limits on free tier
OpenAI¶
Overview¶
OpenAI provides reliable and well-supported AI services with excellent reasoning capabilities.
Setup¶
- Get API Key:
- Visit https://platform.openai.com
- Create an account
-
Generate an API key
-
Configure Environment:
-
Test Configuration:
Usage¶
Advantages¶
- 🛡️ Reliable and stable
- 🧠 Excellent reasoning
- 📚 Well-documented
- 🔧 Easy integration
Limitations¶
- 💰 Pay per use (no free tier)
- ☁️ Cloud-based
Anthropic (Claude)¶
Overview¶
Anthropic's Claude offers advanced reasoning capabilities and is particularly good at complex analysis tasks.
Setup¶
- Get API Key:
- Visit https://console.anthropic.com
- Create an account
-
Generate an API key
-
Configure Environment:
-
Test Configuration:
Usage¶
Advantages¶
- 🧠 Advanced reasoning
- 📊 Excellent analysis
- 🛡️ Safety-focused
- 📚 Good documentation
Limitations¶
- 💰 Pay per use
- ☁️ Cloud-based
Ollama (Local AI)¶
Overview¶
Ollama runs AI models locally on your machine, providing complete privacy and offline capabilities.
Setup¶
-
Install Ollama:
-
Start Ollama Service:
-
Download a Model:
-
Configure Environment:
-
Test Configuration:
Usage¶
# Use Ollama explicitly
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider ollama
# With specific model
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider ollama --ollama-model codellama
Available Models¶
Model | Size | Speed | Quality | Use Case |
---|---|---|---|---|
llama3.2 | 4GB | Fast | Good | General use |
codellama | 7GB | Medium | Excellent | Code analysis |
mistral | 4GB | Fast | Good | Balanced |
qwen2.5 | 4GB | Fast | Good | Reasoning |
Advantages¶
- 🔒 Complete privacy (runs locally)
- 🆓 Free to use
- 📴 Works offline
- 🎛️ Full control
Limitations¶
- 💾 Requires significant RAM (4-8GB)
- 🖥️ Uses local resources
- ⚙️ More complex setup
Configuration¶
Environment Variables¶
Create a .env
file in your project directory:
# AI Provider API Keys
GROQ_API_KEY=your_groq_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Ollama Settings
ENABLE_OLLAMA=true
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2
# Security Settings
MAX_REQUESTS_PER_MINUTE=60
SAFE_MODE=true
AUDIT_LOGGING=true
Configuration Wizard¶
Use the interactive configuration wizard:
This will help you: - Select AI providers - Configure API keys - Set up Ollama models - Configure security settings
Provider Selection¶
Automatic Selection¶
SQLMap AI automatically selects the best available provider:
Selection Priority: 1. Groq (if API key available) 2. OpenAI (if API key available) 3. Anthropic (if API key available) 4. Ollama (if enabled and running)
Manual Selection¶
Specify your preferred provider:
# Use specific provider
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider groq
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider openai
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider anthropic
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider ollama
Testing Your Setup¶
Check Available Providers¶
Expected output:
List Ollama Models¶
Validate Configuration¶
Best Practices¶
For Production Use¶
- Use Groq for speed and reliability
- Set up multiple providers for redundancy
- Monitor API usage and costs
- Use environment variables for security
For Privacy-Conscious Users¶
- Use Ollama for complete privacy
- Run models locally on your machine
- Disable cloud providers if needed
- Use VPN for additional privacy
For Development¶
- Start with Groq (free tier)
- Test with Ollama for offline work
- Use configuration wizard for easy setup
- Save API keys securely
Troubleshooting¶
Common Issues¶
"No AI providers available"¶
Solution: Check your .env
file and API keys
"Ollama not detected"¶
Solution: Ensure Ollama is running
# Start Ollama
ollama serve
# Check models
ollama list
# Test connection
curl http://localhost:11434/api/tags
"API key invalid"¶
Solution: Verify your API keys
Getting Help¶
- Check logs:
~/.sqlmap-ai/logs/
- Run diagnostics:
sqlmap-ai --install-check
- Validate config:
sqlmap-ai --validate-config
- Report issues: GitHub Issues
Next Steps¶
After configuring your AI providers:
- Quick Start: Run your first test
- Basic Usage: Learn how to use SQLMap AI
- Testing Modes: Explore different testing approaches
- Examples: See real-world examples