Your data never touches 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
Next: Quickstart Install options GitHub
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 parsed, scoped, and rejected if it violates the rules your schema declares — read-only, tenant filters, sensitive columns.
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 validated SQL; your application logs it, approves it, and runs it through your own pool.
A few lines of TypeScript: load a schema, ask a question, run the SQL through your own connection pool.
import { createAskDb } from "@askdb/client";import { bootstrapAskDbEnv, getAskDbRuntimeConfig } from "@askdb/config";import { openaiProvider } from "@askdb/ai-openai";import { Pool } from "pg";
// Resolve schema, model, and dialect from askdb.config.ts — same config the CLI and Studio use.bootstrapAskDbEnv({ cwd: process.cwd() });const askdb = createAskDb({ config: getAskDbRuntimeConfig(), providers: [openaiProvider], schema: { path: "./my-app.schema" }, // or set host.schemaPath in config and omit});const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const { sql } = await askdb.ask("Which customers signed up last week?");
// Log or approve `sql` here, then run it through your own pool.const result = await pool.query(sql);import { ask, loadSchema } from "@askdb/core";import { openai } from "@ai-sdk/openai";import { Pool } from "pg";
// Load schema once at startup — no config file needed.const schema = loadSchema("./my-app.schema");const model = openai("gpt-4o-mini"); // any Vercel AI SDK LanguageModelconst pool = new Pool({ connectionString: process.env.DATABASE_URL });
const { sql } = await ask({ question: "Which customers signed up last week?", schema, model, dialect: "postgres",});
// Log or approve `sql` here, then run it through your own pool.const result = await pool.query(sql);@askdb/postgres Reference dialect — new features land here first.
@askdb/mysql First-class dialect and introspection.
@askdb/sqlite First-class dialect — embedded and file-backed, great for dev and tests.
@askdb/sqlserver First-class T-SQL dialect and introspection.
© 2026 Yahya Gilany