{"uid":"cap_VjSoWvD7AoUWnS2U1NmYK","slug":"402utils-text-similarity-a7ba39f4","name":"402utils Text Similarity","description":"Similarity of two texts in [0,1]. Methods: `jaccard` (word-set overlap, default), `levenshtein` (normalized edit distance) — both pure & deterministic — and `cosine-embed` (cosine of Cloudflare Workers AI embeddings @cf/baai/bge-m3, semantic; model named). Compare two texts (dedup, matching) without handling embeddings yourself. cosine-embed 503s unbilled if the AI binding is unavailable. Caps: jaccard 200k, levenshtein 5k, cosine 4k chars.","url":"https://402utils.com/v1/text-similarity","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"a":{"type":"string","description":"First text."},"b":{"type":"string","description":"Second text."},"method":{"enum":["jaccard","levenshtein","cosine-embed"],"type":"string","default":"jaccard","description":"jaccard (word-set), levenshtein (edit distance), or cosine-embed (semantic embeddings)."}}},"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_-UacjnJcM02K7poe2Aypw","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 similarity score between two texts using Jaccard (word-set overlap), Levenshtein (edit distance), or cosine embedding (semantic) methods, returning a value in [0,1].","exampleAgentPrompt":"How similar are these two sentences? Use the cosine-embed method: 'The quick brown fox jumps over the lazy dog' and 'A fast auburn fox leaps above a sleepy hound'.","exampleUseCases":[{"title":"Detect duplicate customer support tickets","prompt":"I'm getting flooded with support tickets. Can you check if this new ticket 'My login button is broken on mobile' is similar to our existing one 'The sign-in button doesn't work on phones'? Use the levenshtein method to catch typos and variations."},{"title":"Deduplicate product catalog entries","prompt":"We have two product descriptions that might be the same item. Compare these for similarity: 'Professional wireless noise-cancelling headphones with 30-hour battery life' and 'High-end cordless headset featuring active noise cancellation, 30 hours of battery'. Which method would best catch this near-duplicate?"},{"title":"Validate user input paraphrases","prompt":"Our form accepted two different essay submissions from a user. Check if 'Climate change is causing rapid melting of polar ice sheets' and 'The warming planet is making ice at the poles disappear quickly' are actually the same essay using cosine-embed to understand meaning."}],"resultDescription":"A JSON object containing a similarity score as a float in [0,1] (where 1 is identical/perfectly similar) and the method that was used. Higher scores indicate greater similarity.","failureModes":["503 returned for cosine-embed method if the Cloudflare AI binding is temporarily unavailable (unbilled)","Input text exceeds character cap: 200k chars for jaccard, 5k for levenshtein, 4k for cosine-embed","Missing required fields 'a' or 'b' returns a 4xx validation error","Invalid method enum value returns a 4xx error"],"whenToPreferThis":"Choose this endpoint when you need a fast, deterministic similarity score between exactly two texts without managing embedding infrastructure yourself. Jaccard is best for deduplication of long documents; Levenshtein for short strings with typos or OCR errors; cosine-embed for semantic paraphrase detection. Prefer over building your own embedding pipeline when you want a single-call, pay-per-use solution.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:51:54.901Z","isFirstParty":false}