# Delx Count Substr

> Delx Count Substr 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).

Counts the number of non-overlapping occurrences of a substring (needle) within a given text string

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/count-substr
- 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-count-substr-69130d1d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rBtTKluEn1akpZKdUJL6y

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-count-substr-69130d1d -d '<json body>'
```

Example prompt: How many times does the word 'error' appear in this log text: 'error: timeout occurred, error: connection refused, warning: retry limit reached, error: unknown host'?

## When to prefer this

Use this endpoint when an AI agent needs a fast, cheap, local computation to count how many times a specific token or substring appears in text it already holds — no network calls, no external storage, no API keys required beyond x402 payment. Ideal for lightweight preflight checks on token frequency, keyword density, or repeated pattern detection within agent-held strings. At $0.001 USDC per call it is cost-effective for high-frequency agent loops.

## Known failure modes

- Missing 'text' or 'needle' field returns a 400-level error
- Empty needle string may cause undefined behavior or error
- Payment not fulfilled via x402 results in 402 Payment Required response
- Very large text payloads may exceed request size limits

## How this service works

Count non-overlapping substring occurrences. Call when you preflight how often a token appears in agent-held text. Returns integer count and needle 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 a JSON object containing an integer count of non-overlapping occurrences of the needle within the text, along with the needle string itself. No data is retained server-side.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Input field: text."
  },
  "needle": {
   "type": "string",
   "description": "Input field: needle."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "count": 2,
  "needle": "delx",
  "schema": "delx/util-count-substr/v1"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-count-substr-69130d1d/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)
