# 402utils Text Similarity

> 402utils Text Similarity is a paid API for AI agents from 402utils.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Computes a similarity score between two texts using Jaccard (word-set overlap), Levenshtein (edit distance), or cosine embedding (semantic) methods, returning a value in [0,1].

## Facts

- Endpoint: POST https://402utils.com/v1/text-similarity
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/402utils-text-similarity-a7ba39f4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VjSoWvD7AoUWnS2U1NmYK

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 402utils-text-similarity-a7ba39f4 -d '<json body>'
```

Example prompt: How similar are these two sentences? Use the cosine-embed method: 'The quick brown fox jumps over the lazy dog' and 'A fast auburn fox leaps above a sleepy hound'.

## When to prefer this

Choose this endpoint when you need a fast, deterministic similarity score between exactly two texts without managing embedding infrastructure yourself. Jaccard is best for deduplication of long documents; Levenshtein for short strings with typos or OCR errors; cosine-embed for semantic paraphrase detection. Prefer over building your own embedding pipeline when you want a single-call, pay-per-use solution.

## Known failure modes

- 503 returned for cosine-embed method if the Cloudflare AI binding is temporarily unavailable (unbilled)
- Input text exceeds character cap: 200k chars for jaccard, 5k for levenshtein, 4k for cosine-embed
- Missing required fields 'a' or 'b' returns a 4xx validation error
- Invalid method enum value returns a 4xx error

## How this service works

Similarity of two texts in [0,1]. Methods: `jaccard` (word-set overlap, default), `levenshtein` (normalized edit distance) — both pure & deterministic — and `cosine-embed` (cosine of Cloudflare Workers AI embeddings @cf/baai/bge-m3, semantic; model named). Compare two texts (dedup, matching) without handling embeddings yourself. cosine-embed 503s unbilled if the AI binding is unavailable. Caps: jaccard 200k, levenshtein 5k, cosine 4k chars.

## Output

A JSON object containing a similarity score as a float in [0,1] (where 1 is identical/perfectly similar) and the method that was used. Higher scores indicate greater similarity.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string",
   "description": "First text."
  },
  "b": {
   "type": "string",
   "description": "Second text."
  },
  "method": {
   "enum": [
    "jaccard",
    "levenshtein",
    "cosine-embed"
   ],
   "type": "string",
   "default": "jaccard",
   "description": "jaccard (word-set), levenshtein (edit distance), or cosine-embed (semantic embeddings)."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/402utils-text-similarity-a7ba39f4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 402utils.com](https://www.zero.xyz/host/402utils.com/llms.txt)
