# Text Diff (`text.diff`)

Compare two texts line by line: added and removed lines with line numbers, a similarity ratio and a unified-style diff.

- **Route:** `POST /v1/run/text.diff`
- **Price:** $0.0002 per request ($0.20 per 1,000) · `cost_usd` on every response
- **Source:** GetAllAPIs compute (`compute`) · failover: no
- **Measured latency:** p50 0 ms · p95 0 ms · p99 0 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `a` | string | yes |  | Original text (up to 2,000 lines) |
| `b` | string | yes |  | Changed text (up to 2,000 lines) |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `identical` | True when both texts are equal. |
| `lines_added` | Lines only in b. |
| `lines_removed` | Lines only in a. |
| `similarity` | 0 to 1 share of matching lines. |
| `changes` | Inserted and deleted lines with their line numbers. |
| `unified` | Whole diff with +/- prefixes. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/text.diff \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":"name: api\nport: 8000\ndebug: true","b":"name: api\nport: 8080\ndebug: true\nworkers: 4"}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('text.diff', {'a': 'name: api\nport: 8000\ndebug: true', 'b': 'name: api\nport: 8080\ndebug: true\nworkers: 4'})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run text.diff '{"a":"name: api\nport: 8000\ndebug: true","b":"name: api\nport: 8080\ndebug: true\nworkers: 4"}'
```

Quote first (free, validates input): `POST /v1/quote/text.diff` with the same body.
