# Text Similarity Comparison (Cosine & Jaccard)

> Text Similarity Comparison (Cosine & Jaccard) is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-09-14).

Compares two text inputs and returns cosine similarity score, Jaccard similarity score, and top shared keywords for duplicate and near-duplicate detection.

## Facts

- Endpoint: GET https://api.x402node.dev/text/similarity
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/text-similarity-comparison-cosine-jaccard-41d4608b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_sG_bziEcp12NB4CpVVd2B

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-comparison-cosine-jaccard-41d4608b
```

Example prompt: Can you tell me how similar these two paragraphs are — both the cosine and Jaccard scores — and show me the top keywords they share? First: 'The quick brown fox jumps over the lazy dog.' Second: 'A fast brown fox leaped above a sleepy dog.'

## When to prefer this

Use this endpoint when you need a lightweight, dual-metric similarity comparison (cosine + Jaccard) with keyword evidence, especially for duplicate detection workflows, content moderation pipelines, or any scenario where you need both vector-space and set-overlap perspectives on text similarity without spinning up a full NLP stack.

## Known failure modes

- Missing one or both text parameters returns a 400 error
- Empty string inputs may return zero scores with no shared keywords
- Extremely long texts may be truncated or time out
- Non-UTF-8 encoded text may cause parsing errors
- Identical texts return scores of 1.0 which may be misinterpreted as an error

## How this service works

Compare two texts and return cosine and Jaccard similarity scores with the top shared keywords, useful for duplicate and near-duplicate detection. text similarity, string similarity, compare documents, duplicate detection, content overlap Accepts payment on Base or Solana — either network works.

## Output

Returns a JSON object with a cosine similarity score (float 0–1), a Jaccard similarity score (float 0–1), and a list of the top shared keywords found in both input texts.

## 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 (required)"
      },
      "b": {
       "type": "string",
       "description": "Second text (required)"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/text-similarity-comparison-cosine-jaccard-41d4608b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402node.dev](https://www.zero.xyz/host/api.x402node.dev/llms.txt)
