{
  "schema_version": "1.0",
  "name": "text-statistics",
  "display_name": "Text Statistics & Readability Analyzer",
  "description": "Analyzes text and returns word count, character count, sentence and paragraph counts, syllable count, unique words, vocabulary richness (type-token ratio), estimated reading time and speaking time, Flesch Reading Ease, Flesch-Kincaid Grade Level, Gunning Fog Index, Coleman-Liau Index, SMOG (30+ sentences), and top keyword frequency. POST body or GET ?text= param. Fully self-contained — pure computation.",
  "endpoint": "https://bacapi-text-stats-api.workers.dev/text-stats",
  "method": "POST",
  "payment": {
    "protocol": "x402",
    "network":  "base",
    "currency": "USDC",
    "amount":   "0.04"
  },
  "request_body": {
    "content_type": "application/json",
    "schema": {
      "text":    "string (required) — text to analyze, max 50,000 characters",
      "options": {
        "readability": "boolean (optional, default true) — include readability scores",
        "keywords":    "boolean (optional, default true) — include keyword frequency"
      }
    }
  },
  "alt_method": "GET",
  "alt_parameters": {
    "text": "string — URL-encoded text (readability and keywords always included)"
  },
  "response_shape": {
    "counts": {
      "characters":           "integer",
      "characters_no_spaces": "integer",
      "words":                "integer",
      "unique_words":         "integer",
      "sentences":            "integer",
      "paragraphs":           "integer",
      "syllables":            "integer",
      "complex_words":        "integer — 3+ syllables"
    },
    "averages": {
      "words_per_sentence":       "number",
      "syllables_per_word":       "number",
      "avg_word_length_chars":    "number",
      "sentences_per_paragraph":  "number"
    },
    "vocabulary": {
      "type_token_ratio":  "number — 0-1, higher = more varied vocabulary",
      "richness_label":    "Rich | Average | Repetitive",
      "percent_complex":   "integer — % words with 3+ syllables"
    },
    "time_estimates": {
      "read_time_minutes":  "integer",
      "speak_time_minutes": "integer",
      "read_time_label":    "string — e.g. '~4 min read'"
    },
    "readability": {
      "flesch_reading_ease": "{ score: number, label: string }",
      "flesch_kincaid_grade":"{ grade: number, label: string }",
      "gunning_fog":         "{ grade: number, label: string }",
      "coleman_liau":        "{ grade: number, label: string }",
      "smog":                "{ grade: number, label: string } or { note: 'Requires 30+ sentences' }"
    },
    "top_keywords": "Array<{ word: string, count: integer, frequency: string }> — top 15 non-stop-word terms"
  },
  "example_request": "POST /text-stats\n{ \"text\": \"The quick brown fox jumps over the lazy dog. It was a clear autumn day.\" }",
  "example_response": {
    "data": {
      "counts":    { "words": 16, "sentences": 2, "syllables": 18 },
      "time_estimates": { "read_time_minutes": 1, "read_time_label": "~1 min read" },
      "readability": {
        "flesch_reading_ease": { "score": 76.2, "label": "Fairly Easy (7th grade)" }
      }
    },
    "meta": { "priced_at": "0.04 USDC" }
  },
  "tags": ["text","readability","nlp","word-count","flesch","grade-level","seo","content","analysis"],
  "category": "text"
}
