# agent402.tools Text Diff (LCS)

> agent402.tools Text Diff (LCS) 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 a line-by-line diff of two texts using LCS and returns unified-style diff operations with change counts.

## Facts

- Endpoint: POST https://agent402.tools/api/text-diff
- 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/agent402-tools-text-diff-lcs-71e7797b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_tKCBIby1DxhHldoquPYBb

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 agent402-tools-text-diff-lcs-71e7797b -d '<json body>'
```

Example prompt: Show me the line-by-line diff between these two versions of my config file — the original starts with 'timeout=30\nretries=3\n...' and the new version starts with 'timeout=60\nretries=5\n...' — I want to see exactly which lines were added, removed, or unchanged.

## When to prefer this

Use this endpoint when you need a programmatic, line-level diff between two text blocks (up to 2000 lines each) and want structured output — unified-style ops and change counts — rather than a human-readable summary. Prefer this over LLM-based comparison when you need deterministic, exact diff results suitable for downstream processing or automation.

## Known failure modes

- Input text exceeds 2000 lines per side — the endpoint enforces a line limit and will reject oversized inputs
- Missing 'a' or 'b' fields in the request body — returns a validation error
- Payment not included or insufficient — returns a 402 Payment Required response
- Network timeout if texts are very long near the limit

## How this service works

Line-by-line diff of two texts (LCS). Returns unified-style ops and change counts. Up to 2000 lines per side.

## Output

A unified-style list of diff operations (add, remove, equal) for each line, along with counts of how many lines were added, removed, and unchanged between the two input texts.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string",
   "description": "Original text"
  },
  "b": {
   "type": "string",
   "description": "New text"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "diff": [
   {
    "op": " ",
    "line": "line1"
   },
   {
    "op": "-",
    "line": "line2"
   },
   {
    "op": "+",
    "line": "line2 changed"
   }
  ],
  "added": 1,
  "removed": 1,
  "unchanged": 1
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-text-diff-lcs-71e7797b/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)
