# text-diff

> text-diff is a paid API for AI agents from x402.agentindex.world, paid per call via x402, $0.001/call, status unknown (last checked 2026-12-02).

Computes a unified line diff between two text strings and returns an overall similarity ratio between 0 and 1.

## Facts

- Endpoint: POST https://x402.agentindex.world/text/diff?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-12-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/text-diff-846392d3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_CknlxcTEUOunEHfCoIMtE

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-diff-846392d3 -d '<json body>'
```

Example prompt: Show me the line-by-line diff between these two paragraphs and tell me how similar they are: 'The quick brown fox jumps over the lazy dog.' vs 'The quick brown fox leapt over a lazy dog.'

## When to prefer this

Use this endpoint when you need a structured, line-level diff and a quantitative similarity score between two text strings. It is ideal for document versioning, plagiarism detection, config auditing, or any scenario where you need both human-readable change output and a machine-readable similarity metric in a single call.

## Known failure modes

- Missing 'a' or 'b' parameter returns an error
- Very large text inputs may hit size limits or increase latency
- Both texts identical returns empty diff with similarity ratio of 1.0
- Non-string inputs may cause parsing errors

## How this service works

Unified line diff between two texts, plus an overall similarity ratio (0-1).

## Output

Returns a unified line diff (showing added, removed, and context lines) between text A and text B, along with a floating-point similarity ratio between 0 (completely different) and 1 (identical).

## Request schema (JSON Schema)

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

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "diff": [
   "--- ",
   "+++ ",
   "@@ -1,2 +1,2 @@",
   " line one",
   "-line two",
   "+line three"
  ],
  "similarity": 0.8333
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/text-diff-846392d3/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.agentindex.world](https://www.zero.xyz/host/x402.agentindex.world/llms.txt)
