# x402 Utils – Text Diff

> x402 Utils – Text Diff is a paid API for AI agents from utils.kagurazaka.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-30).

Compares two texts by lines, words, or characters and returns added/removed counts, a list of changes, and a unified diff.

## Facts

- Endpoint: POST https://utils.kagurazaka.dev/v1/diff?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-utils-text-diff-31c30642
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_87IuWcOmpd7du59b5d2So

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 x402-utils-text-diff-31c30642 -d '<json body>'
```

Example prompt: Can you diff these two paragraphs word by word and tell me what was added and removed? Old text: 'The quick brown fox jumps over the lazy dog.' New text: 'The quick red fox leaps over the sleepy dog.'

## When to prefer this

Choose this endpoint when you need a structured, machine-readable diff (added/removed counts plus a unified diff string) between two pieces of text at the line, word, or character level. It is ideal for agents that need to summarize editorial changes, verify document equivalence, or produce patch-style output without running local diff tooling. Prefer it over generic text comparison when you need all three outputs (counts, change list, and unified diff) in one call.

## Known failure modes

- Missing 'a' or 'b' fields returns a validation error
- Invalid 'mode' enum value returns a 400-style error
- Very large texts may increase latency or hit size limits
- Payment failure (402) if USDC balance is insufficient

## How this service works

Compare two texts by lines, words or characters: what was added and removed, and a unified diff for lines.

## Output

A JSON object containing: the count of added and removed units, an array of change objects each with a type ('added' or 'removed') and the affected value, a unified diff string (for line mode), and a boolean 'identical' flag indicating whether the two texts are the same.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string",
   "description": "the old text"
  },
  "b": {
   "type": "string",
   "description": "the new text"
  },
  "mode": {
   "enum": [
    "lines",
    "words",
    "chars"
   ],
   "type": "string",
   "description": "unit of comparison (default lines)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "added": 2,
  "changes": [
   {
    "type": "removed",
    "value": "two\n"
   },
   {
    "type": "added",
    "value": "2\n"
   }
  ],
  "removed": 1,
  "unified": "--- a\n+++ b\n@@ ...",
  "identical": false
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-utils-text-diff-31c30642/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from utils.kagurazaka.dev](https://www.zero.xyz/host/utils.kagurazaka.dev/llms.txt)
