# Delx Truncate Middle

> Delx Truncate Middle is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Truncates long text in the middle by replacing the omitted portion with an ellipsis, preserving both the start and end of the string within a specified character limit.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/truncate-middle
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/delx-truncate-middle-075e8104
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_BemjJXavUfrTAARh9SlQZ

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 delx-truncate-middle-075e8104 -d '<json body>'
```

Example prompt: Truncate this long filename 'annual-marketing-report-Q4-2024-final-revised-v3-approved.pdf' to a maximum of 40 characters, keeping both the start and end visible with an ellipsis in the middle.

## When to prefer this

Choose this endpoint when you need to preserve both the beginning and end of a string while fitting it into a fixed width — for example, file paths, URLs, identifiers, or log lines where the suffix (like a file extension or error code) is as important as the prefix. Prefer a head-truncation or tail-truncation approach instead when only one end matters. This is a lightweight, stateless local utility requiring no API keys and costing $0.001 USDC per call, ideal for high-frequency formatting tasks inside agent pipelines.

## Known failure modes

- Missing required 'text' field returns a validation error
- Missing or invalid 'max_chars' (non-integer or zero/negative) returns a validation error
- max_chars smaller than the ellipsis itself may produce undefined or edge-case output
- Payment failure via x402 prevents the call from completing
- Very large text inputs may time out or be rejected

## How this service works

Truncate long text in the middle with an ellipsis. Call when you keep start+end context inside UI/log width limits. Returns truncated text and truncated flag for $0.001 USDC via x402 on Base. No network, no keys, no retention; first-party local JSON only. Results are advisory; the caller owns budgets, auth, and production controls.

## Output

Returns the processed text string with the middle portion replaced by an ellipsis (…) so the total length fits within max_chars, plus a boolean flag indicating whether truncation actually occurred. If the input was already within the limit, the text is returned unchanged with the flag set to false.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Input field: text."
  },
  "max_chars": {
   "type": "integer",
   "description": "Input field: max chars."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "text": "abcde…vwxyz",
  "schema": "delx/util-truncate-middle/v1",
  "max_chars": 11,
  "truncated": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-truncate-middle-075e8104/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
