# Text Statistics API

> Text Statistics API is a paid API for AI agents from api.bakhour.ca, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Computes character, word, line, and byte counts for a given text string

## Facts

- Endpoint: POST https://api.bakhour.ca/text/stats
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/text-statistics-api-65600bd7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VMv_onyemawwM9kqiZqBU

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-statistics-api-65600bd7 -d '<json body>'
```

Example prompt: Can you give me the full stats on this text — word count, line count, character count with and without whitespace, and UTF-8 byte size: 'Hello world, this is a test sentence.'

## When to prefer this

Choose this endpoint when you need precise, deterministic text statistics — particularly UTF-8 byte counts — as part of an automated pipeline. Ideal for agents that need to enforce character limits, measure storage requirements, or validate content length before passing text to downstream systems. Prefer this over client-side counting when byte-accurate UTF-8 measurement is required (e.g. for multibyte/Unicode text).

## Known failure modes

- Missing or empty 'text' field in request body — likely returns a 400 or error response
- Extremely large text inputs may time out or hit payload size limits
- Non-string values for 'text' field may cause parsing errors
- Payment failure or insufficient USDC balance results in 402 Payment Required, blocking the request

## How this service works

Decision-grade security/due-diligence outcome reports ($20-$100) plus deterministic paid utilities ($0.001+) for software agents and automated workflows.

## Output

A JSON object containing: lines (number of newline-delimited lines), words (whitespace-separated word count), bytes_utf8 (byte length in UTF-8 encoding), characters (total character count), and characters_no_whitespace (character count excluding all whitespace).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "lines": 1,
  "words": 2,
  "bytes_utf8": 11,
  "characters": 11,
  "characters_no_whitespace": 10
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/text-statistics-api-65600bd7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.bakhour.ca](https://www.zero.xyz/host/api.bakhour.ca/llms.txt)
