{"uid":"cap_w5emykunOhUF31FqkkWuB","slug":"24k-labs-text-to-sql-200703d9","name":"24K Labs Text-to-SQL","description":"Convert a plain-English request into a SQL query; pass an optional schema for accurate joins.","url":"https://api.24klabs.ai/api/v1/text-to-sql","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"schema":{"type":"string"},"dialect":{"type":"string"},"request":{"type":"string"}}},"responseSchema":{"type":"json","example":{"sql":"SELECT ..."}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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_gv8LSbZ1T6j6x5s8q-p5X","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts a plain-English question or request into a SQL query, optionally using a provided schema for accurate table joins.","exampleAgentPrompt":"Turn this into a SQL query for me: 'show me all customers who placed more than 3 orders in the last 30 days' — here's my schema: customers(id, name, email), orders(id, customer_id, created_at, total).","exampleUseCases":[{"title":"Non-technical analyst querying a database","prompt":"I need a SQL query that finds the top 10 products by total revenue this quarter — my schema has a products table (id, name, price) and an orders table (id, product_id, quantity, created_at). Can you generate that SQL for me?"},{"title":"Developer prototyping a data pipeline","prompt":"Write me a SQL query that joins users and subscriptions to find all users whose subscription expired in the last 7 days but haven't logged in since. My tables: users(id, email, last_login), subscriptions(id, user_id, expires_at)."},{"title":"Business intelligence quick lookup","prompt":"Convert this to SQL: 'list all orders where the total is above $500 and the shipping country is not the US, sorted by order date descending.' No schema needed, just standard e-commerce table names."}],"resultDescription":"Returns a SQL query string corresponding to the plain-English input, structured to be syntactically correct and (when a schema is provided) accurately referencing real table and column names with proper JOINs, WHERE clauses, and aggregations.","failureModes":["Ambiguous natural language input results in a plausible but incorrect query","Without a schema, table/column names may be guessed incorrectly","Complex multi-step queries may produce simplified or incomplete SQL","Dialect-specific syntax (PostgreSQL vs MySQL vs SQLite) may not match target database if not specified","Malformed or incomplete schema input may cause join inference errors"],"whenToPreferThis":"Choose this endpoint when you need to translate natural language questions into executable SQL on demand, especially when you can supply a database schema for accurate join and column resolution. Ideal for building no-code data tools, agent-driven analytics, or rapid prototyping where writing SQL manually would slow down the workflow. Prefer over general LLM completions when you want a dedicated, cost-predictable SQL generation microservice.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:53:09.301Z","isFirstParty":false}