OriginChain
05 · /ask

Ask in plain English. Get JSON back.

One endpoint that translates natural language into a plan across every shape, runs it, and returns rows. The LLM call uses your key - see BYOK LLM.

why this is hard

LLMs are creative. Planners are deterministic.

Most "NL to SQL" tools pipe a prompt into a model and hope. The model picks shapes based on training-data bias, not on what your data actually contains.

We pass real cardinality from oc-stats to the cost walker. Cheap plans rank above expensive ones before the LLM picks. The model still chooses, but it's choosing from a shortlist that already passes a cost test.

Every response carries the chosen plan + per-node cost. You can override.

request
POST /v1/tenants/:t/ask
{
  "q": "Top 5 customers by spend in March
        who haven't logged in this week"
}
response
{
  "plan": "sql.aggregate + sql.semi_join",
  "cost": { "rows_estimate": 5, "io_cost": 8.2 },
  "rows": [ { "id": "c_84", "spend": 4204.10 }, ... ],
  "explain": { "nodes": [ ... ] }
}
three differentiators
01
Cost-walker informed planning

The LLM sees real cardinality from oc-stats, not synthetic estimates. Cheap plans rank above expensive ones before generation.

02
Deterministic dispatch

Same NL question → same plan → same rows (modulo data). Replays are stable; A/B tests are honest.

03
EXPLAIN + override

Every /ask response carries the plan it ran. If the LLM picked wrong, pin a shape and re-run.

byok llm

Your key. Your audit. Your bill.

Most managed DBs that do NL queries mark up LLM tokens 2–5×. We don't bill them at all. You bring your own OpenAI, Anthropic, Gemini, or Groq key; every prompt and completion is visible in your provider's dashboard.

Read BYOK LLM →
deferred
  • under designConversational follow-up. /ask is single-turn today.
  • under designSelf-correcting retries on parse errors.

Read the /ask docs, then try it.