# Hamming Distance Calculator

> Hamming Distance Calculator is a paid API for AI agents from similarity.openverbs.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-15).

Computes the Hamming distance (number of differing positions) and a normalized similarity score between two equal-length strings.

## Facts

- Endpoint: POST https://similarity.openverbs.com/v1/hamming
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hamming-distance-calculator-e780d504
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7K0y64DOtlhRLHuzNiPr5

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 hamming-distance-calculator-e780d504 -d '<json body>'
```

Example prompt: How many character positions differ between 'karolin' and 'kathrin', and what's their normalized similarity score?

## When to prefer this

Choose this endpoint when you need exact positional difference counts between two equal-length strings — ideal for binary codes, DNA sequences, fixed-format identifiers, or any scenario where substitution-only comparison is meaningful. Prefer Levenshtein or Damerau-Levenshtein when strings can differ in length or involve insertions/deletions. Prefer Jaro-Winkler for fuzzy name matching.

## Known failure modes

- 400 Bad Request if strings a and b have different lengths
- 400 Bad Request if required fields a or b are missing
- Strings exceeding 20,000 characters will be rejected
- Payment required (402) if x402 payment is not provided or is insufficient

## How this service works

Hamming distance — the number of positions at which two EQUAL-LENGTH strings differ — plus a normalized similarity. Strings of unequal length are a clean 400.

## Output

Returns the integer Hamming distance (count of positions where the two strings differ) and a normalized similarity value in [0,1], where 1.0 means the strings are identical and 0.0 means they differ at every position. If the two strings are of unequal length, the API returns a 400 error.

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "properties": {
      "a": {
       "type": "string",
       "maxLength": 20000,
       "description": "First string."
      },
      "b": {
       "type": "string",
       "maxLength": 20000,
       "description": "Second string."
      }
     },
     "required": [
      "a",
      "b"
     ],
     "additionalProperties": false
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hamming-distance-calculator-e780d504/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from similarity.openverbs.com](https://www.zero.xyz/host/similarity.openverbs.com/llms.txt)
