NULL, TRUE/FALSE and function calls are left as-is. Review the query before running it against a real database.
Open API — no account, username or password. JSON in and out, CORS enabled
(Access-Control-Allow-Origin: *), so it is callable from anywhere.
| GET /api/health | service info and the list of endpoints |
| GET /api/dialects | supported SQL dialects |
| POST /api/sql | generate SQL from plain text (uses the Anthropic API) |
{
"request": "top 10 customers by revenue in 2024, with email", // required
"dialect": "PostgreSQL", // optional, default "MySQL"
"schema": "customers(id, name, email), orders(id, customer_id, total)", // optional
"readOnly": false, // optional — SELECT only
"explain": false // optional — explanation in "notes"
}
200{
"sql": "SELECT ...",
"notes": "assumptions or warnings, may be empty",
"dialect": "PostgreSQL",
"model": "claude-opus-5",
"stop_reason": "end_turn",
"usage": { "input_tokens": 99, "output_tokens": 296 }
}
Errors return { "error": "..." } with status
400 / 401 / 405 / 422 /
429 / 5xx.
curl -X POST /api/sql \
-H "Content-Type: application/json" \
-d '{"request":"count customers by country","dialect":"MySQL"}'
The API is open by default. In the server's .env you can enable
RATE_LIMIT_PER_MIN (requests/minute per IP, default 20) and
API_TOKEN (requires Authorization: Bearer <token> or
X-Api-Key for POST /api/sql).
Full documentation: README on GitHub.