# 24K Labs Text Diff

> 24K Labs Text Diff is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-13).

Computes a unified diff between two text strings, returning added/removed line counts and a similarity ratio.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/text-diff
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/24k-labs-text-diff-82afa4b3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__AqTwmjnkIgdK5oYtGkO4

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability 24k-labs-text-diff-82afa4b3 -d '<json body>'
```

Example prompt: 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.'

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Unified diff between two texts, plus added/removed line counts and a similarity ratio.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string"
  },
  "b": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "similarity": 0.8
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/24k-labs-text-diff-82afa4b3/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
