# fastapi.online SQL Generator

> fastapi.online SQL Generator is a paid API for AI agents from api.fastapi.online, paid per call via x402, $0.002/call, status down (last checked 2026-09-15).

Generates SQL queries from a natural language description, optional schema, and target SQL dialect

## Facts

- Endpoint: POST https://api.fastapi.online/sql-generate
- Price: $0.002/call
- Payment: x402
- Status: down
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fastapi-online-sql-generator-c29855b6
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YbSHHgG0gWf0mIMmqRqn1

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability fastapi-online-sql-generator-c29855b6 -d '<json body>'
```

Example prompt: Generate a SQL query for a PostgreSQL database with this schema: 'users(id, name, email), orders(id, user_id, amount, created_at)' — I want to find all users who placed more than 3 orders in the last 30 days.

## When to prefer this

Choose this endpoint when you need a quick, pay-per-call SQL generation without signing up for a managed NL-to-SQL service. It supports dialect-specific generation (e.g. PostgreSQL, MySQL, SQLite) and schema-aware query construction. Ideal for agents or pipelines that need on-demand SQL code generation without managing API keys or subscriptions.

## Known failure modes

- Missing or empty description field returns validation error
- Schema string exceeds 4000 character limit causes rejection
- Unsupported or misspelled dialect may produce generic or incorrect SQL
- Ambiguous description may yield a plausible but incorrect query
- Very complex multi-step queries may be incomplete or simplified

## How this service works

Chat, embeddings, OCR, speech-to-text, image editing, image understanding (captioning/Q&amp;A), text-to-speech, translation, writing tools, classification tools, developer tools, local utilities, format/checksum validators, encoding &amp; crypto utilities, date/time calculators, geo/coordinate math, math &amp; finance calculators, novelty tools, and business/social writing generators — 179 endpoints in all, across multiple specialized self-hosted models. Pay per call with crypto — no signup — or get an API key.

## Output

Returns a generated SQL query string tailored to the provided database schema and dialect, based on the natural language description. The output is ready-to-use SQL code matching the specified SQL dialect.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "schema": {
   "type": "string",
   "maxLength": 4000
  },
  "dialect": {
   "type": "string",
   "maxLength": 40
  },
  "description": {
   "type": "string",
   "maxLength": 2000,
   "minLength": 1
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/fastapi-online-sql-generator-c29855b6/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.fastapi.online](https://www.zero.xyz/host/api.fastapi.online/llms.txt)
