Compute the diff between two texts (a → b) — no git needed
Compute the diff between two texts (a → b) — no git needed. Returns a standard unified patch (line-oriented in both modes, applies with git apply or patch), added/removed counts, and in word mode a token-level change list for inline highlighting (capped at 2000 entries). CRLF line endings and missing trailing newlines are preserved byte-exactly. Caps: 1 MB UTF-8 per input; pathologically divergent inputs return 422 diff_too_complex.
2000 (raw units)
price
1
calls / 30d
1
unique payers
2026-09-18
updated
Provider
402utils.com · discovered, not yet claimed by its owner
Payment (x402 accepts[])
[
{
"scheme": "exact",
"network": "eip155:8453",
"payTo": "0xc55A2D530b53CBaD1001e4AfD4720B7E71f9C291",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "2000",
"maxTimeoutSeconds": 60
}
]Output schema
{
"bazaar": {
"info": {
"input": {
"body": {
"a": "name: farm\nprice: 1 USDC\n",
"b": "name: farm\nprice: 2 USDC\n"
},
"bodyType": "json",
"method": "POST",
"type": "http"
},
"output": {
"example": {
"identical": false,
"mode": "line",
"patch": "===================================================================\n--- a\n+++ b\n@@ -1,2 +1,2 @@\n name: farm\n-price: 1 USDC\n+price: 2 USDC\n",
"stats": {
"added": 1,
"removed": 1
}
},
"type": "json"
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"input": {
"additionalProperties": false,
"properties": {
"body": {
"description": "Two texts to compare, byte-exactly (no line-ending normalization).",
"properties": {
"a": {
"description": "Original text. Max 1 MB UTF-8.",
"type": "string"
},
"b": {
"description": "New text. Max 1 MB UTF-8.",
"type": "string"
},
"context": {
"description": "Unchanged context lines around each patch hunk. Default 3.",
"maximum": 10,
"minimum": 0,
"type": "integer"
},
"mode": {
"description": "Granularity of stats/changes. The patch is always a line-oriented unified diff. Default \"line\".",
"enum": [
"line",
"word"
],
"type": "string"
}
},
"required": [
"a",
"b"
],
"type": "object"
},
"bodyType": {
"enum": [
"json",
"form-data",
"text"
],
"type": "string"
},
"method": {
"enum": [
"POST"
],
"type": "string"
},
"type": {
"const": "http",
"type": "string"
}
},
"required": [
"type",
"method",
"bodyType",
"body"
],
"type": "object"
},
"output": {
"properties": {
"example": {
"description": "Unified patch plus change statistics.",
"properties": {
"changes": {
"description": "Word mode only (omitted when identical): token runs in order, capped at 2000 entries. Unchanged runs have added=removed=false.",
"items": {
"properties": {
"added": {
"type": "boolean"
},
"removed": {
"type": "boolean"
},
"value": {
"description": "Text of the run.",
"type": "string"
}
},
"required": [
"value",
"added",
"removed"
],
"type": "object"
},
"type": "array"
},
"identical": {
"description": "True when a and b are identical; patch is then empty.",
"type": "boolean"
},
"mode": {
"description": "Echo of the requested mode.",
"enum": [
"line",
"word"
],
"type": "string"
},
"patch": {
"description": "Unified diff patch (--- a / +++ b headers). Line-oriented in both modes; empty when identical.",
"type": "string"
},
"stats": {
"description": "Counts in lines (mode line) or words (mode word).",
"properties": {
"added": {
"description": "Lines/words added in b.",
"type": "integer"
},
"removed": {
"description": "Lines/words removed from a.",
"type": "integer"
}
},
"required": [
"added",
"removed"
],
"type": "object"
},
"truncated": {
"description": "Word mode only: true when `changes` was capped at 2000 entries.",
"type": "boolean"
}
},
"required": [
"identical",
"patch",
"stats",
"mode"
],
"type": "object"
},
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"required": [
"input"
],
"type": "object"
}
}
}Use it
curl
curl "https://402utils.com/v1/diff" # -> 402 Payment Required, accepts[] lists how to pay # retry with a PAYMENT-SIGNATURE (or PAYMENT header) once paid
JavaScript
const res = await fetch("https://402utils.com/v1/diff");
if (res.status === 402) {
const { accepts } = await res.json();
// pay one of accepts[] via an x402 client, then retry with the payment header
}Python
import httpx
res = httpx.get("https://402utils.com/v1/diff")
if res.status_code == 402:
accepts = res.json()["accepts"]
# pay one of accepts[] via an x402 client, then retry with the payment headerMachine-readable
Everything on this page is also available as clean JSON at /resources/5903.json, and this resource appears in /discovery/resources and /discovery/search.