A thin wrapper over the SQLite3 CLI with AI integration and tab completion.
- Full SQLite3 compatibility: All standard SQLite3 commands work as usual (
.table,.headers on, SQL queries, etc.) - Tab completion: Intelligent completion for SQL keywords and table names
- AI integration: Generate SQL queries using natural language with the
.aicommand - Model configuration: Configure which AI model to use with
.model - API key management: Securely store your Anthropic API key with
.anthropic-key
npm install -g sqlite3-ai-cligit clone <repository-url>
cd sqlite3-ai-cli
npm install
npm run build
npm install -g .After installation, you can use the sqlite3-ai command:
# Connect to a database file
sqlite3-ai [database.db]
# Create/connect to a new database
sqlite3-ai mydatabase.db# Run in development mode
npm run dev [database.db]
# Build and run locally
npm run build
npm start [database.db]All standard SQLite3 commands work as usual:
.tables- List all tables.schema- Show table schemas.headers on/off- Toggle column headers- Any SQL query (SELECT, INSERT, UPDATE, DELETE, etc.)
Set or view the current AI model.
.model -- View current model
.model claude-sonnet-4-20250514 -- Set modelSet or view the current Anthropic API key.
.anthropic-key -- View current key (masked)
.anthropic-key sk-ant-... -- Set API keyGenerate SQL using natural language. The AI has access to your database schema.
.ai show all users
.ai find the top 10 customers by total orders
.ai create a table for storing product reviewsPress Tab to see completions:
- After typing
sel+ Tab →SELECT - After typing
SELECT * FROM+ Tab → shows available tables - After typing
.+ Tab → shows dot commands
-- Set up AI
.model claude-sonnet-4-20250514
.anthropic-key sk-ant-your-key-here
-- Use AI to generate queries
.ai show me all customers from California
-- This might generate: SELECT * FROM customers WHERE state = 'California';
-- Standard SQLite3 usage still works
.tables
.schema customers
SELECT COUNT(*) FROM customers;Configuration is stored in ~/.sqlite3-ai-cli/config.json and includes:
- AI model selection
- Anthropic API key (encrypted storage recommended for production use)