{"uid":"cap_87IuWcOmpd7du59b5d2So","slug":"x402-utils-text-diff-31c30642","name":"x402 Utils – Text Diff","description":"Compare two texts by lines, words or characters: what was added and removed, and a unified diff for lines.","url":"https://utils.kagurazaka.dev/v1/diff?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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)"}}},"responseSchema":{"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}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_PV386FC21DSDY6hb0MS5a","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compares two texts by lines, words, or characters and returns added/removed counts, a list of changes, and a unified diff.","exampleAgentPrompt":"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.'","exampleUseCases":[{"title":"Code review change summary","prompt":"Show me a line-by-line diff of these two versions of my config file so I can see exactly what changed — here's the old version and the new version."},{"title":"Proofreading word-level edits","prompt":"Compare my original draft and the edited version word by word and list what words were added or removed."},{"title":"Document identity check","prompt":"Check whether these two contract texts are identical, and if not give me a unified diff so I can see where they differ."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T07:05:07.417Z","isFirstParty":false,"canonicalSlug":"x402-utils-text-diff-31c30642"}