Skip to content

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

Overview

Groq is the fastest AI provider, offering near-instant responses with excellent performance for SQL injection analysis.

Setup

  1. Get API Key:
  2. Visit https://console.groq.com
  3. Sign up for a free account
  4. Generate an API key

  5. Configure Environment:

    # Add to your .env file
    GROQ_API_KEY=your_groq_api_key_here
    

  6. Test Configuration:

    sqlmap-ai --check-providers
    

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

  1. Get API Key:
  2. Visit https://platform.openai.com
  3. Create an account
  4. Generate an API key

  5. Configure Environment:

    # Add to your .env file
    OPENAI_API_KEY=your_openai_api_key_here
    

  6. Test Configuration:

    sqlmap-ai --check-providers
    

Usage

# Use OpenAI explicitly
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider openai

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

  1. Get API Key:
  2. Visit https://console.anthropic.com
  3. Create an account
  4. Generate an API key

  5. Configure Environment:

    # Add to your .env file
    ANTHROPIC_API_KEY=your_anthropic_api_key_here
    

  6. Test Configuration:

    sqlmap-ai --check-providers
    

Usage

# Use Anthropic explicitly
sqlmap-ai -u "http://example.com/page.php?id=1" --ai-provider anthropic

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

  1. Install Ollama:

    # Download from https://ollama.ai/download
    # Or use package manager
    
    # macOS
    brew install ollama
    
    # Linux
    curl -fsSL https://ollama.ai/install.sh | sh
    

  2. Start Ollama Service:

    ollama serve
    

  3. Download a Model:

    # Recommended models
    ollama pull llama3.2
    ollama pull codellama
    ollama pull mistral
    

  4. Configure Environment:

    # Add to your .env file
    ENABLE_OLLAMA=true
    OLLAMA_MODEL=llama3.2
    OLLAMA_BASE_URL=http://localhost:11434
    

  5. Test Configuration:

    sqlmap-ai --check-providers
    sqlmap-ai --list-ollama-models
    

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:

sqlmap-ai --config-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:

# Auto-select best provider
sqlmap-ai -u "http://example.com/page.php?id=1"

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

sqlmap-ai --check-providers

Expected output:

✅ Groq: Available
✅ OpenAI: Available
✅ Anthropic: Available
✅ Ollama: Available (llama3.2)

List Ollama Models

sqlmap-ai --list-ollama-models

Validate Configuration

sqlmap-ai --validate-config

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

# Check providers
sqlmap-ai --check-providers

# Validate configuration
sqlmap-ai --validate-config

"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

# Check environment variables
echo $GROQ_API_KEY
echo $OPENAI_API_KEY
echo $ANTHROPIC_API_KEY

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:

  1. Quick Start: Run your first test
  2. Basic Usage: Learn how to use SQLMap AI
  3. Testing Modes: Explore different testing approaches
  4. Examples: See real-world examples