# Text Diff API

> Text Diff API is a paid API for AI agents from compute-api-production-245d.up.railway.app, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-11).

Computes a diff patch between two text strings, returning the patch and counts of additions and deletions.

## Facts

- Endpoint: POST https://compute-api-production-245d.up.railway.app/diff?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/text-diff-api-f4794764
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_9mZk8hF4LSPDUiwC_vzq8

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 text-diff-api-f4794764 -d '<json body>'
```

Example prompt: Can you compute the diff between this old text: 'Hello world, this is version one.' and this new text: 'Hello world, this is version two with more content.' — I need the patch and the number of lines added and deleted.

## When to prefer this

Choose this endpoint when you need a programmatic, pay-per-call text diff computation without setting up your own diff library or infrastructure — especially in agent pipelines where you want to compare two text versions on demand and receive a structured patch with line-level addition/deletion counts. Ideal for lightweight, one-off diff operations billed at $0.001 USDC per call via x402.

## Known failure modes

- Missing required fields (oldText or newText) returns a validation error
- Payment failure via x402 returns a 402 Payment Required response
- Very large text inputs may cause timeouts or memory errors
- Identical texts return an empty patch with zero additions and deletions

## How this service works

Pure computation endpoints paid per call via x402 ($0.001 USDC on Base).

## Output

Returns a JSON object containing: `patch` (a string representing the unified diff patch between oldText and newText), `additions` (integer count of added lines), and `deletions` (integer count of deleted lines).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "newText",
  "oldText"
 ],
 "properties": {
  "newText": {
   "type": "string"
  },
  "oldText": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "patch": {
   "type": "string"
  },
  "additions": {
   "type": "integer"
  },
  "deletions": {
   "type": "integer"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/text-diff-api-f4794764/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from compute-api-production-245d.up.railway.app](https://www.zero.xyz/host/compute-api-production-245d.up.railway.app/llms.txt)
