Your rows never reach the model
AskDB sends the question and your schema artifact — never your rows, your credentials, or your query results. The model writes SQL blind to your data.
$npx askdb init
# OR: npm install askdb
NL-to-SQL isn’t a new problem. Academic research goes back to LUNAR in 1972, and LLM-based generation has been good enough since Codex in 2021. The hard part in production isn’t the LLM call — it’s capturing the business context behind your schema, getting the right enrichment into the prompt, wiring up RAG when the schema is too big to fit, and repeating that work for every new project. AskDB is the toolkit for that part.
AskDB sends the question and your schema artifact — never your rows, your credentials, or your query results. The model writes SQL blind to your data.
Your team authors and reviews the schema context. AskDB returns SQL — your application chooses whether to log it, approve it, or run it.
Every generated query is checked before AskDB returns it — read-only shape, tenant filters, sensitive columns. The checks catch common model mistakes; your database role and row-level security are the boundary.
AskDB is a library you wire into your stack. Your model key, your database, your vector store. The schema artifact is a file you commit, not a black box.
Run askdb init to scaffold askdb.config.ts — your provider, database, and model settings, checked in like code.
AskDB reads your database (or a Prisma schema file) into a schema artifact: tables, columns, types, and relationships on disk.
In Studio, add the descriptions, aliases, business concepts, and sensitive markers that make generation reliable. Test questions as you go.
Call ask() from your app — or POST to the HTTP API. AskDB returns checked SQL; your application logs it, approves it, and runs it through your own pool.
There are two ways to call AskDB from TypeScript. createAskDb() from @askdb/client takes the model, the schema and the dialect from your askdb.config.ts, the same config the CLI and Studio use. ask() from @askdb/core takes a schema you loaded and any Vercel AI SDK model. Both return checked SQL, and your code runs it through your own connection. Embed in a Node app walks through both.
@askdb/postgresReference dialect — new features land here first.
@askdb/mysqlFirst-class dialects and introspection for both engines.
@askdb/sqliteFirst-class dialect — embedded and file-backed, great for dev and tests.
@askdb/sqlserverFirst-class T-SQL dialect and introspection.
© 2026 Yahya Gilany