Catalog/gen-markov-text

Generators

Seeded Markov text API

Builds an order-N Markov chain from a corpus and generates reproducible text from a seed. The value-add: corpus-derived synthetic text that mimics the input's style, deterministic for snapshots, with the prefix-table construction done correctly. Answers 'Generate Markov-chain text from this corpus deterministically', 'How do I build a reproducible Markov text generator?'.

Price$0.02per request
MethodPOST
Route/v1/generate/markov-text
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
markovtextchaincorpusdeterministicseednlpgenerate
API URLhttps://x402.hexl.dev/v1/generate/markov-text
Integration docs
Example request
{
  "corpus": "the quick brown fox jumps over the lazy dog and the cat",
  "words": 10,
  "order": 2,
  "seed": "abc"
}
Example response
{
  "text": "over the lazy dog and the cat and the cat",
  "order": 2,
  "words": 10,
  "uniquePrefixes": 10,
  "seed": "abc",
  "deterministic": true,
  "interpretation": "Order-2 Markov chain over the corpus; same seed regenerates the same text."
}
Input schema
{
  "type": "object",
  "required": [
    "corpus",
    "seed"
  ],
  "properties": {
    "corpus": {
      "type": "string",
      "examples": [
        "the quick brown fox jumps over the lazy dog and the cat"
      ]
    },
    "words": {
      "type": "integer",
      "minimum": 1,
      "maximum": 500,
      "examples": [
        10
      ]
    },
    "order": {
      "type": "integer",
      "enum": [
        1,
        2,
        3
      ],
      "examples": [
        2
      ]
    },
    "seed": {
      "type": [
        "string",
        "number"
      ],
      "examples": [
        "abc"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}