# Strale SQL Generator

> Strale SQL Generator is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054/call, status unknown (last checked 2026-09-15).

Converts a natural language query into a SQL statement for a specified database dialect and optional table schema

## Facts

- Endpoint: GET https://api.strale.io/x402/v2/sql-generate
- Price: $0.054/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/strale-sql-generator-33775599
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_wExnm81ZVZM5P8oOFQsiV

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 strale-sql-generator-33775599
```

Example prompt: Generate a SQL query in PostgreSQL dialect for this schema — users(id, name, email, created_at), orders(id, user_id, total, status) — that answers: 'show me all users who placed more than 3 orders in the last 30 days with a total spend above $500'

## When to prefer this

Choose this endpoint when you need to programmatically convert plain-English questions into executable SQL for a known database dialect, especially when the target schema is known and can be provided. It is ideal for building no-code data tools, report generators, or agent workflows where non-technical users need to query databases. Prefer it over generic LLM SQL generation when you need an auditable, per-call-priced, production-grade REST or x402-compatible capability.

## Known failure modes

- Missing natural_language_query parameter returns a 400 validation error
- Ambiguous or vague natural language input may produce an incorrect or overly generic SQL statement
- Unsupported dialect value may cause an error or fall back to generic SQL
- Complex multi-step queries or recursive CTEs may be incomplete or incorrect
- Table schema mismatch between the description provided and the actual schema can lead to invalid column/table references

## How this service works

The trust layer for AI agents — 250+ independently tested data capabilities across 27 countries. Execute capabilities via REST, MCP, A2A, or x402 micropayments. Every call returns an audit record with cryptographic chain hashing.

## Output

A generated SQL query string matching the natural language question, targeting the specified database dialect (postgres, mysql, sqlite, or mssql) and optionally respecting the provided table schema. The response comes with a cryptographic audit record for traceability.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "natural_language_query"
     ],
     "properties": {
      "dialect": {
       "type": "string",
       "description": "postgres/mysql/sqlite/mssql"
      },
      "table_schema": {
       "type": "string"
      },
      "natural_language_query": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

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