# Text Similarity: Levenshtein & Damerau-Levenshtein Edit Distance

> Text Similarity: Levenshtein & Damerau-Levenshtein Edit Distance is a paid API for AI agents from text-similarity.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-21).

Computes Levenshtein and Damerau-Levenshtein (restricted OSA and unrestricted) edit distances between two texts, returning a normalized 0–1 similarity score.

## Facts

- Endpoint: GET https://text-similarity.x402tookit.com/edit-distance?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/text-similarity-levenshtein-damerau-levenshtein-edit-distance-b1fd920c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Pk_j5xWp-3xjalrzq0p-f

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 text-similarity-levenshtein-damerau-levenshtein-edit-distance-b1fd920c
```

Example prompt: Can you compute the Levenshtein and Damerau-Levenshtein edit distances between 'sitting' and 'kitten', and give me a 0-to-1 similarity score? Please compare them case-insensitively.

## When to prefer this

Choose this endpoint when you need character-level edit distance metrics (Levenshtein or Damerau-Levenshtein) between two texts of up to 2000 characters each, especially for typo detection, fuzzy deduplication, or spell-checking workflows. Prefer it over Jaro/Jaro-Winkler endpoints when you need full edit-distance counts rather than just a similarity ratio, or when transposition handling (Damerau) matters. Use the sibling cosine or Dice endpoints instead for longer texts or word-overlap comparisons.

## Known failure modes

- Missing required query parameters 'a' or 'b' returns a validation error
- Input strings exceeding 2000 characters may be rejected or truncated
- Payment not provided or invalid x402 payment header causes 402 Payment Required
- Network timeout if the service is temporarily unavailable
- Unexpected characters or encoding issues may cause malformed responses

## How this service works

Levenshtein and Damerau-Levenshtein edit distance (restricted and unrestricted) between two texts, with a 0 to 1 similarity.

## Output

Returns Levenshtein distance, Damerau-Levenshtein OSA (restricted) distance, unrestricted Damerau-Levenshtein distance, a normalized 0-to-1 similarity score, lengths of both input strings, and metadata fields including ignoreCase flag, summary, and any degraded/disclaimer notices.

## 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"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "a",
      "b"
     ],
     "properties": {
      "a": {
       "type": "string",
       "description": "First text, up to 2000 characters"
      },
      "b": {
       "type": "string",
       "description": "Second text, up to 2000 characters"
      },
      "ignoreCase": {
       "type": "boolean",
       "description": "true to compare case-insensitively (default false: Kitten and kitten differ by 1)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "lengthA": {
       "type": [
        "null",
        "number"
       ]
      },
      "lengthB": {
       "type": [
        "null",
        "number"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "damerauOsa": {
       "type": [
        "null",
        "number"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "ignoreCase": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "similarity": {
       "type": [
        "null",
        "number"
       ]
      },
      "levenshtein": {
       "type": [
        "null",
        "number"
       ]
      },
      "damerauUnrestricted": {
       "type": [
    
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/text-similarity-levenshtein-damerau-levenshtein-edit-distance-b1fd920c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from text-similarity.x402tookit.com](https://www.zero.xyz/host/text-similarity.x402tookit.com/llms.txt)
