{"uid":"cap_0j5HGjMcktdN8y7rC90Kg","slug":"x402-deployer-x402-deployer-workers-dev-a19a7ed4","name":"SQL from Natural Language (Text-to-SQL Generator)","description":"Text to SQL / NL to SQL / AI SQL generator. Postgres, MySQL, SQLite, BigQuery, Snowflake, MSSQL, DuckDB, ANSI. Optional schema. Returns SQL + explanation + tables_referenced + is_destructive + warnings.","url":"https://x402-deployer.x402-deployer.workers.dev/sql-from-prompt","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"required":["prompt"],"properties":{"prompt":{"type":"string","description":"Natural-language description of the query to generate. Max 5,000 chars."},"schema":{"type":"string","description":"Optional. Schema description (tables/columns) to ground the generated SQL. Max 30,000 chars."},"dialect":{"enum":["postgres","mysql","sqlite","bigquery","snowflake","mssql","duckdb","ansi"],"type":"string","description":"Optional. Target SQL dialect: postgres (default), mysql, sqlite, bigquery, snowflake, mssql, duckdb, or ansi."}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"sql":{"type":"string"},"dialect":{"type":"string"},"is_destructive":{"type":"boolean"}}}}}}},"responseSchema":null,"example":{"request":{"input":{"body":{"prompt":"Get all users where status equals active and created_at is in the last 30 days","schema":"CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(255), email VARCHAR(255), status VARCHAR(50), created_at TIMESTAMP);","dialect":"postgres"},"type":"http","method":"POST","bodyType":"json"}},"response":{"sql":"SELECT id, name, email, status, created_at FROM users WHERE status = 'active' AND created_at >= CURRENT_DATE - INTERVAL '30 days';","model":"mistral-small-3-2-24b-instruct","source":"venice","dialect":"postgres","warnings":["Assumes the users table exists with the specified columns."],"explanation":"This query selects all columns from the users table where the status is 'active' and the created_at date is within the last 30 days from the current date.","is_destructive":false,"tables_referenced":["users"]}},"exampleRequest":{"prompt":"Get all users where status equals active and created_at is in the last 30 days","schema":"CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(255), email VARCHAR(255), status VARCHAR(50), created_at TIMESTAMP);","dialect":"postgres"},"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_S6htb9SsAj6mhvIyUeRnf","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts a natural language prompt into a SQL query for a specified database dialect, returning the SQL, an explanation, referenced tables, destructiveness flag, and warnings.","exampleAgentPrompt":"Generate a SQL query for Postgres that finds all customers who placed more than 3 orders in the last 30 days — my tables are 'customers' (id, name, email) and 'orders' (id, customer_id, created_at, total). Tell me if the query is destructive and flag any warnings.","exampleUseCases":null,"resultDescription":"Returns the generated SQL query string, a plain-English explanation of what the query does, a list of tables referenced, a boolean is_destructive flag indicating whether the query could modify or delete data, and any warnings (e.g. missing indexes, full-table scans, potential data loss).","failureModes":["Ambiguous prompt with no schema provided may produce incorrect or hallucinated table/column names","Unsupported or mis-specified dialect may fall back to ANSI SQL","Very complex multi-step queries may produce incomplete or split SQL","Schema provided does not match the prompt, leading to incorrect column references","Payment not included or insufficient USDC causes 402 rejection"],"whenToPreferThis":"Use this endpoint when an agent or user needs to generate SQL from plain English without writing queries manually, especially when the target dialect (Postgres, MySQL, BigQuery, Snowflake, SQLite, MSSQL, DuckDB) matters and safety metadata like is_destructive and warnings are needed to prevent accidental data modification.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:54:16.943Z","isFirstParty":false}