{"uid":"cap_JI3VKZQDbSg0qw89vC_Jr","slug":"openverbs-text-diff-112a46c6","name":"OpenVerbs Text Diff","description":"Diff two texts. The default `unified` mode returns a unified-diff patch string; `lines`, `words`, and `chars` modes return a structured array of added/removed/unchanged parts.","url":"https://text.openverbs.com/v1/diff","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["a","b"],"properties":{"a":{"type":"string","maxLength":1000000,"description":"The original text."},"b":{"type":"string","maxLength":1000000,"description":"The changed text."},"mode":{"enum":["unified","lines","words","chars"],"type":"string","description":"Diff granularity, one of unified, lines, words, chars. Default unified."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ITsLFTr5GaOB_Ac893x-b","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compares two text strings and returns either a unified-diff patch string or a structured array of added/removed/unchanged segments at line, word, or character granularity.","exampleAgentPrompt":"Can you diff these two versions of my README — show me exactly what lines were added or removed? Here's the original: 'Hello world. This is v1.' and the updated version: 'Hello world. This is v2. Added new features.' Use lines mode so I get a structured breakdown.","exampleUseCases":[{"title":"Code review change summary","prompt":"I have two versions of a Python function — the original and the one my teammate submitted. Can you do a word-level diff so I can see exactly which words changed? Original: 'def calculate(x, y): return x + y' and new: 'def calculate(x, y, z=0): return x + y + z'"},{"title":"Document revision tracking","prompt":"I need to compare my draft contract from last week to the updated version the lawyer sent back. Run a lines diff on these two texts and tell me which lines were added, removed, or stayed the same. Old: 'Payment is due in 30 days. Late fees apply.' New: 'Payment is due in 14 days. Late fees of 2% apply. Disputes must be filed within 7 days.'"},{"title":"Config file audit","prompt":"Can you generate a unified diff patch between my old nginx config and the new one so I can apply it later? Old text is 'worker_processes 1; listen 80;' and new text is 'worker_processes 4; listen 443; ssl on;'"}],"resultDescription":"For 'unified' mode (default): a unified-diff patch string showing hunks of added (+) and removed (-) lines with context. For 'lines', 'words', or 'chars' modes: a structured JSON array where each element represents a segment tagged as added, removed, or unchanged, allowing programmatic processing of the differences.","failureModes":["Missing required fields 'a' or 'b' returns a validation error","Text exceeding 1,000,000 characters per field may be rejected","Invalid 'mode' value outside the enum returns a validation error","Empty strings for both inputs return an empty diff with no changes","Payment failure via x402 protocol returns a 402 response before processing"],"whenToPreferThis":"Choose this endpoint when you need a precise, programmatic text diff — either a ready-to-apply unified patch string or a structured segment array for downstream processing. Prefer it over LLM-based change summarization when you need exact diff semantics, reproducibility, or machine-readable output at line/word/character granularity.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:36:30.483Z","isFirstParty":false}