# Swift Bot Labs Text Diff

> Swift Bot Labs Text Diff is a paid API for AI agents from x402-toolbox.swiftbotlab.workers.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-31).

Computes a unified text diff between two strings, returning added/removed line counts and a unified diff patch

## Facts

- Endpoint: POST https://x402-toolbox.swiftbotlab.workers.dev/v1/text/diff?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/swift-bot-labs-text-diff-fc8bc3b1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_USJUcVj1MDVKyYao2hs6y

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 swift-bot-labs-text-diff-fc8bc3b1 -d '<json body>'
```

Example prompt: Show me what changed between these two paragraphs — the first one starts with 'one two three' and the second with 'one 2 three four' — give me a unified diff with 3 lines of context.

## When to prefer this

Choose this endpoint when you need a fast, deterministic, server-side unified diff computation between two text strings without setting up a local diffing library. It is ideal for agents that need to compare document versions, generate patch output, or check text identity programmatically, especially in serverless or sandboxed environments where running native diff tools is not possible. Pays per call in USDC via x402, so no API key management is needed.

## Known failure modes

- Input strings exceed 524288 character limit — request rejected
- Missing required fields 'a' or 'b' — validation error
- Context value outside 0-20 range — validation error
- Payment not included or insufficient USDC — 402 Payment Required response

## How this service works

62 small, deterministic utility APIs (DNS and e-mail checks, web extraction, EVM decoding, x402 checks, IP math, JSON/CSV, hashing, conversions). No account or API key: pay per call in USDC with x402.

## Output

Returns a JSON object with ok=true, the tool name 'text-diff', and a result object containing: the number of lines added, lines removed, number of hunks, a unified diff string in standard patch format, and a boolean indicating whether the two inputs were identical.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string",
   "maxLength": 524288
  },
  "b": {
   "type": "string",
   "maxLength": 524288
  },
  "context": {
   "type": "integer",
   "default": 3,
   "maximum": 20,
   "minimum": 0
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "tool": "text-diff",
  "result": {
   "added": 2,
   "hunks": 1,
   "removed": 1,
   "unified": "@@ -1,3 +1,4 @@\n one\n-two\n+2\n three\n+four",
   "identical": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/swift-bot-labs-text-diff-fc8bc3b1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-toolbox.swiftbotlab.workers.dev](https://www.zero.xyz/host/x402-toolbox.swiftbotlab.workers.dev/llms.txt)
