{"uid":"cap__AqTwmjnkIgdK5oYtGkO4","slug":"24k-labs-text-diff-82afa4b3","name":"24K Labs Text Diff","description":"Unified diff between two texts, plus added/removed line counts and a similarity ratio.","url":"https://api.24klabs.ai/api/text-diff","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"a":{"type":"string"},"b":{"type":"string"}}},"responseSchema":{"type":"json","example":{"similarity":0.8}},"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_ZMFXnQ9ByGX5xUFl2qTh3","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":"Computes a unified diff between two text strings, returning added/removed line counts and a similarity ratio.","exampleAgentPrompt":"Can you diff these two versions of my README file and tell me how many lines were added or removed and how similar they are overall? Here's the original: 'Welcome to MyApp. Install via npm.' And here's the revised: 'Welcome to MyApp v2. Install via npm or yarn. See docs for details.'","exampleUseCases":[{"title":"Code review change summary","prompt":"I just updated my config file — can you compare the old version 'host=localhost\\nport=3000\\ndebug=true' with the new one 'host=production.example.com\\nport=443\\ndebug=false\\nssl=true' and give me the unified diff, line counts, and similarity score?"},{"title":"Document revision tracking","prompt":"I have a draft essay I revised. Can you diff the original draft against the updated version and tell me what lines changed, how many were added or removed, and how similar the two versions are?"},{"title":"Detecting near-duplicate text","prompt":"I want to check if these two paragraphs are nearly identical or significantly different — can you compute the diff and similarity ratio between them so I can decide if they're duplicates?"}],"resultDescription":"Returns a unified diff string showing added and removed lines between the two input texts, integer counts of added and removed lines, and a floating-point similarity ratio (0–1) indicating how alike the two texts are.","failureModes":["Missing one or both text inputs returns a validation error","Extremely large texts may hit size or timeout limits","Empty string inputs may return a trivial diff or zero-line counts","Non-UTF-8 encoded content may cause parsing errors"],"whenToPreferThis":"Choose this endpoint when you need a structured, programmatic diff between two text strings — especially when you want the similarity ratio alongside line-level change counts. Ideal for automated document comparison, code review pipelines, and duplicate-detection workflows where you need both the diff output and a numeric similarity score in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T19:02:06.362Z","isFirstParty":false}