An intelligent SQL client that translates natural language into SQL queries
Ask questions in plain English, get precise SQL queries, visualize results as beautiful charts
AIQ (AI Query) is an intelligent SQL client that enables you to interact with databases using natural language. No need to write SQL manuallyβjust ask questions in natural language, and AIQ will automatically generate SQL queries, execute them, and visualize the results as beautiful charts.
basic-720p.mp4
- π£οΈ Natural Language to SQL - Ask questions in plain English or Chinese, get precise SQL queries
- π¬ Multi-Turn Conversation - Maintain conversation context for refined queries and follow-up questions
- π Free Chat Mode - General conversation and Skills operations without database connection
- π Chart Visualization - Automatic chart detection and rendering (bar, line, pie, scatter plots)
- π Multiple Database Support - seekdb, MySQL, and PostgreSQL
- π― Skills System - Extend AI capabilities with custom domain knowledge (LLM-based semantic matching)
- π§ Intelligent Context Management - Dynamic Skills loading/eviction and LLM-based compression
- β‘ Smart Output Modes - Intelligent streaming for long-running processes, full output for quick results
- π‘οΈ Risk-Based Confirmation - Automatic execution for safe operations, confirmation for risky ones
- π¨ Beautiful CLI Interface - Smooth interactions and color-coded output
- πΎ Session Persistence - Save and restore conversation sessions
Unix/Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/sunetic/aiq/main/scripts/install.sh | bashWindows:
# Download and run install.bat
# Or run in PowerShell:
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/sunetic/aiq/main/scripts/install.bat" -OutFile "install.bat"
.\install.batThe installation script will:
- Automatically detect the latest version from GitHub Releases
- Detect your system architecture (darwin-amd64, darwin-arm64, linux-amd64, linux-arm64, windows-amd64)
- Download the binary to
~/.aiq/bin(Unix/Linux/macOS) or%USERPROFILE%\.aiq\bin(Windows) - Print PATH command for you to add manually
- Verify the installation
After installation, add to PATH:
Unix/Linux/macOS (zsh):
echo 'export PATH="$HOME/.aiq/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcUnix/Linux/macOS (bash):
echo 'export PATH="$HOME/.aiq/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcWindows:
setx PATH "%PATH%;%USERPROFILE%\.aiq\bin"(Then open a new terminal window)
# Clone and build
git clone https://github.com/sunetic/aiq.git
cd aiq
go build -o aiq cmd/aiq/main.go
# Install (optional)
sudo mv aiq /usr/local/bin/- Start AIQ:
aiq - Configure LLM: Enter API URL, API Key, and model name (wizard runs on first launch)
- Add Data Source: Select
sourceβaddβ Enter database connection details - Start Querying: Select
chatβ Choose data source β Ask questions in natural language
Example queries:
aiq> Show total sales for the last week
aiq> Count products by category
aiq> Show user registration trends
AIQ - Main Menu
? config - Manage LLM configuration
source - Manage database connections
chat - Query database with natural language
exit - Exit application
Database Mode (with source selected): Full SQL query capabilities with chart visualization
Free Mode (no source selected): General conversation and Skills operations
Commands: /history - View history | /clear - Clear history | exit/back - Exit (auto-saved)
Session restore: aiq -s ~/.aiq/sessions/session_20260126100000.json
Version: aiq -v or aiq --version - Display version and commit ID
Auto-detects chart types: Categorical+Numerical β Bar/Pie | Temporal+Numerical β Line | Numerical+Numerical β Scatter
Skills extend AIQ's capabilities by providing custom instructions and context. Automatically matched and loaded using LLM-based semantic matching.
skill-720p.mp4
- Create Skill:
mkdir -p ~/.aiq/skills/my-skill - Create SKILL.md with YAML frontmatter:
---
name: my-skill
description: Domain-specific guidance for metrics and SQL patterns
---
# My Custom Skill
[Your instructions and examples here]- Restart AIQ - Skills auto-load on startup
- Matching: LLM-based semantic matching (falls back to keyword matching)
- Loading: Top 3 most relevant Skills loaded per query
- Management: Auto-evicts unused Skills, tracks usage, manages priority
- Compression: LLM-based semantic compression at 80%/90%/95% thresholds
Skills guide AI on using:
execute_sql- Execute SQL queries against databaseshttp_request- Make HTTP requests (GET, POST, etc.)execute_command- Run shell commands with smart output modesfile_operations- Read, write, list files and directories
- seekdb Skill - SeekDB documentation and usage guidance
Config files in ~/.aiq/:
config/config.yaml- LLM configuration (API URL, API Key, model)config/sources.yaml- Database connection configurationssessions/- Saved conversation sessionsskills/- Custom Skills directoryprompts/- Custom prompt templates (optional)bin/- Binary installation directory
Build: go build -o aiq cmd/aiq/main.go
Test: go test ./...
This project is licensed under the Apache License 2.0.
Contributions are welcome! Please feel free to submit a Pull Request.
Made with β€οΈ using Go