# Levenshtein Edit Distance & Similarity Calculator

> Levenshtein Edit Distance & Similarity Calculator is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Computes the Levenshtein edit distance between two strings and returns a normalized 0–1 similarity ratio.

## Facts

- Endpoint: POST https://agent402.tools/api/levenshtein
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/levenshtein-edit-distance-similarity-calculator-7f8532df
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZAMHsgC7uJsT80uBl4dWU

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 levenshtein-edit-distance-similarity-calculator-7f8532df -d '<json body>'
```

Example prompt: What's the Levenshtein edit distance and similarity ratio between 'kitten' and 'sitting'?

## When to prefer this

Use this endpoint when you need a precise, classic edit-distance metric for fuzzy string matching, spell checking, deduplication, or similarity scoring between two specific strings. Prefer this over semantic similarity endpoints when character-level differences matter, not meaning.

## Known failure modes

- Missing one or both string inputs results in a validation error
- Extremely long strings may exceed payload limits or timeout
- Non-string types for a or b may cause schema validation failure

## How this service works

Levenshtein edit distance between two strings, plus a 0-1 similarity ratio.

## Output

Returns the integer Levenshtein edit distance (minimum single-character edits to transform string a into string b) and a normalized similarity ratio between 0 and 1 (where 1 means identical strings).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string"
  },
  "b": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "distance": 3,
  "similarity": 0.571
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/levenshtein-edit-distance-similarity-calculator-7f8532df/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
