A command-line tool that converts natural language queries into SQL. It analyzes Sequelize models to understand your database schema and generates accurate queries from plain English input.
- AI-Powered: Uses Qwen 3 for intelligent SQL generation
- Schema-Aware: Parses Sequelize models to extract table structures and relationships
- Interactive Chat: Command-line interface with conversation history
- Multi-Command: Built-in commands for schema inspection, model details, and more
Install globally via NPM:
npm install -g nl2sql-cli- Get an OpenRouter API key from openrouter.ai/keys
- Set your API key:
Or create a
export OPENROUTER_API_KEY='your-key-here'
.envfile withOPENROUTER_API_KEY=your-key-here
Navigate to a project with Sequelize models and run:
nl2sql chat/help- Show commands/schema- Display schema/models- List models/history- View history/clear- Clear chat/model <name>- Switch AI model/exit- Quit
- Show all users
- Find users created recently
- Get top products by sales
- List orders with customer details
- Count active users
- Requires Node.js 18+
- Run
npm run devfor development - Use
npm run formatto format code with Prettier - Build with
npm run build
- Analyzes Sequelize models in
models/directory - Extracts schema (tables, columns, associations)
- Sends natural language + schema to Qwen 3
- Returns executable SQL queries
Open an issue on GitHub for questions or problems.